code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public void removeProp(String key) {
this.specProperties.remove(key);
if (this.commonProperties.containsKey(key)) {
// This case should not happen.
Properties commonPropsCopy = new Properties();
commonPropsCopy.putAll(this.commonProperties);
commonPropsCopy.remove(key);
this.commonProperties = commonPropsCopy;
}
} }
|
public class class_name {
public void removeProp(String key) {
this.specProperties.remove(key);
if (this.commonProperties.containsKey(key)) {
// This case should not happen.
Properties commonPropsCopy = new Properties();
commonPropsCopy.putAll(this.commonProperties); // depends on control dependency: [if], data = [none]
commonPropsCopy.remove(key); // depends on control dependency: [if], data = [none]
this.commonProperties = commonPropsCopy; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void newRestartLimit() {
final long newInterval = this.config.restartint * luby(this.stats.restartsCount + 1);
if (newInterval > this.limits.maxRestartInterval) { this.limits.maxRestartInterval = newInterval; }
this.limits.restart = this.stats.conflicts + newInterval;
} }
|
public class class_name {
protected void newRestartLimit() {
final long newInterval = this.config.restartint * luby(this.stats.restartsCount + 1);
if (newInterval > this.limits.maxRestartInterval) { this.limits.maxRestartInterval = newInterval; } // depends on control dependency: [if], data = [none]
this.limits.restart = this.stats.conflicts + newInterval;
} }
|
public class class_name {
public void launchFramework(BootstrapConfig config, LogProvider logProvider) {
if (config == null)
throw new IllegalArgumentException("bootstrap config must not be null");
boolean isClient = config.getProcessType().equals(BootstrapConstants.LOC_PROCESS_TYPE_CLIENT);
try {
String nTime = config.get(BootstrapConstants.LAUNCH_TIME);
startTime = nTime == null ? System.nanoTime() : Long.parseLong(nTime);
if (isClient) {
Tr.audit(tc, "audit.launchTime.client", config.getProcessName());
} else {
Tr.audit(tc, "audit.launchTime", config.getProcessName());
}
outputLicenseRestrictionMessage();
outputEmbeddedProductExtensions();
outputEnvironmentVariableProductExtensions();
// Save the bootstrap config locally
this.config = config;
boolean j2secManager = false;
if (config.get(BootstrapConstants.JAVA_2_SECURITY_PROPERTY) != null) {
j2secManager = true;
}
String j2secNoRethrow = config.get(BootstrapConstants.JAVA_2_SECURITY_NORETHROW);
if (j2secManager) {
if (j2secNoRethrow == null || j2secNoRethrow.equals("false")) {
try {
AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
System.setSecurityManager(new SecurityManager());
return null;
}
});
} catch (Exception ex) {
Tr.error(tc, "error.set.securitymanager", ex.getMessage());
}
} else {
if ("true".equals(config.get(BootstrapConstants.JAVA_2_SECURITY_UNIQUE)))
MissingDoPrivDetectionSecurityManager.setUniqueOnly(true);
try {
AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
System.setSecurityManager(new MissingDoPrivDetectionSecurityManager());
return null;
}
});
} catch (Exception ex) {
Tr.error(tc, "error.set.trace.securitymanager", ex.getMessage());
}
}
Tr.info(tc, "info.java2security.started", config.getProcessName());
}
// Start the framework.
Framework fwk = startFramework(config);
if (fwk == null) {
Tr.error(tc, "error.unableToLaunch");
return;
}
// Set the framework variables only if everything succeeded.
systemBundleCtx = fwk.getBundleContext();
framework = fwk;
} catch (BundleException e) {
throw new RuntimeException(e);
} finally {
// If an error occurred, notify anyone that was waiting for the
// framework so they know it's not coming.
frameworkLatch.countDown();
try {
if (framework != null) {
try {
addShutdownHook(isClient);
startServerCommandListener();
innerLaunchFramework(isClient);
// Indicate that kernel has been started
Tr.info(tc, "audit.kernelStartTime", getElapsedTime(false));
frameworkLaunchSuccess = true;
} finally {
// If an error occurred, notify anyone that was waiting
// for launch so they know we're done.
frameworkLaunched.countDown();
try {
if (!frameworkLaunchSuccess) {
stopFramework();
} else if (isClient) {
try {
if (waitForReady()) {
launchClient();
}
} catch (InterruptedException e) {
// Ignore
} catch (Throwable t) {
throw new ClientRunnerException("Error while executing running the application", BootstrapConstants.messages.getString("error.client.runner"), t);
} finally {
stopFramework();
}
}
} finally {
// Run the server: wait indefinitely until framework stop.
// (It might have been stopped above if an error occurred.)
waitForFrameworkStop();
// Remove the shutdown hook in case someone stopped the OSGi
// framework without calling our shutdownFramework() method.
removeShutdownHook();
// Close the command listener port, and stop any of its threads.
if (sc != null) {
sc.close();
}
if (frameworkLaunchSuccess) {
if (isClient) {
Tr.audit(tc, "audit.kernelUpTime.client", config.getProcessName(), getElapsedTime(true));
} else {
Tr.audit(tc, "audit.kernelUpTime", config.getProcessName(), getElapsedTime(true));
}
}
}
}
}
} finally {
// Stop the log provider.
if (logProvider != null) {
logProvider.stop();
}
// Finally, notify any waiters that the kernel has been shutdown.
// This is done after stopping the log provider so that logs are
// flushed in case the shutdown hook will immediately exit the JVM.
frameworkShutdownLatch.countDown();
}
}
} }
|
public class class_name {
public void launchFramework(BootstrapConfig config, LogProvider logProvider) {
if (config == null)
throw new IllegalArgumentException("bootstrap config must not be null");
boolean isClient = config.getProcessType().equals(BootstrapConstants.LOC_PROCESS_TYPE_CLIENT);
try {
String nTime = config.get(BootstrapConstants.LAUNCH_TIME);
startTime = nTime == null ? System.nanoTime() : Long.parseLong(nTime); // depends on control dependency: [try], data = [none]
if (isClient) {
Tr.audit(tc, "audit.launchTime.client", config.getProcessName()); // depends on control dependency: [if], data = [none]
} else {
Tr.audit(tc, "audit.launchTime", config.getProcessName()); // depends on control dependency: [if], data = [none]
}
outputLicenseRestrictionMessage(); // depends on control dependency: [try], data = [none]
outputEmbeddedProductExtensions(); // depends on control dependency: [try], data = [none]
outputEnvironmentVariableProductExtensions(); // depends on control dependency: [try], data = [none]
// Save the bootstrap config locally
this.config = config; // depends on control dependency: [try], data = [none]
boolean j2secManager = false;
if (config.get(BootstrapConstants.JAVA_2_SECURITY_PROPERTY) != null) {
j2secManager = true; // depends on control dependency: [if], data = [none]
}
String j2secNoRethrow = config.get(BootstrapConstants.JAVA_2_SECURITY_NORETHROW);
if (j2secManager) {
if (j2secNoRethrow == null || j2secNoRethrow.equals("false")) {
try {
AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
System.setSecurityManager(new SecurityManager());
return null;
}
}); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
Tr.error(tc, "error.set.securitymanager", ex.getMessage());
} // depends on control dependency: [catch], data = [none]
} else {
if ("true".equals(config.get(BootstrapConstants.JAVA_2_SECURITY_UNIQUE)))
MissingDoPrivDetectionSecurityManager.setUniqueOnly(true);
try {
AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
System.setSecurityManager(new MissingDoPrivDetectionSecurityManager());
return null;
}
}); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
Tr.error(tc, "error.set.trace.securitymanager", ex.getMessage());
} // depends on control dependency: [catch], data = [none]
}
Tr.info(tc, "info.java2security.started", config.getProcessName()); // depends on control dependency: [if], data = [none]
}
// Start the framework.
Framework fwk = startFramework(config);
if (fwk == null) {
Tr.error(tc, "error.unableToLaunch"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Set the framework variables only if everything succeeded.
systemBundleCtx = fwk.getBundleContext(); // depends on control dependency: [try], data = [none]
framework = fwk; // depends on control dependency: [try], data = [none]
} catch (BundleException e) {
throw new RuntimeException(e);
} finally { // depends on control dependency: [catch], data = [none]
// If an error occurred, notify anyone that was waiting for the
// framework so they know it's not coming.
frameworkLatch.countDown();
try {
if (framework != null) {
try {
addShutdownHook(isClient); // depends on control dependency: [try], data = [none]
startServerCommandListener(); // depends on control dependency: [try], data = [none]
innerLaunchFramework(isClient); // depends on control dependency: [try], data = [none]
// Indicate that kernel has been started
Tr.info(tc, "audit.kernelStartTime", getElapsedTime(false)); // depends on control dependency: [try], data = [none]
frameworkLaunchSuccess = true; // depends on control dependency: [try], data = [none]
} finally {
// If an error occurred, notify anyone that was waiting
// for launch so they know we're done.
frameworkLaunched.countDown();
try {
if (!frameworkLaunchSuccess) {
stopFramework(); // depends on control dependency: [if], data = [none]
} else if (isClient) {
try {
if (waitForReady()) {
launchClient(); // depends on control dependency: [if], data = [none]
}
} catch (InterruptedException e) {
// Ignore
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
throw new ClientRunnerException("Error while executing running the application", BootstrapConstants.messages.getString("error.client.runner"), t);
} finally { // depends on control dependency: [catch], data = [none]
stopFramework();
}
}
} finally {
// Run the server: wait indefinitely until framework stop.
// (It might have been stopped above if an error occurred.)
waitForFrameworkStop();
// Remove the shutdown hook in case someone stopped the OSGi
// framework without calling our shutdownFramework() method.
removeShutdownHook();
// Close the command listener port, and stop any of its threads.
if (sc != null) {
sc.close(); // depends on control dependency: [if], data = [none]
}
if (frameworkLaunchSuccess) {
if (isClient) {
Tr.audit(tc, "audit.kernelUpTime.client", config.getProcessName(), getElapsedTime(true)); // depends on control dependency: [if], data = [none]
} else {
Tr.audit(tc, "audit.kernelUpTime", config.getProcessName(), getElapsedTime(true)); // depends on control dependency: [if], data = [none]
}
}
}
}
}
} finally {
// Stop the log provider.
if (logProvider != null) {
logProvider.stop(); // depends on control dependency: [if], data = [none]
}
// Finally, notify any waiters that the kernel has been shutdown.
// This is done after stopping the log provider so that logs are
// flushed in case the shutdown hook will immediately exit the JVM.
frameworkShutdownLatch.countDown();
}
}
} }
|
public class class_name {
@SuppressWarnings("static-method")
@Provides
@Singleton
public HelpGenerator provideHelpGenerator(
ApplicationMetadata metadata, Injector injector, Terminal terminal) {
int maxColumns = terminal.getColumns();
if (maxColumns < TTY_MIN_COLUMNS) {
maxColumns = TTY_DEFAULT_COLUMNS;
}
String argumentSynopsis;
try {
argumentSynopsis = injector.getInstance(Key.get(String.class, ApplicationArgumentSynopsis.class));
} catch (Exception exception) {
argumentSynopsis = null;
}
String detailedDescription;
try {
detailedDescription = injector.getInstance(Key.get(String.class, ApplicationDetailedDescription.class));
} catch (Exception exception) {
detailedDescription = null;
}
return new SynopsisHelpGenerator(metadata, argumentSynopsis, detailedDescription, maxColumns);
} }
|
public class class_name {
@SuppressWarnings("static-method")
@Provides
@Singleton
public HelpGenerator provideHelpGenerator(
ApplicationMetadata metadata, Injector injector, Terminal terminal) {
int maxColumns = terminal.getColumns();
if (maxColumns < TTY_MIN_COLUMNS) {
maxColumns = TTY_DEFAULT_COLUMNS; // depends on control dependency: [if], data = [none]
}
String argumentSynopsis;
try {
argumentSynopsis = injector.getInstance(Key.get(String.class, ApplicationArgumentSynopsis.class)); // depends on control dependency: [try], data = [none]
} catch (Exception exception) {
argumentSynopsis = null;
} // depends on control dependency: [catch], data = [none]
String detailedDescription;
try {
detailedDescription = injector.getInstance(Key.get(String.class, ApplicationDetailedDescription.class)); // depends on control dependency: [try], data = [none]
} catch (Exception exception) {
detailedDescription = null;
} // depends on control dependency: [catch], data = [none]
return new SynopsisHelpGenerator(metadata, argumentSynopsis, detailedDescription, maxColumns);
} }
|
public class class_name {
private void addJavaFXProperty(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field) {
String fieldName = field.getName();
for (PropertyNode propertyNode : declaringClass.getProperties()) {
if (propertyNode.getName().equals(fieldName)) {
if (field.isStatic()) {
String message = "@griffon.transform.FXBindable cannot annotate a static property.";
generateSyntaxErrorMessage(source, node, message);
} else {
createPropertyGetterSetter(declaringClass, propertyNode);
}
return;
}
}
String message = "@griffon.transform.FXBindable must be on a property, not a field. Try removing the private, " +
"protected, or public modifier.";
generateSyntaxErrorMessage(source, node, message);
} }
|
public class class_name {
private void addJavaFXProperty(SourceUnit source, AnnotationNode node, ClassNode declaringClass, FieldNode field) {
String fieldName = field.getName();
for (PropertyNode propertyNode : declaringClass.getProperties()) {
if (propertyNode.getName().equals(fieldName)) {
if (field.isStatic()) {
String message = "@griffon.transform.FXBindable cannot annotate a static property."; // depends on control dependency: [if], data = [none]
generateSyntaxErrorMessage(source, node, message); // depends on control dependency: [if], data = [none]
} else {
createPropertyGetterSetter(declaringClass, propertyNode); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
}
String message = "@griffon.transform.FXBindable must be on a property, not a field. Try removing the private, " +
"protected, or public modifier.";
generateSyntaxErrorMessage(source, node, message);
} }
|
public class class_name {
public final static String getDefaultAlgorithm() {
String type;
type = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return Security.getProperty(
"ssl.KeyManagerFactory.algorithm");
}
});
if (type == null) {
type = "SunX509";
}
return type;
} }
|
public class class_name {
public final static String getDefaultAlgorithm() {
String type;
type = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return Security.getProperty(
"ssl.KeyManagerFactory.algorithm");
}
});
if (type == null) {
type = "SunX509"; // depends on control dependency: [if], data = [none]
}
return type;
} }
|
public class class_name {
protected List<InetSocketAddress> getAddresses(final String s) {
if (s == null) {
throw new NullPointerException("Null host list");
}
if (s.trim().isEmpty()) {
throw new IllegalArgumentException("No hosts in list: '" + s + "'");
}
List<InetSocketAddress> addrs = new ArrayList<InetSocketAddress>();
for (String hoststuff : s.split("(?:\\s|,)+")) {
if ("".equals(hoststuff)) {
continue;
}
int finalColon = hoststuff.lastIndexOf(':');
if (finalColon < 1) {
throw new IllegalArgumentException("Invalid server '" + hoststuff + "' in list: " + s);
}
String hostPart = hoststuff.substring(0, finalColon);
String portNum = hoststuff.substring(finalColon + 1);
addrs.add(new InetSocketAddress(hostPart, Integer.parseInt(portNum)));
}
return addrs;
} }
|
public class class_name {
protected List<InetSocketAddress> getAddresses(final String s) {
if (s == null) {
throw new NullPointerException("Null host list");
}
if (s.trim().isEmpty()) {
throw new IllegalArgumentException("No hosts in list: '" + s + "'");
}
List<InetSocketAddress> addrs = new ArrayList<InetSocketAddress>();
for (String hoststuff : s.split("(?:\\s|,)+")) {
if ("".equals(hoststuff)) {
continue;
}
int finalColon = hoststuff.lastIndexOf(':');
if (finalColon < 1) {
throw new IllegalArgumentException("Invalid server '" + hoststuff + "' in list: " + s);
}
String hostPart = hoststuff.substring(0, finalColon);
String portNum = hoststuff.substring(finalColon + 1);
addrs.add(new InetSocketAddress(hostPart, Integer.parseInt(portNum))); // depends on control dependency: [for], data = [none]
}
return addrs;
} }
|
public class class_name {
public void addPackageDescription(Content packageContentTree) {
if (packageDoc.inlineTags().length > 0) {
packageContentTree.addContent(
getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
Content h2Content = new StringContent(
configuration.getText("doclet.Package_Description",
packageDoc.name()));
packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
true, h2Content));
addInlineComment(packageDoc, packageContentTree);
}
} }
|
public class class_name {
public void addPackageDescription(Content packageContentTree) {
if (packageDoc.inlineTags().length > 0) {
packageContentTree.addContent(
getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION)); // depends on control dependency: [if], data = [none]
Content h2Content = new StringContent(
configuration.getText("doclet.Package_Description",
packageDoc.name()));
packageContentTree.addContent(HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING,
true, h2Content)); // depends on control dependency: [if], data = [none]
addInlineComment(packageDoc, packageContentTree); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String hash(String algorithm, String str, String charsetName) {
try {
byte[] digest = MessageDigest
.getInstance(algorithm)
.digest(strToBytesWithCharset(str, charsetName));
return EncodingUtils.hex(digest);
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("Unsupported algorithm: " + algorithm, e);
}
} }
|
public class class_name {
public static String hash(String algorithm, String str, String charsetName) {
try {
byte[] digest = MessageDigest
.getInstance(algorithm)
.digest(strToBytesWithCharset(str, charsetName));
return EncodingUtils.hex(digest); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("Unsupported algorithm: " + algorithm, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private String FCMGetFreshToken(final String senderID) {
String token = null;
try {
if(senderID != null){
getConfigLogger().verbose(getAccountId(), "FcmManager: Requesting a FCM token with Sender Id - "+senderID);
token = FirebaseInstanceId.getInstance().getToken(senderID, FirebaseMessaging.INSTANCE_ID_SCOPE);
}else {
getConfigLogger().verbose(getAccountId(), "FcmManager: Requesting a FCM token");
token = FirebaseInstanceId.getInstance().getToken();
}
getConfigLogger().info(getAccountId(),"FCM token: "+token);
} catch (Throwable t) {
getConfigLogger().verbose(getAccountId(), "FcmManager: Error requesting FCM token", t);
}
return token;
} }
|
public class class_name {
private String FCMGetFreshToken(final String senderID) {
String token = null;
try {
if(senderID != null){
getConfigLogger().verbose(getAccountId(), "FcmManager: Requesting a FCM token with Sender Id - "+senderID); // depends on control dependency: [if], data = [none]
token = FirebaseInstanceId.getInstance().getToken(senderID, FirebaseMessaging.INSTANCE_ID_SCOPE); // depends on control dependency: [if], data = [(senderID]
}else {
getConfigLogger().verbose(getAccountId(), "FcmManager: Requesting a FCM token"); // depends on control dependency: [if], data = [none]
token = FirebaseInstanceId.getInstance().getToken(); // depends on control dependency: [if], data = [none]
}
getConfigLogger().info(getAccountId(),"FCM token: "+token); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
getConfigLogger().verbose(getAccountId(), "FcmManager: Error requesting FCM token", t);
} // depends on control dependency: [catch], data = [none]
return token;
} }
|
public class class_name {
public Double getDoubleObject(String attributeName) {
String val = get(attributeName, null);
if (val != null) {
return Double.valueOf(val);
}
return null;
} }
|
public class class_name {
public Double getDoubleObject(String attributeName) {
String val = get(attributeName, null);
if (val != null) {
return Double.valueOf(val); // depends on control dependency: [if], data = [(val]
}
return null;
} }
|
public class class_name {
private void setLineLinePredicates_() {
m_predicates_half_edge = Predicates.LineLinePredicates;
m_predicates_cluster = Predicates.LinePointPredicates;
m_max_dim[MatrixPredicate.InteriorInterior] = 1;
m_max_dim[MatrixPredicate.InteriorBoundary] = 0;
m_max_dim[MatrixPredicate.InteriorExterior] = 1;
m_max_dim[MatrixPredicate.BoundaryInterior] = 0;
m_max_dim[MatrixPredicate.BoundaryBoundary] = 0;
m_max_dim[MatrixPredicate.BoundaryExterior] = 0;
m_max_dim[MatrixPredicate.ExteriorInterior] = 1;
m_max_dim[MatrixPredicate.ExteriorBoundary] = 0;
m_max_dim[MatrixPredicate.ExteriorExterior] = 2;
// set predicates that are always true/false
if (m_perform_predicates[MatrixPredicate.ExteriorExterior])
{
m_matrix[MatrixPredicate.ExteriorExterior] = 2; // Always true
m_perform_predicates[MatrixPredicate.ExteriorExterior] = false;
m_predicate_count--;
}
} }
|
public class class_name {
private void setLineLinePredicates_() {
m_predicates_half_edge = Predicates.LineLinePredicates;
m_predicates_cluster = Predicates.LinePointPredicates;
m_max_dim[MatrixPredicate.InteriorInterior] = 1;
m_max_dim[MatrixPredicate.InteriorBoundary] = 0;
m_max_dim[MatrixPredicate.InteriorExterior] = 1;
m_max_dim[MatrixPredicate.BoundaryInterior] = 0;
m_max_dim[MatrixPredicate.BoundaryBoundary] = 0;
m_max_dim[MatrixPredicate.BoundaryExterior] = 0;
m_max_dim[MatrixPredicate.ExteriorInterior] = 1;
m_max_dim[MatrixPredicate.ExteriorBoundary] = 0;
m_max_dim[MatrixPredicate.ExteriorExterior] = 2;
// set predicates that are always true/false
if (m_perform_predicates[MatrixPredicate.ExteriorExterior])
{
m_matrix[MatrixPredicate.ExteriorExterior] = 2; // Always true // depends on control dependency: [if], data = [none]
m_perform_predicates[MatrixPredicate.ExteriorExterior] = false; // depends on control dependency: [if], data = [none]
m_predicate_count--; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public SQLiteDatabase openWritableDatabase() {
lockDb.lock();
try {
if (sqliteHelper == null)
createHelper(options);
status.set(TypeStatus.READ_AND_WRITE_OPENED);
if (openCounter.incrementAndGet() == 1) {
// open new write database
if (database == null) {
sqliteHelper.setWriteAheadLoggingEnabled(true);
database = sqliteHelper.getWritableDatabase();
}
if (logEnabled)
Logger.info("database OPEN %s (connections: %s)", status.get(), (openCounter.intValue() - 1));
} else {
if (logEnabled)
Logger.info("database REUSE %s (connections: %s)", status.get(), (openCounter.intValue() - 1));
}
} finally {
lockDb.unlock();
lockReadWriteAccess.lock();
}
return database;
} }
|
public class class_name {
public SQLiteDatabase openWritableDatabase() {
lockDb.lock();
try {
if (sqliteHelper == null)
createHelper(options);
status.set(TypeStatus.READ_AND_WRITE_OPENED); // depends on control dependency: [try], data = [none]
if (openCounter.incrementAndGet() == 1) {
// open new write database
if (database == null) {
sqliteHelper.setWriteAheadLoggingEnabled(true); // depends on control dependency: [if], data = [none]
database = sqliteHelper.getWritableDatabase(); // depends on control dependency: [if], data = [none]
}
if (logEnabled)
Logger.info("database OPEN %s (connections: %s)", status.get(), (openCounter.intValue() - 1));
} else {
if (logEnabled)
Logger.info("database REUSE %s (connections: %s)", status.get(), (openCounter.intValue() - 1));
}
} finally {
lockDb.unlock();
lockReadWriteAccess.lock();
}
return database;
} }
|
public class class_name {
public void mergeProposedItem(final InvoiceItem invoiceItem) {
Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem);
// Check if it was an existing item ignored for tree purposes (e.g. FIXED or $0 RECURRING, both of which aren't repaired)
final InvoiceItem existingItem = Iterables.tryFind(existingIgnoredItems, new Predicate<InvoiceItem>() {
@Override
public boolean apply(final InvoiceItem input) {
return input.matches(invoiceItem);
}
}).orNull();
if (existingItem != null) {
return;
}
switch (invoiceItem.getInvoiceItemType()) {
case RECURRING:
// merged means we've either matched the proposed to an existing, or triggered a repair
final boolean merged = root.addProposedItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD)));
if (!merged) {
items.add(new Item(invoiceItem, targetInvoiceId, ItemAction.ADD));
}
break;
case FIXED:
remainingIgnoredItems.add(invoiceItem);
break;
default:
Preconditions.checkState(false, "Unexpected proposed item " + invoiceItem);
}
} }
|
public class class_name {
public void mergeProposedItem(final InvoiceItem invoiceItem) {
Preconditions.checkState(!isBuilt, "Tree already built, unable to add new invoiceItem=%s", invoiceItem);
// Check if it was an existing item ignored for tree purposes (e.g. FIXED or $0 RECURRING, both of which aren't repaired)
final InvoiceItem existingItem = Iterables.tryFind(existingIgnoredItems, new Predicate<InvoiceItem>() {
@Override
public boolean apply(final InvoiceItem input) {
return input.matches(invoiceItem);
}
}).orNull();
if (existingItem != null) {
return; // depends on control dependency: [if], data = [none]
}
switch (invoiceItem.getInvoiceItemType()) {
case RECURRING:
// merged means we've either matched the proposed to an existing, or triggered a repair
final boolean merged = root.addProposedItem(new ItemsNodeInterval(root, new Item(invoiceItem, targetInvoiceId, ItemAction.ADD)));
if (!merged) {
items.add(new Item(invoiceItem, targetInvoiceId, ItemAction.ADD)); // depends on control dependency: [if], data = [none]
}
break;
case FIXED:
remainingIgnoredItems.add(invoiceItem);
break;
default:
Preconditions.checkState(false, "Unexpected proposed item " + invoiceItem);
}
} }
|
public class class_name {
public Token scanSymbol() {
int length = 0;
while (CharType.isSymbol(charAt(offset + length))) {
length++;
}
String literals = input.substring(offset, offset + length);
Symbol symbol;
while (null == (symbol = Symbol.literalsOf(literals))) {
literals = input.substring(offset, offset + --length);
}
return new Token(symbol, literals, offset + length);
} }
|
public class class_name {
public Token scanSymbol() {
int length = 0;
while (CharType.isSymbol(charAt(offset + length))) {
length++; // depends on control dependency: [while], data = [none]
}
String literals = input.substring(offset, offset + length);
Symbol symbol;
while (null == (symbol = Symbol.literalsOf(literals))) {
literals = input.substring(offset, offset + --length); // depends on control dependency: [while], data = [none]
}
return new Token(symbol, literals, offset + length);
} }
|
public class class_name {
protected TypeCodec<?> createCodec(DataType cqlType) {
if (cqlType instanceof ListType) {
DataType elementType = ((ListType) cqlType).getElementType();
TypeCodec<Object> elementCodec = codecFor(elementType);
return TypeCodecs.listOf(elementCodec);
} else if (cqlType instanceof SetType) {
DataType elementType = ((SetType) cqlType).getElementType();
TypeCodec<Object> elementCodec = codecFor(elementType);
return TypeCodecs.setOf(elementCodec);
} else if (cqlType instanceof MapType) {
DataType keyType = ((MapType) cqlType).getKeyType();
DataType valueType = ((MapType) cqlType).getValueType();
TypeCodec<Object> keyCodec = codecFor(keyType);
TypeCodec<Object> valueCodec = codecFor(valueType);
return TypeCodecs.mapOf(keyCodec, valueCodec);
} else if (cqlType instanceof TupleType) {
return TypeCodecs.tupleOf((TupleType) cqlType);
} else if (cqlType instanceof UserDefinedType) {
return TypeCodecs.udtOf((UserDefinedType) cqlType);
} else if (cqlType instanceof CustomType) {
return TypeCodecs.custom(cqlType);
}
throw new CodecNotFoundException(cqlType, null);
} }
|
public class class_name {
protected TypeCodec<?> createCodec(DataType cqlType) {
if (cqlType instanceof ListType) {
DataType elementType = ((ListType) cqlType).getElementType();
TypeCodec<Object> elementCodec = codecFor(elementType);
return TypeCodecs.listOf(elementCodec); // depends on control dependency: [if], data = [none]
} else if (cqlType instanceof SetType) {
DataType elementType = ((SetType) cqlType).getElementType();
TypeCodec<Object> elementCodec = codecFor(elementType);
return TypeCodecs.setOf(elementCodec); // depends on control dependency: [if], data = [none]
} else if (cqlType instanceof MapType) {
DataType keyType = ((MapType) cqlType).getKeyType();
DataType valueType = ((MapType) cqlType).getValueType();
TypeCodec<Object> keyCodec = codecFor(keyType);
TypeCodec<Object> valueCodec = codecFor(valueType);
return TypeCodecs.mapOf(keyCodec, valueCodec); // depends on control dependency: [if], data = [none]
} else if (cqlType instanceof TupleType) {
return TypeCodecs.tupleOf((TupleType) cqlType); // depends on control dependency: [if], data = [none]
} else if (cqlType instanceof UserDefinedType) {
return TypeCodecs.udtOf((UserDefinedType) cqlType); // depends on control dependency: [if], data = [none]
} else if (cqlType instanceof CustomType) {
return TypeCodecs.custom(cqlType); // depends on control dependency: [if], data = [none]
}
throw new CodecNotFoundException(cqlType, null);
} }
|
public class class_name {
public static <T> T[] toWrapperIfPrimitive(Object froms) {
if (froms == null) {
return null;
}
Class<?> type = froms.getClass().getComponentType();
if (!type.isPrimitive()) {
return (T[]) froms;
}
PrimitiveWrapperArray transformTo = PrimitiveWrapperArray.find(froms.getClass());
if (transformTo == null) {
return null;
}
int size = Array.getLength(froms);
T[] result = (T[]) Array.newInstance(ClassUtil.getWrapperTypeIfPrimitive(type), size);
for (int i = 0; i < size; i++) {
T value = (T) Array.get(froms, i);
result[i] = value;
}
return result;
} }
|
public class class_name {
public static <T> T[] toWrapperIfPrimitive(Object froms) {
if (froms == null) {
return null; // depends on control dependency: [if], data = [none]
}
Class<?> type = froms.getClass().getComponentType();
if (!type.isPrimitive()) {
return (T[]) froms; // depends on control dependency: [if], data = [none]
}
PrimitiveWrapperArray transformTo = PrimitiveWrapperArray.find(froms.getClass());
if (transformTo == null) {
return null; // depends on control dependency: [if], data = [none]
}
int size = Array.getLength(froms);
T[] result = (T[]) Array.newInstance(ClassUtil.getWrapperTypeIfPrimitive(type), size);
for (int i = 0; i < size; i++) {
T value = (T) Array.get(froms, i);
result[i] = value; // depends on control dependency: [for], data = [i]
}
return result;
} }
|
public class class_name {
private static String getFromEnvFile(String varname, String filename)
{
try
{
String code = readFile(filename);
StringTokenizer stk = new StringTokenizer(code, "\n");
while (stk.hasMoreTokens())
{
String line = stk.nextToken().trim();
if (line.startsWith("#")==false)
{
int pos = line.indexOf(varname+"=");
if (pos>=0) // Var found
return line.substring(pos+varname.length()+1);
}
}
}
catch(Exception e) {
//System.err.println(e);
}
return null;
} }
|
public class class_name {
private static String getFromEnvFile(String varname, String filename)
{
try
{
String code = readFile(filename);
StringTokenizer stk = new StringTokenizer(code, "\n");
while (stk.hasMoreTokens())
{
String line = stk.nextToken().trim();
if (line.startsWith("#")==false)
{
int pos = line.indexOf(varname+"=");
if (pos>=0) // Var found
return line.substring(pos+varname.length()+1);
}
}
}
catch(Exception e) {
//System.err.println(e);
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
private Option<File> findManifestInParentsDirectories() {
Option<FileHelper.FileHolder> projectRootHolderOption = fileHelper.findRootProjectHolder();
if (projectRootHolderOption.isAbsent()) {
return Option.absent();
}
FileHelper.FileHolder projectRootHolder = projectRootHolderOption.get();
File projectRoot = projectRootHolder.projectRoot;
File androidManifestFile = new File(projectRoot, "AndroidManifest.xml");
for (int i = 0; i < MAX_PARENTS_FROM_SOURCE_FOLDER; i++) {
if (androidManifestFile.exists()) {
break;
}
androidManifestFile = new File(projectRoot,"src" + File.separator + "main" + File.separator + "AndroidManifest.xml");
if (androidManifestFile.exists()) {
break;
}
if (projectRoot.getParentFile() != null) {
projectRoot = projectRoot.getParentFile();
androidManifestFile = new File(projectRoot, "AndroidManifest.xml");
} else {
break;
}
}
if (!androidManifestFile.exists()) {
return Option.absent();
}
return Option.of(androidManifestFile);
} }
|
public class class_name {
private Option<File> findManifestInParentsDirectories() {
Option<FileHelper.FileHolder> projectRootHolderOption = fileHelper.findRootProjectHolder();
if (projectRootHolderOption.isAbsent()) {
return Option.absent(); // depends on control dependency: [if], data = [none]
}
FileHelper.FileHolder projectRootHolder = projectRootHolderOption.get();
File projectRoot = projectRootHolder.projectRoot;
File androidManifestFile = new File(projectRoot, "AndroidManifest.xml");
for (int i = 0; i < MAX_PARENTS_FROM_SOURCE_FOLDER; i++) {
if (androidManifestFile.exists()) {
break;
}
androidManifestFile = new File(projectRoot,"src" + File.separator + "main" + File.separator + "AndroidManifest.xml");
if (androidManifestFile.exists()) {
break;
}
if (projectRoot.getParentFile() != null) {
projectRoot = projectRoot.getParentFile();
androidManifestFile = new File(projectRoot, "AndroidManifest.xml");
} else {
break;
}
}
if (!androidManifestFile.exists()) {
return Option.absent();
}
return Option.of(androidManifestFile);
} }
|
public class class_name {
@Deactivate
protected void deactivate(ComponentContext context) {
lock.writeLock().lock();
try {
componentContext = null;
properties = null;
threadContextConfigurations = null;
} finally {
lock.writeLock().unlock();
}
} }
|
public class class_name {
@Deactivate
protected void deactivate(ComponentContext context) {
lock.writeLock().lock();
try {
componentContext = null; // depends on control dependency: [try], data = [none]
properties = null; // depends on control dependency: [try], data = [none]
threadContextConfigurations = null; // depends on control dependency: [try], data = [none]
} finally {
lock.writeLock().unlock();
}
} }
|
public class class_name {
public static void waitRandomlySquared(long maxMsRoot) {
long random = (long) (Math.random() * maxMsRoot);
try {
Thread.sleep(random * random);
} catch (InterruptedException e) {
e.printStackTrace();
}
} }
|
public class class_name {
public static void waitRandomlySquared(long maxMsRoot) {
long random = (long) (Math.random() * maxMsRoot);
try {
Thread.sleep(random * random);
// depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public BatchImportFindingsRequest withFindings(AwsSecurityFinding... findings) {
if (this.findings == null) {
setFindings(new java.util.ArrayList<AwsSecurityFinding>(findings.length));
}
for (AwsSecurityFinding ele : findings) {
this.findings.add(ele);
}
return this;
} }
|
public class class_name {
public BatchImportFindingsRequest withFindings(AwsSecurityFinding... findings) {
if (this.findings == null) {
setFindings(new java.util.ArrayList<AwsSecurityFinding>(findings.length)); // depends on control dependency: [if], data = [none]
}
for (AwsSecurityFinding ele : findings) {
this.findings.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public XObject execute(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
if (xctxt.isSecureProcessing())
throw new javax.xml.transform.TransformerException(
XPATHMessages.createXPATHMessage(
XPATHErrorResources.ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED,
new Object[] {toString()}));
XObject result;
Vector argVec = new Vector();
int nArgs = m_argVec.size();
for (int i = 0; i < nArgs; i++)
{
Expression arg = (Expression) m_argVec.elementAt(i);
XObject xobj = arg.execute(xctxt);
/*
* Should cache the arguments for func:function
*/
xobj.allowDetachToRelease(false);
argVec.addElement(xobj);
}
//dml
ExtensionsProvider extProvider = (ExtensionsProvider)xctxt.getOwnerObject();
Object val = extProvider.extFunction(this, argVec);
if (null != val)
{
result = XObject.create(val, xctxt);
}
else
{
result = new XNull();
}
return result;
} }
|
public class class_name {
public XObject execute(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
if (xctxt.isSecureProcessing())
throw new javax.xml.transform.TransformerException(
XPATHMessages.createXPATHMessage(
XPATHErrorResources.ER_EXTENSION_FUNCTION_CANNOT_BE_INVOKED,
new Object[] {toString()}));
XObject result;
Vector argVec = new Vector();
int nArgs = m_argVec.size();
for (int i = 0; i < nArgs; i++)
{
Expression arg = (Expression) m_argVec.elementAt(i);
XObject xobj = arg.execute(xctxt);
/*
* Should cache the arguments for func:function
*/
xobj.allowDetachToRelease(false); // depends on control dependency: [for], data = [none]
argVec.addElement(xobj); // depends on control dependency: [for], data = [none]
}
//dml
ExtensionsProvider extProvider = (ExtensionsProvider)xctxt.getOwnerObject();
Object val = extProvider.extFunction(this, argVec);
if (null != val)
{
result = XObject.create(val, xctxt); // depends on control dependency: [if], data = [none]
}
else
{
result = new XNull(); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public void marshall(DvbSubSourceSettings dvbSubSourceSettings, ProtocolMarshaller protocolMarshaller) {
if (dvbSubSourceSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dvbSubSourceSettings.getPid(), PID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DvbSubSourceSettings dvbSubSourceSettings, ProtocolMarshaller protocolMarshaller) {
if (dvbSubSourceSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(dvbSubSourceSettings.getPid(), PID_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 processOtherContent(Wrapper<Content> content) {
if (processFirstOtherContent) {
builder.append(baseIndent).append("otherContentList=").append("\n");
processFirstOtherContent = false;
}
builder.append(content.toString(baseIndent)).append("\n");
} }
|
public class class_name {
@Override
public void processOtherContent(Wrapper<Content> content) {
if (processFirstOtherContent) {
builder.append(baseIndent).append("otherContentList=").append("\n"); // depends on control dependency: [if], data = [none]
processFirstOtherContent = false; // depends on control dependency: [if], data = [none]
}
builder.append(content.toString(baseIndent)).append("\n");
} }
|
public class class_name {
public void convert(TypeDesc fromType, TypeDesc toType) {
if (toType == TypeDesc.OBJECT) {
if (fromType.isPrimitive()) {
toType = fromType.toObjectType();
}
else {
return;
}
}
if (fromType == toType) {
return;
}
TypeDesc fromPrimitiveType = fromType.toPrimitiveType();
if (fromPrimitiveType == null) {
throw invalidConversion(fromType, toType);
}
int fromTypeCode = fromPrimitiveType.getTypeCode();
if (!fromType.isPrimitive()) {
unbox(fromType, fromPrimitiveType);
}
TypeDesc toPrimitiveType = toType.toPrimitiveType();
if (toPrimitiveType == null) {
throw invalidConversion(fromType, toType);
}
int toTypeCode = toPrimitiveType.getTypeCode();
int stackAdjust = 0;
byte op;
switch (fromTypeCode) {
case TypeDesc.INT_CODE:
case TypeDesc.BYTE_CODE:
case TypeDesc.SHORT_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.BOOLEAN_CODE:
switch (toTypeCode) {
case TypeDesc.BYTE_CODE:
op = (fromTypeCode == TypeDesc.BYTE_CODE) ?
Opcode.NOP : Opcode.I2B;
break;
case TypeDesc.SHORT_CODE:
op = (fromTypeCode == TypeDesc.SHORT_CODE) ?
Opcode.NOP : Opcode.I2S;
break;
case TypeDesc.CHAR_CODE:
op = (fromTypeCode == TypeDesc.CHAR_CODE) ?
Opcode.NOP : Opcode.I2C;
break;
case TypeDesc.FLOAT_CODE:
op = Opcode.I2F;
break;
case TypeDesc.LONG_CODE:
stackAdjust = 1;
op = Opcode.I2L;
break;
case TypeDesc.DOUBLE_CODE:
stackAdjust = 1;
op = Opcode.I2D;
break;
case TypeDesc.INT_CODE:
op = Opcode.NOP;
break;
case TypeDesc.BOOLEAN_CODE:
toBoolean(!toType.isPrimitive());
return;
default:
throw invalidConversion(fromType, toType);
}
break;
case TypeDesc.LONG_CODE:
switch (toTypeCode) {
case TypeDesc.INT_CODE:
stackAdjust = -1;
op = Opcode.L2I;
break;
case TypeDesc.FLOAT_CODE:
stackAdjust = -1;
op = Opcode.L2F;
break;
case TypeDesc.DOUBLE_CODE:
op = Opcode.L2D;
break;
case TypeDesc.BYTE_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.SHORT_CODE:
addCode(-1, Opcode.L2I);
convert(TypeDesc.INT, toPrimitiveType);
// fall through
case TypeDesc.LONG_CODE:
op = Opcode.NOP;
break;
case TypeDesc.BOOLEAN_CODE:
loadConstant(0L);
math(Opcode.LCMP);
toBoolean(!toType.isPrimitive());
return;
default:
throw invalidConversion(fromType, toType);
}
break;
case TypeDesc.FLOAT_CODE:
switch (toTypeCode) {
case TypeDesc.INT_CODE:
op = Opcode.F2I;
break;
case TypeDesc.LONG_CODE:
stackAdjust = 1;
op = Opcode.F2L;
break;
case TypeDesc.DOUBLE_CODE:
stackAdjust = 1;
op = Opcode.F2D;
break;
case TypeDesc.BYTE_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.SHORT_CODE:
addCode(0, Opcode.F2I);
convert(TypeDesc.INT, toPrimitiveType);
// fall through
case TypeDesc.FLOAT_CODE:
op = Opcode.NOP;
break;
case TypeDesc.BOOLEAN_CODE:
loadConstant(0.0f);
math(Opcode.FCMPG);
toBoolean(!toType.isPrimitive());
return;
default:
throw invalidConversion(fromType, toType);
}
break;
case TypeDesc.DOUBLE_CODE:
switch (toTypeCode) {
case TypeDesc.INT_CODE:
stackAdjust = -1;
op = Opcode.D2I;
break;
case TypeDesc.FLOAT_CODE:
stackAdjust = -1;
op = Opcode.D2F;
break;
case TypeDesc.LONG_CODE:
op = Opcode.D2L;
break;
case TypeDesc.BYTE_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.SHORT_CODE:
addCode(-1, Opcode.D2I);
convert(TypeDesc.INT, toPrimitiveType);
// fall through
case TypeDesc.DOUBLE_CODE:
op = Opcode.NOP;
break;
case TypeDesc.BOOLEAN_CODE:
loadConstant(0.0d);
math(Opcode.DCMPG);
toBoolean(!toType.isPrimitive());
return;
default:
throw invalidConversion(fromType, toType);
}
break;
default:
throw invalidConversion(fromType, toType);
}
if (toType.isPrimitive()) {
if (op != Opcode.NOP) {
addCode(stackAdjust, op);
}
}
else {
if (op == Opcode.NOP) {
prebox(toPrimitiveType, toType);
}
// Slight optimization here. Perform prebox on single word value,
// depending on what conversion is being applied.
else if (!fromPrimitiveType.isDoubleWord() &&
toPrimitiveType.isDoubleWord()) {
prebox(fromPrimitiveType, toType);
addCode(stackAdjust, op);
}
else {
addCode(stackAdjust, op);
prebox(toPrimitiveType, toType);
}
box(toPrimitiveType, toType);
}
} }
|
public class class_name {
public void convert(TypeDesc fromType, TypeDesc toType) {
if (toType == TypeDesc.OBJECT) {
if (fromType.isPrimitive()) {
toType = fromType.toObjectType(); // depends on control dependency: [if], data = [none]
}
else {
return; // depends on control dependency: [if], data = [none]
}
}
if (fromType == toType) {
return; // depends on control dependency: [if], data = [none]
}
TypeDesc fromPrimitiveType = fromType.toPrimitiveType();
if (fromPrimitiveType == null) {
throw invalidConversion(fromType, toType);
}
int fromTypeCode = fromPrimitiveType.getTypeCode();
if (!fromType.isPrimitive()) {
unbox(fromType, fromPrimitiveType); // depends on control dependency: [if], data = [none]
}
TypeDesc toPrimitiveType = toType.toPrimitiveType();
if (toPrimitiveType == null) {
throw invalidConversion(fromType, toType);
}
int toTypeCode = toPrimitiveType.getTypeCode();
int stackAdjust = 0;
byte op;
switch (fromTypeCode) {
case TypeDesc.INT_CODE:
case TypeDesc.BYTE_CODE:
case TypeDesc.SHORT_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.BOOLEAN_CODE:
switch (toTypeCode) {
case TypeDesc.BYTE_CODE:
op = (fromTypeCode == TypeDesc.BYTE_CODE) ?
Opcode.NOP : Opcode.I2B;
break;
case TypeDesc.SHORT_CODE:
op = (fromTypeCode == TypeDesc.SHORT_CODE) ?
Opcode.NOP : Opcode.I2S;
break;
case TypeDesc.CHAR_CODE:
op = (fromTypeCode == TypeDesc.CHAR_CODE) ?
Opcode.NOP : Opcode.I2C;
break;
case TypeDesc.FLOAT_CODE:
op = Opcode.I2F;
break;
case TypeDesc.LONG_CODE:
stackAdjust = 1;
op = Opcode.I2L;
break;
case TypeDesc.DOUBLE_CODE:
stackAdjust = 1;
op = Opcode.I2D;
break;
case TypeDesc.INT_CODE:
op = Opcode.NOP;
break;
case TypeDesc.BOOLEAN_CODE:
toBoolean(!toType.isPrimitive());
return;
default:
throw invalidConversion(fromType, toType);
}
break;
case TypeDesc.LONG_CODE:
switch (toTypeCode) {
case TypeDesc.INT_CODE:
stackAdjust = -1;
op = Opcode.L2I;
break;
case TypeDesc.FLOAT_CODE:
stackAdjust = -1;
op = Opcode.L2F;
break;
case TypeDesc.DOUBLE_CODE:
op = Opcode.L2D;
break;
case TypeDesc.BYTE_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.SHORT_CODE:
addCode(-1, Opcode.L2I);
convert(TypeDesc.INT, toPrimitiveType);
// fall through
case TypeDesc.LONG_CODE:
op = Opcode.NOP;
break;
case TypeDesc.BOOLEAN_CODE:
loadConstant(0L);
math(Opcode.LCMP);
toBoolean(!toType.isPrimitive());
return;
default:
throw invalidConversion(fromType, toType);
}
break;
case TypeDesc.FLOAT_CODE:
switch (toTypeCode) {
case TypeDesc.INT_CODE:
op = Opcode.F2I;
break;
case TypeDesc.LONG_CODE:
stackAdjust = 1;
op = Opcode.F2L;
break;
case TypeDesc.DOUBLE_CODE:
stackAdjust = 1;
op = Opcode.F2D;
break;
case TypeDesc.BYTE_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.SHORT_CODE:
addCode(0, Opcode.F2I);
convert(TypeDesc.INT, toPrimitiveType);
// fall through
case TypeDesc.FLOAT_CODE:
op = Opcode.NOP;
break;
case TypeDesc.BOOLEAN_CODE:
loadConstant(0.0f);
math(Opcode.FCMPG);
toBoolean(!toType.isPrimitive());
return;
default:
throw invalidConversion(fromType, toType);
}
break;
case TypeDesc.DOUBLE_CODE:
switch (toTypeCode) {
case TypeDesc.INT_CODE:
stackAdjust = -1;
op = Opcode.D2I;
break;
case TypeDesc.FLOAT_CODE:
stackAdjust = -1;
op = Opcode.D2F;
break;
case TypeDesc.LONG_CODE:
op = Opcode.D2L;
break;
case TypeDesc.BYTE_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.SHORT_CODE:
addCode(-1, Opcode.D2I);
convert(TypeDesc.INT, toPrimitiveType);
// fall through
case TypeDesc.DOUBLE_CODE:
op = Opcode.NOP;
break;
case TypeDesc.BOOLEAN_CODE:
loadConstant(0.0d);
math(Opcode.DCMPG);
toBoolean(!toType.isPrimitive());
return;
default:
throw invalidConversion(fromType, toType);
}
break;
default:
throw invalidConversion(fromType, toType);
}
if (toType.isPrimitive()) {
if (op != Opcode.NOP) {
addCode(stackAdjust, op);
}
}
else {
if (op == Opcode.NOP) {
prebox(toPrimitiveType, toType);
}
// Slight optimization here. Perform prebox on single word value,
// depending on what conversion is being applied.
else if (!fromPrimitiveType.isDoubleWord() &&
toPrimitiveType.isDoubleWord()) {
prebox(fromPrimitiveType, toType);
addCode(stackAdjust, op);
}
else {
addCode(stackAdjust, op);
prebox(toPrimitiveType, toType);
}
box(toPrimitiveType, toType);
}
} }
|
public class class_name {
void start() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "start");
synchronized (stateLock) {
// We will start each consumer inside its own catch block so that
// the failing of a single consumer does not adversely affect any
// other. The first exception that is received is stored in this
// variable and will be passed back up to the Connection when all
// the starts are complete.
JMSException excReceived = null;
// Start all the synchronous consumers
// Take a copy of the list of synchronous consumers. A sync block in
// createConsumer means that you cannot add anything to this list until
// session.start completes, however consumers can still be removed (as
// a result of the consumer.close operation), so by the time we get to
// calling start on the elements in this list, some of them may already
// be closed (pathalogical scenario). Calling start on a closed consumer
// has no effect, so this shouldn't cause a problem.
Object[] syncList = syncConsumers.toArray();
for (int i = 0; i < syncList.length; i++) {
try {
((JmsMsgConsumerImpl) syncList[i]).start();
} catch (JMSException e) {
// No FFDC code needed
// Cache the exception to be thrown back at the end of the method,
// but don't take any other action here. The exception will already
// have been logged in JmsMsgConsumerImpl.start.
if (excReceived == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "JMSException received at Session.start. Will continue trying to start the remaining consumers.");
// Cache this exception for later use.
excReceived = e;
}
}
}
// Start all the asynchronous consumers.
Iterator asyncList = asyncConsumers.iterator();
while (asyncList.hasNext()) {
try {
((JmsMsgConsumerImpl) asyncList.next()).start();
} catch (JMSException e) {
// No FFDC code needed
// Cache the exception to be thrown back at the end of the method,
// but don't take any other action here. The exception will already
// have been logged in JmsMsgConsumerImpl.start.
if (excReceived == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "JMSException received at Session.start. Will continue trying to start the remaining asynch consumers.");
// Cache this exception for later use.
excReceived = e;
}
}
}
// Check whether an exception was thrown at any point during this method.
if (excReceived != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "An exception was received during Session.start. Propogate to Connection.");
throw excReceived;
}
// Flag that we have started everything.
setState(STARTED);
} // Release the lock
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "start");
} }
|
public class class_name {
void start() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "start");
synchronized (stateLock) {
// We will start each consumer inside its own catch block so that
// the failing of a single consumer does not adversely affect any
// other. The first exception that is received is stored in this
// variable and will be passed back up to the Connection when all
// the starts are complete.
JMSException excReceived = null;
// Start all the synchronous consumers
// Take a copy of the list of synchronous consumers. A sync block in
// createConsumer means that you cannot add anything to this list until
// session.start completes, however consumers can still be removed (as
// a result of the consumer.close operation), so by the time we get to
// calling start on the elements in this list, some of them may already
// be closed (pathalogical scenario). Calling start on a closed consumer
// has no effect, so this shouldn't cause a problem.
Object[] syncList = syncConsumers.toArray();
for (int i = 0; i < syncList.length; i++) {
try {
((JmsMsgConsumerImpl) syncList[i]).start(); // depends on control dependency: [try], data = [none]
} catch (JMSException e) {
// No FFDC code needed
// Cache the exception to be thrown back at the end of the method,
// but don't take any other action here. The exception will already
// have been logged in JmsMsgConsumerImpl.start.
if (excReceived == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "JMSException received at Session.start. Will continue trying to start the remaining consumers.");
// Cache this exception for later use.
excReceived = e; // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
// Start all the asynchronous consumers.
Iterator asyncList = asyncConsumers.iterator();
while (asyncList.hasNext()) {
try {
((JmsMsgConsumerImpl) asyncList.next()).start(); // depends on control dependency: [try], data = [none]
} catch (JMSException e) {
// No FFDC code needed
// Cache the exception to be thrown back at the end of the method,
// but don't take any other action here. The exception will already
// have been logged in JmsMsgConsumerImpl.start.
if (excReceived == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "JMSException received at Session.start. Will continue trying to start the remaining asynch consumers.");
// Cache this exception for later use.
excReceived = e; // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
// Check whether an exception was thrown at any point during this method.
if (excReceived != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "An exception was received during Session.start. Propogate to Connection.");
throw excReceived;
}
// Flag that we have started everything.
setState(STARTED);
} // Release the lock
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "start");
} }
|
public class class_name {
public static String relativePathFromResourceId(String id) {
if (id == null) {
return null;
}
String[] paths = id.split("/providers/" + resourceProviderFromResourceId(id) + "/", 2);
if (paths.length == 1) {
return "";
} else {
return paths[1];
}
} }
|
public class class_name {
public static String relativePathFromResourceId(String id) {
if (id == null) {
return null; // depends on control dependency: [if], data = [none]
}
String[] paths = id.split("/providers/" + resourceProviderFromResourceId(id) + "/", 2);
if (paths.length == 1) {
return ""; // depends on control dependency: [if], data = [none]
} else {
return paths[1]; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String cutYear(String str) {
if (str.length() > 3) {
return str.substring(str.length() - 3, str.length());
} else {
return str;
}
} }
|
public class class_name {
private String cutYear(String str) {
if (str.length() > 3) {
return str.substring(str.length() - 3, str.length()); // depends on control dependency: [if], data = [(str.length()]
} else {
return str; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Metadata getMetadata( String path )
throws IOException, MetadataNotFoundException
{
boolean found = false;
Metadata result = new Metadata();
Set<String> pluginArtifactIds = new HashSet<String>();
Set<String> snapshotVersions = new HashSet<String>();
for ( int i = 0; i < stores.length; i++ )
{
try
{
Metadata partial = stores[i].getMetadata( path );
if ( StringUtils.isEmpty( result.getArtifactId() ) && !StringUtils.isEmpty( partial.getArtifactId() ) )
{
result.setArtifactId( partial.getArtifactId() );
found = true;
}
if ( StringUtils.isEmpty( result.getGroupId() ) && !StringUtils.isEmpty( partial.getGroupId() ) )
{
result.setGroupId( partial.getGroupId() );
found = true;
}
if ( StringUtils.isEmpty( result.getVersion() ) && !StringUtils.isEmpty( partial.getVersion() ) )
{
result.setVersion( partial.getVersion() );
found = true;
}
if ( partial.getPlugins() != null && !partial.getPlugins().isEmpty() )
{
for ( Plugin plugin : partial.getPlugins() )
{
if ( !pluginArtifactIds.contains( plugin.getArtifactId() ) )
{
result.addPlugin( plugin );
pluginArtifactIds.add( plugin.getArtifactId() );
}
}
found = true;
}
if ( partial.getVersioning() != null )
{
Versioning rVers = result.getVersioning();
if ( rVers == null )
{
rVers = new Versioning();
}
Versioning pVers = partial.getVersioning();
String rLU = found ? rVers.getLastUpdated() : null;
String pLU = pVers.getLastUpdated();
if ( pLU != null && ( rLU == null || rLU.compareTo( pLU ) < 0 ) )
{
// partial is newer or only
if ( !StringUtils.isEmpty( pVers.getLatest() ) )
{
rVers.setLatest( pVers.getLatest() );
}
if ( !StringUtils.isEmpty( pVers.getRelease() ) )
{
rVers.setLatest( pVers.getRelease() );
}
rVers.setLastUpdated( pVers.getLastUpdated() );
}
for ( String version : pVers.getVersions() )
{
if ( !rVers.getVersions().contains( version ) )
{
rVers.addVersion( version );
}
}
if ( pVers.getSnapshot() != null )
{
if ( rVers.getSnapshot() == null
|| pVers.getSnapshot().getBuildNumber() > rVers.getSnapshot().getBuildNumber() )
{
Snapshot snapshot = new Snapshot();
snapshot.setBuildNumber( pVers.getSnapshot().getBuildNumber() );
snapshot.setTimestamp( pVers.getSnapshot().getTimestamp() );
rVers.setSnapshot( snapshot );
}
}
try
{
if ( pVers.getSnapshotVersions() != null && !pVers.getSnapshotVersions().isEmpty() )
{
for ( SnapshotVersion snapshotVersion : pVers.getSnapshotVersions() )
{
String key = snapshotVersion.getVersion() + "-" + snapshotVersion.getClassifier() + "."
+ snapshotVersion.getExtension();
if ( !snapshotVersions.contains( key ) )
{
rVers.addSnapshotVersion( snapshotVersion );
snapshotVersions.add( key );
}
}
}
}
catch ( NoSuchMethodError e )
{
// Maven 2
}
result.setVersioning( rVers );
found = true;
}
}
catch ( MetadataNotFoundException e )
{
// ignore
}
}
if ( !found )
{
throw new MetadataNotFoundException( path );
}
return result;
} }
|
public class class_name {
public Metadata getMetadata( String path )
throws IOException, MetadataNotFoundException
{
boolean found = false;
Metadata result = new Metadata();
Set<String> pluginArtifactIds = new HashSet<String>();
Set<String> snapshotVersions = new HashSet<String>();
for ( int i = 0; i < stores.length; i++ )
{
try
{
Metadata partial = stores[i].getMetadata( path );
if ( StringUtils.isEmpty( result.getArtifactId() ) && !StringUtils.isEmpty( partial.getArtifactId() ) )
{
result.setArtifactId( partial.getArtifactId() );
found = true;
}
if ( StringUtils.isEmpty( result.getGroupId() ) && !StringUtils.isEmpty( partial.getGroupId() ) )
{
result.setGroupId( partial.getGroupId() );
found = true;
}
if ( StringUtils.isEmpty( result.getVersion() ) && !StringUtils.isEmpty( partial.getVersion() ) )
{
result.setVersion( partial.getVersion() );
found = true;
}
if ( partial.getPlugins() != null && !partial.getPlugins().isEmpty() )
{
for ( Plugin plugin : partial.getPlugins() )
{
if ( !pluginArtifactIds.contains( plugin.getArtifactId() ) )
{
result.addPlugin( plugin ); // depends on control dependency: [if], data = [none]
pluginArtifactIds.add( plugin.getArtifactId() ); // depends on control dependency: [if], data = [none]
}
}
found = true;
}
if ( partial.getVersioning() != null )
{
Versioning rVers = result.getVersioning();
if ( rVers == null )
{
rVers = new Versioning();
}
Versioning pVers = partial.getVersioning();
String rLU = found ? rVers.getLastUpdated() : null;
String pLU = pVers.getLastUpdated();
if ( pLU != null && ( rLU == null || rLU.compareTo( pLU ) < 0 ) )
{
// partial is newer or only
if ( !StringUtils.isEmpty( pVers.getLatest() ) )
{
rVers.setLatest( pVers.getLatest() ); // depends on control dependency: [if], data = [none]
}
if ( !StringUtils.isEmpty( pVers.getRelease() ) )
{
rVers.setLatest( pVers.getRelease() ); // depends on control dependency: [if], data = [none]
}
rVers.setLastUpdated( pVers.getLastUpdated() );
}
for ( String version : pVers.getVersions() )
{
if ( !rVers.getVersions().contains( version ) )
{
rVers.addVersion( version );
}
}
if ( pVers.getSnapshot() != null )
{
if ( rVers.getSnapshot() == null
|| pVers.getSnapshot().getBuildNumber() > rVers.getSnapshot().getBuildNumber() )
{
Snapshot snapshot = new Snapshot();
snapshot.setBuildNumber( pVers.getSnapshot().getBuildNumber() );
snapshot.setTimestamp( pVers.getSnapshot().getTimestamp() );
rVers.setSnapshot( snapshot );
}
}
try
{
if ( pVers.getSnapshotVersions() != null && !pVers.getSnapshotVersions().isEmpty() )
{
for ( SnapshotVersion snapshotVersion : pVers.getSnapshotVersions() )
{
String key = snapshotVersion.getVersion() + "-" + snapshotVersion.getClassifier() + "."
+ snapshotVersion.getExtension();
if ( !snapshotVersions.contains( key ) )
{
rVers.addSnapshotVersion( snapshotVersion );
snapshotVersions.add( key );
}
}
}
}
catch ( NoSuchMethodError e )
{
// Maven 2
}
result.setVersioning( rVers );
found = true;
}
}
catch ( MetadataNotFoundException e )
{
// ignore
}
}
if ( !found )
{
throw new MetadataNotFoundException( path );
}
return result;
} }
|
public class class_name {
public static InternalListenerMetadata introspect(Class<?> listenerClass) {
InternalListenerMetadata cachedMetadata = cache.get(listenerClass);
if (cachedMetadata != null) {
return cachedMetadata;
}
synchronized (listenerClass) {
cachedMetadata = cache.get(listenerClass);
if (cachedMetadata != null) {
return cachedMetadata;
}
InternalListenerIntrospector introspector = new InternalListenerIntrospector(listenerClass);
introspector.introspect();
cache.put(listenerClass, introspector.metadata);
return introspector.metadata;
}
} }
|
public class class_name {
public static InternalListenerMetadata introspect(Class<?> listenerClass) {
InternalListenerMetadata cachedMetadata = cache.get(listenerClass);
if (cachedMetadata != null) {
return cachedMetadata; // depends on control dependency: [if], data = [none]
}
synchronized (listenerClass) {
cachedMetadata = cache.get(listenerClass);
if (cachedMetadata != null) {
return cachedMetadata; // depends on control dependency: [if], data = [none]
}
InternalListenerIntrospector introspector = new InternalListenerIntrospector(listenerClass);
introspector.introspect();
cache.put(listenerClass, introspector.metadata);
return introspector.metadata;
}
} }
|
public class class_name {
public double getRMSRigidity(){
rigidity = new double[this.getVariables().length];
for (int i = 0; i < this.getVariables().length; i++) {
if ( ((TimePoint)this.getVariables()[i]).isUsed() ) {
rigidity[i] = (
((double)1 /
((double)(1 + ((TimePoint)this.getVariables()[i]).getUpperBound() - ((TimePoint)this.getVariables()[i]).getLowerBound()))
));
//System.out.println(i + " " + j + " -> " + distance[this.getVariables()[i].getID()][this.getVariables()[j].getID()]);
//System.out.println(i + " " + j + " -> " + rigidity[i][j]);
}
}
double sigma = 0;
for (int i = 0; i < this.getVariables().length; i++) {
if ( ((TimePoint)this.getVariables()[i]).isUsed() ) {
sigma += Math.pow(rigidity[i], 2.0);
}
}
return Math.sqrt(((double)sigma) * ((double)2/(this.getVariables().length * (this.getVariables().length + 1))));
} }
|
public class class_name {
public double getRMSRigidity(){
rigidity = new double[this.getVariables().length];
for (int i = 0; i < this.getVariables().length; i++) {
if ( ((TimePoint)this.getVariables()[i]).isUsed() ) {
rigidity[i] = (
((double)1 /
((double)(1 + ((TimePoint)this.getVariables()[i]).getUpperBound() - ((TimePoint)this.getVariables()[i]).getLowerBound()))
));
// depends on control dependency: [if], data = [none]
//System.out.println(i + " " + j + " -> " + distance[this.getVariables()[i].getID()][this.getVariables()[j].getID()]);
//System.out.println(i + " " + j + " -> " + rigidity[i][j]);
}
}
double sigma = 0;
for (int i = 0; i < this.getVariables().length; i++) {
if ( ((TimePoint)this.getVariables()[i]).isUsed() ) {
sigma += Math.pow(rigidity[i], 2.0);
// depends on control dependency: [if], data = [none]
}
}
return Math.sqrt(((double)sigma) * ((double)2/(this.getVariables().length * (this.getVariables().length + 1))));
} }
|
public class class_name {
private LVal parseAccessLVal(int start, EnclosingScope scope) {
LVal lhs = parseLValTerm(start, scope);
Token token;
while ((token = tryAndMatchOnLine(LeftSquare)) != null
|| (token = tryAndMatch(true, Dot, MinusGreater)) != null) {
switch (token.kind) {
case LeftSquare:
// NOTE: expression is terminated by ']'
Expr rhs = parseAdditiveExpression(scope, true);
match(RightSquare);
lhs = new Expr.ArrayAccess(Type.Void, lhs, rhs);
break;
case MinusGreater:
lhs = new Expr.Dereference(Type.Void, lhs);
// Fall Through
case Dot:
Identifier name = parseIdentifier();
lhs = new Expr.RecordAccess(Type.Void, lhs, name);
break;
}
lhs = annotateSourceLocation(lhs,start);
}
return lhs;
} }
|
public class class_name {
private LVal parseAccessLVal(int start, EnclosingScope scope) {
LVal lhs = parseLValTerm(start, scope);
Token token;
while ((token = tryAndMatchOnLine(LeftSquare)) != null
|| (token = tryAndMatch(true, Dot, MinusGreater)) != null) {
switch (token.kind) {
case LeftSquare:
// NOTE: expression is terminated by ']'
Expr rhs = parseAdditiveExpression(scope, true);
match(RightSquare);
lhs = new Expr.ArrayAccess(Type.Void, lhs, rhs);
break;
case MinusGreater:
lhs = new Expr.Dereference(Type.Void, lhs);
// Fall Through
case Dot:
Identifier name = parseIdentifier();
lhs = new Expr.RecordAccess(Type.Void, lhs, name);
break;
}
lhs = annotateSourceLocation(lhs,start); // depends on control dependency: [while], data = [none]
}
return lhs;
} }
|
public class class_name {
@Override
public void executeEventCallback(Runnable callback) {
if (!nodeEngine.isRunning()) {
return;
}
try {
eventExecutor.execute(callback);
} catch (RejectedExecutionException e) {
rejectedCount.inc();
if (eventExecutor.isLive()) {
logFailure("EventQueue overloaded! Failed to execute event callback: %s", callback);
}
}
} }
|
public class class_name {
@Override
public void executeEventCallback(Runnable callback) {
if (!nodeEngine.isRunning()) {
return; // depends on control dependency: [if], data = [none]
}
try {
eventExecutor.execute(callback); // depends on control dependency: [try], data = [none]
} catch (RejectedExecutionException e) {
rejectedCount.inc();
if (eventExecutor.isLive()) {
logFailure("EventQueue overloaded! Failed to execute event callback: %s", callback); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public PermissionsBuilder setDenied(PermissionType... types) {
for (PermissionType type : types) {
setState(type, PermissionState.DENIED);
}
return this;
} }
|
public class class_name {
public PermissionsBuilder setDenied(PermissionType... types) {
for (PermissionType type : types) {
setState(type, PermissionState.DENIED); // depends on control dependency: [for], data = [type]
}
return this;
} }
|
public class class_name {
public void setDBModified(int mode) {
String value = MODIFIED_NO;
if (mode == FILES_MODIFIED) {
value = MODIFIED_YES;
} else if (mode == FILES_NEW) {
value = MODIFIED_NEW;
}
setProperty(db_modified, value);
save();
} }
|
public class class_name {
public void setDBModified(int mode) {
String value = MODIFIED_NO;
if (mode == FILES_MODIFIED) {
value = MODIFIED_YES; // depends on control dependency: [if], data = [none]
} else if (mode == FILES_NEW) {
value = MODIFIED_NEW; // depends on control dependency: [if], data = [none]
}
setProperty(db_modified, value);
save();
} }
|
public class class_name {
static int main2(PrintWriter out, PrintWriter err, List<String> args) {
try {
final Launcher launcher = new Launcher(args, out);
final Quidem quidem;
try {
quidem = launcher.parse();
} catch (ParseException e) {
return e.code;
}
quidem.execute();
return 0;
} catch (Throwable e) {
out.flush();
e.printStackTrace(err);
return 2;
} finally {
out.flush();
err.flush();
}
} }
|
public class class_name {
static int main2(PrintWriter out, PrintWriter err, List<String> args) {
try {
final Launcher launcher = new Launcher(args, out);
final Quidem quidem;
try {
quidem = launcher.parse(); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
return e.code;
} // depends on control dependency: [catch], data = [none]
quidem.execute(); // depends on control dependency: [try], data = [none]
return 0; // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
out.flush();
e.printStackTrace(err);
return 2;
} finally { // depends on control dependency: [catch], data = [none]
out.flush();
err.flush();
}
} }
|
public class class_name {
public Observable<ServiceResponse<Page<JobStepInner>>> listByVersionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) {
return listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion)
.concatMap(new Func1<ServiceResponse<Page<JobStepInner>>, Observable<ServiceResponse<Page<JobStepInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobStepInner>>> call(ServiceResponse<Page<JobStepInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByVersionNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<JobStepInner>>> listByVersionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) {
return listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion)
.concatMap(new Func1<ServiceResponse<Page<JobStepInner>>, Observable<ServiceResponse<Page<JobStepInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobStepInner>>> call(ServiceResponse<Page<JobStepInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listByVersionNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsUpdateHeaders>> updateWithServiceResponseAsync(String resourceGroupName, String jobName, StreamingJobInner streamingJob, String ifMatch) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (jobName == null) {
throw new IllegalArgumentException("Parameter jobName is required and cannot be null.");
}
if (streamingJob == null) {
throw new IllegalArgumentException("Parameter streamingJob is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(streamingJob);
return service.update(this.client.subscriptionId(), resourceGroupName, jobName, streamingJob, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsUpdateHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsUpdateHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsUpdateHeaders> clientResponse = updateDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsUpdateHeaders>> updateWithServiceResponseAsync(String resourceGroupName, String jobName, StreamingJobInner streamingJob, String ifMatch) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (jobName == null) {
throw new IllegalArgumentException("Parameter jobName is required and cannot be null.");
}
if (streamingJob == null) {
throw new IllegalArgumentException("Parameter streamingJob is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(streamingJob);
return service.update(this.client.subscriptionId(), resourceGroupName, jobName, streamingJob, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsUpdateHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsUpdateHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsUpdateHeaders> clientResponse = updateDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
@Override
public void setProperty(String paramString, Object paramObject)
{
checkClosed();
if (getProperties() == null)
{
this.properties = new HashMap<String, Object>();
}
this.properties.put(paramString, paramObject);
getPersistenceDelegator().populateClientProperties(this.properties);
} }
|
public class class_name {
@Override
public void setProperty(String paramString, Object paramObject)
{
checkClosed();
if (getProperties() == null)
{
this.properties = new HashMap<String, Object>();
// depends on control dependency: [if], data = [none]
}
this.properties.put(paramString, paramObject);
getPersistenceDelegator().populateClientProperties(this.properties);
} }
|
public class class_name {
private List<DocumentEntry> getDocumentEntriesFromPropertiesStream(final DocumentEntry de)
throws IOException {
final List<DocumentEntry> result = new ArrayList<>();
DocumentInputStream dstream = null;
try {
dstream = new DocumentInputStream(de);
final int headerLength = 4;
final int flagsLength = 4;
byte[] bytes = new byte[headerLength];
while (dstream.read(bytes) == headerLength) {
final StringBuilder header = new StringBuilder();
for (int i = bytes.length - 1; i >= 0; i--) {
header.append(bytesToHex(new byte[] { bytes[i] }));
}
//header ready for use
final String type = header.substring(4);
final String clazz = header.substring(0, 4);
int typeNumber = -1;
try {
typeNumber = Integer.parseInt(type, 16);
} catch (final NumberFormatException e) {
LOGGER.error("Unexpected type: {}", type, e);
}
if (!clazz.equals("0000")) { // what is this?
//reading and ignoring flags
bytes = new byte[flagsLength];
//noinspection ResultOfMethodCallIgnored
dstream.read(bytes);
//System.out.println("flags: " + bytesToHex(bytes));
// reading data
if (typeNumber == 0x48 //CLSID
|| typeNumber == 0x1e //STRING
|| typeNumber == 0x1f //UNICODE STRING
|| typeNumber == 0xd //OBJECT
|| typeNumber == 0x102) { //BINARY
//found datatype with variable length, thus the value is stored in a separate string
//no data available inside the properties stream
//reading and ignoring size
bytes = null;
//noinspection ResultOfMethodCallIgnored
dstream.read(new byte[4]);
} else if (typeNumber == 0x3 //INT
|| typeNumber == 0x4 //FLOAT
|| typeNumber == 0xa //ERROR
|| typeNumber == 0xb //BOOLEAN
|| typeNumber == 0x2) { //SHORT
// 4 bytes
bytes = new byte[4];
//noinspection ResultOfMethodCallIgnored
dstream.read(bytes);
//noinspection ResultOfMethodCallIgnored
dstream.read(bytes); //read and ignore padding
} else if (typeNumber == 0x5 //DOUBLE
|| typeNumber == 0x7 //APPTIME
|| typeNumber == 0x6 //CURRENCY
|| typeNumber == 0x14 //INT8BYTE
|| typeNumber == 0x40) { //SYSTIME
// 8 bytes
bytes = new byte[8];
//noinspection ResultOfMethodCallIgnored
dstream.read(bytes);
}
//stream ready for use
if (bytes != null) {
//creating new document entry for later processing of all document entries
final POIFSFileSystem poifs = new POIFSFileSystem();
result.add(poifs.createDocument(new ByteArrayInputStream(bytes), "__substg1.0_" + header));
}
}
//start over with new byte[] for next header
bytes = new byte[headerLength];
}
return result;
} finally {
if (dstream != null) {
dstream.close();
}
}
} }
|
public class class_name {
private List<DocumentEntry> getDocumentEntriesFromPropertiesStream(final DocumentEntry de)
throws IOException {
final List<DocumentEntry> result = new ArrayList<>();
DocumentInputStream dstream = null;
try {
dstream = new DocumentInputStream(de);
final int headerLength = 4;
final int flagsLength = 4;
byte[] bytes = new byte[headerLength];
while (dstream.read(bytes) == headerLength) {
final StringBuilder header = new StringBuilder();
for (int i = bytes.length - 1; i >= 0; i--) {
header.append(bytesToHex(new byte[] { bytes[i] })); // depends on control dependency: [for], data = [i]
}
//header ready for use
final String type = header.substring(4);
final String clazz = header.substring(0, 4);
int typeNumber = -1;
try {
typeNumber = Integer.parseInt(type, 16); // depends on control dependency: [try], data = [none]
} catch (final NumberFormatException e) {
LOGGER.error("Unexpected type: {}", type, e);
} // depends on control dependency: [catch], data = [none]
if (!clazz.equals("0000")) { // what is this?
//reading and ignoring flags
bytes = new byte[flagsLength]; // depends on control dependency: [if], data = [none]
//noinspection ResultOfMethodCallIgnored
dstream.read(bytes); // depends on control dependency: [if], data = [none]
//System.out.println("flags: " + bytesToHex(bytes));
// reading data
if (typeNumber == 0x48 //CLSID
|| typeNumber == 0x1e //STRING
|| typeNumber == 0x1f //UNICODE STRING
|| typeNumber == 0xd //OBJECT
|| typeNumber == 0x102) { //BINARY
//found datatype with variable length, thus the value is stored in a separate string
//no data available inside the properties stream
//reading and ignoring size
bytes = null; // depends on control dependency: [if], data = [none]
//noinspection ResultOfMethodCallIgnored
dstream.read(new byte[4]); // depends on control dependency: [if], data = [none]
} else if (typeNumber == 0x3 //INT
|| typeNumber == 0x4 //FLOAT
|| typeNumber == 0xa //ERROR
|| typeNumber == 0xb //BOOLEAN
|| typeNumber == 0x2) { //SHORT
// 4 bytes
bytes = new byte[4]; // depends on control dependency: [if], data = [none]
//noinspection ResultOfMethodCallIgnored
dstream.read(bytes); // depends on control dependency: [if], data = [none]
//noinspection ResultOfMethodCallIgnored
dstream.read(bytes); //read and ignore padding // depends on control dependency: [if], data = [none]
} else if (typeNumber == 0x5 //DOUBLE
|| typeNumber == 0x7 //APPTIME
|| typeNumber == 0x6 //CURRENCY
|| typeNumber == 0x14 //INT8BYTE
|| typeNumber == 0x40) { //SYSTIME
// 8 bytes
bytes = new byte[8]; // depends on control dependency: [if], data = [none]
//noinspection ResultOfMethodCallIgnored
dstream.read(bytes); // depends on control dependency: [if], data = [none]
}
//stream ready for use
if (bytes != null) {
//creating new document entry for later processing of all document entries
final POIFSFileSystem poifs = new POIFSFileSystem();
result.add(poifs.createDocument(new ByteArrayInputStream(bytes), "__substg1.0_" + header)); // depends on control dependency: [if], data = [(bytes]
}
}
//start over with new byte[] for next header
bytes = new byte[headerLength]; // depends on control dependency: [while], data = [none]
}
return result;
} finally {
if (dstream != null) {
dstream.close(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected void mvnSetVersions(final String version) throws MojoFailureException, CommandLineException {
getLog().info("Updating version(s) to '" + version + "'.");
String newVersion = "-DnewVersion=" + version;
String g = "";
String a = "";
if (versionsForceUpdate) {
g = "-DgroupId=";
a = "-DartifactId=";
}
if (tychoBuild) {
String prop = "";
if (StringUtils.isNotBlank(versionProperty)) {
prop = "-Dproperties=" + versionProperty;
getLog().info("Updating property '" + versionProperty + "' to '" + version + "'.");
}
executeMvnCommand(TYCHO_VERSIONS_PLUGIN_SET_GOAL, prop, newVersion, "-Dtycho.mode=maven");
} else {
if (!skipUpdateVersion) {
executeMvnCommand(VERSIONS_MAVEN_PLUGIN_SET_GOAL, g, a, newVersion, "-DgenerateBackupPoms=false");
}
if (StringUtils.isNotBlank(versionProperty)) {
getLog().info("Updating property '" + versionProperty + "' to '" + version + "'.");
executeMvnCommand(VERSIONS_MAVEN_PLUGIN_SET_PROPERTY_GOAL, newVersion, "-Dproperty=" + versionProperty,
"-DgenerateBackupPoms=false");
}
}
} }
|
public class class_name {
protected void mvnSetVersions(final String version) throws MojoFailureException, CommandLineException {
getLog().info("Updating version(s) to '" + version + "'.");
String newVersion = "-DnewVersion=" + version;
String g = "";
String a = "";
if (versionsForceUpdate) {
g = "-DgroupId=";
a = "-DartifactId=";
}
if (tychoBuild) {
String prop = "";
if (StringUtils.isNotBlank(versionProperty)) {
prop = "-Dproperties=" + versionProperty; // depends on control dependency: [if], data = [none]
getLog().info("Updating property '" + versionProperty + "' to '" + version + "'."); // depends on control dependency: [if], data = [none]
}
executeMvnCommand(TYCHO_VERSIONS_PLUGIN_SET_GOAL, prop, newVersion, "-Dtycho.mode=maven");
} else {
if (!skipUpdateVersion) {
executeMvnCommand(VERSIONS_MAVEN_PLUGIN_SET_GOAL, g, a, newVersion, "-DgenerateBackupPoms=false"); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(versionProperty)) {
getLog().info("Updating property '" + versionProperty + "' to '" + version + "'."); // depends on control dependency: [if], data = [none]
executeMvnCommand(VERSIONS_MAVEN_PLUGIN_SET_PROPERTY_GOAL, newVersion, "-Dproperty=" + versionProperty,
"-DgenerateBackupPoms=false"); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void setAppTitle(String title) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(title)) {
if (m_titleLabel != null) {
m_titleLabel.removeFromParent();
m_titleLabel = null;
}
} else {
if (m_titleLabel == null) {
m_titleLabel = new Label();
m_titleLabel.setStyleName(I_CmsLayoutBundle.INSTANCE.toolbarCss().title());
m_buttonPanelLeft.insert(m_titleLabel, 0);
}
m_titleLabel.setText(title);
}
} }
|
public class class_name {
public void setAppTitle(String title) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(title)) {
if (m_titleLabel != null) {
m_titleLabel.removeFromParent(); // depends on control dependency: [if], data = [none]
m_titleLabel = null; // depends on control dependency: [if], data = [none]
}
} else {
if (m_titleLabel == null) {
m_titleLabel = new Label(); // depends on control dependency: [if], data = [none]
m_titleLabel.setStyleName(I_CmsLayoutBundle.INSTANCE.toolbarCss().title()); // depends on control dependency: [if], data = [none]
m_buttonPanelLeft.insert(m_titleLabel, 0); // depends on control dependency: [if], data = [(m_titleLabel]
}
m_titleLabel.setText(title); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void service(RequestWeb request)
{
try {
if (! request.method().equals("OPTIONS")) {
request.ok();
return;
}
if (_crossOrigin.allowCredentials())
request.header(ALLOW_CREDENTIALS, "true");
//allow-origin
String[] origin = _crossOrigin.value();
if (origin.length == 0)
origin = _crossOrigin.allowOrigin();
if (origin.length > 0)
request.header(ALLOW_ORIGIN, join(origin));
//allow methods
HttpMethod[] methods = _crossOrigin.allowMethods();
if (methods.length > 0) {
request.header(ALLOW_METHODS, join(methods));
}
else if (_httpMethod != null) {
request.header(ALLOW_METHODS, _httpMethod.toString());
}
//allow headers
String[] allowHeaders = _crossOrigin.allowHeaders();
if (allowHeaders.length > 0)
request.header(ALLOW_HEADERS, join(allowHeaders));
//expose headers
String[] exposeHeaders = _crossOrigin.exposeHeaders();
if (exposeHeaders.length > 0)
request.header(EXPOSE_HEADERS, join(exposeHeaders));
//max age
request.header(MAX_AGE, Long.toString(_crossOrigin.maxAge()));
request.ok();
request.halt();
} catch (Exception e) {
log.log(Level.WARNING, e.toString(), e);
}
} }
|
public class class_name {
@Override
public void service(RequestWeb request)
{
try {
if (! request.method().equals("OPTIONS")) {
request.ok(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (_crossOrigin.allowCredentials())
request.header(ALLOW_CREDENTIALS, "true");
//allow-origin
String[] origin = _crossOrigin.value();
if (origin.length == 0)
origin = _crossOrigin.allowOrigin();
if (origin.length > 0)
request.header(ALLOW_ORIGIN, join(origin));
//allow methods
HttpMethod[] methods = _crossOrigin.allowMethods();
if (methods.length > 0) {
request.header(ALLOW_METHODS, join(methods)); // depends on control dependency: [if], data = [none]
}
else if (_httpMethod != null) {
request.header(ALLOW_METHODS, _httpMethod.toString()); // depends on control dependency: [if], data = [none]
}
//allow headers
String[] allowHeaders = _crossOrigin.allowHeaders();
if (allowHeaders.length > 0)
request.header(ALLOW_HEADERS, join(allowHeaders));
//expose headers
String[] exposeHeaders = _crossOrigin.exposeHeaders();
if (exposeHeaders.length > 0)
request.header(EXPOSE_HEADERS, join(exposeHeaders));
//max age
request.header(MAX_AGE, Long.toString(_crossOrigin.maxAge())); // depends on control dependency: [try], data = [none]
request.ok(); // depends on control dependency: [try], data = [none]
request.halt(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.log(Level.WARNING, e.toString(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static int getFilterType(RenderingHints pHints) {
if (pHints == null) {
return FILTER_UNDEFINED;
}
if (pHints.containsKey(KEY_RESAMPLE_INTERPOLATION)) {
Object value = pHints.get(KEY_RESAMPLE_INTERPOLATION);
// NOTE: Workaround for a bug in RenderingHints constructor (Bug id# 5084832)
if (!KEY_RESAMPLE_INTERPOLATION.isCompatibleValue(value)) {
throw new IllegalArgumentException(value + " incompatible with key " + KEY_RESAMPLE_INTERPOLATION);
}
return value != null ? ((Value) value).getFilterType() : FILTER_UNDEFINED;
}
else if (RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.equals(pHints.get(RenderingHints.KEY_INTERPOLATION))
|| (!pHints.containsKey(RenderingHints.KEY_INTERPOLATION)
&& (RenderingHints.VALUE_RENDER_SPEED.equals(pHints.get(RenderingHints.KEY_RENDERING))
|| RenderingHints.VALUE_COLOR_RENDER_SPEED.equals(pHints.get(RenderingHints.KEY_COLOR_RENDERING))))) {
// Nearest neighbour, or prioritize speed
return FILTER_POINT;
}
else if (RenderingHints.VALUE_INTERPOLATION_BILINEAR.equals(pHints.get(RenderingHints.KEY_INTERPOLATION))) {
// Triangle equals bi-linear interpolation
return FILTER_TRIANGLE;
}
else if (RenderingHints.VALUE_INTERPOLATION_BICUBIC.equals(pHints.get(RenderingHints.KEY_INTERPOLATION))) {
return FILTER_QUADRATIC;// No idea if this is correct..?
}
else if (RenderingHints.VALUE_RENDER_QUALITY.equals(pHints.get(RenderingHints.KEY_RENDERING))
|| RenderingHints.VALUE_COLOR_RENDER_QUALITY.equals(pHints.get(RenderingHints.KEY_COLOR_RENDERING))) {
// Prioritize quality
return FILTER_MITCHELL;
}
// NOTE: Other hints are ignored
return FILTER_UNDEFINED;
} }
|
public class class_name {
private static int getFilterType(RenderingHints pHints) {
if (pHints == null) {
return FILTER_UNDEFINED;
// depends on control dependency: [if], data = [none]
}
if (pHints.containsKey(KEY_RESAMPLE_INTERPOLATION)) {
Object value = pHints.get(KEY_RESAMPLE_INTERPOLATION);
// NOTE: Workaround for a bug in RenderingHints constructor (Bug id# 5084832)
if (!KEY_RESAMPLE_INTERPOLATION.isCompatibleValue(value)) {
throw new IllegalArgumentException(value + " incompatible with key " + KEY_RESAMPLE_INTERPOLATION);
}
return value != null ? ((Value) value).getFilterType() : FILTER_UNDEFINED;
// depends on control dependency: [if], data = [none]
}
else if (RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.equals(pHints.get(RenderingHints.KEY_INTERPOLATION))
|| (!pHints.containsKey(RenderingHints.KEY_INTERPOLATION)
&& (RenderingHints.VALUE_RENDER_SPEED.equals(pHints.get(RenderingHints.KEY_RENDERING))
|| RenderingHints.VALUE_COLOR_RENDER_SPEED.equals(pHints.get(RenderingHints.KEY_COLOR_RENDERING))))) {
// Nearest neighbour, or prioritize speed
return FILTER_POINT;
// depends on control dependency: [if], data = [none]
}
else if (RenderingHints.VALUE_INTERPOLATION_BILINEAR.equals(pHints.get(RenderingHints.KEY_INTERPOLATION))) {
// Triangle equals bi-linear interpolation
return FILTER_TRIANGLE;
// depends on control dependency: [if], data = [none]
}
else if (RenderingHints.VALUE_INTERPOLATION_BICUBIC.equals(pHints.get(RenderingHints.KEY_INTERPOLATION))) {
return FILTER_QUADRATIC;// No idea if this is correct..?
// depends on control dependency: [if], data = [none]
}
else if (RenderingHints.VALUE_RENDER_QUALITY.equals(pHints.get(RenderingHints.KEY_RENDERING))
|| RenderingHints.VALUE_COLOR_RENDER_QUALITY.equals(pHints.get(RenderingHints.KEY_COLOR_RENDERING))) {
// Prioritize quality
return FILTER_MITCHELL;
// depends on control dependency: [if], data = [none]
}
// NOTE: Other hints are ignored
return FILTER_UNDEFINED;
} }
|
public class class_name {
public static void processPath(File path, FileFilter filter, FileProcessor processor) {
if (path.isDirectory()) {
// if path is a directory, look into it
File[] directoryListing = path.listFiles(filter);
if (directoryListing == null) {
throw new IllegalArgumentException("Directory access problem for: " + path);
}
for (File file : directoryListing) {
processPath(file, filter, processor);
}
} else {
// it's already passed the filter or was uniquely specified
// if (filter.accept(path))
processor.processFile(path);
}
} }
|
public class class_name {
public static void processPath(File path, FileFilter filter, FileProcessor processor) {
if (path.isDirectory()) {
// if path is a directory, look into it
File[] directoryListing = path.listFiles(filter);
if (directoryListing == null) {
throw new IllegalArgumentException("Directory access problem for: " + path);
}
for (File file : directoryListing) {
processPath(file, filter, processor);
// depends on control dependency: [for], data = [file]
}
} else {
// it's already passed the filter or was uniquely specified
// if (filter.accept(path))
processor.processFile(path);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public CoverageDataPngImage drawTile(short[][] pixelValues) {
int tileWidth = pixelValues[0].length;
int tileHeight = pixelValues.length;
CoverageDataPngImage image = createImage(tileWidth, tileHeight);
PngWriter writer = image.getWriter();
for (int y = 0; y < tileHeight; y++) {
ImageLineInt row = new ImageLineInt(writer.imgInfo, new int[tileWidth]);
int[] rowLine = row.getScanline();
for (int x = 0; x < tileWidth; x++) {
short pixelValue = pixelValues[y][x];
setPixelValue(rowLine, x, pixelValue);
}
writer.writeRow(row);
}
writer.end();
image.flushStream();
return image;
} }
|
public class class_name {
public CoverageDataPngImage drawTile(short[][] pixelValues) {
int tileWidth = pixelValues[0].length;
int tileHeight = pixelValues.length;
CoverageDataPngImage image = createImage(tileWidth, tileHeight);
PngWriter writer = image.getWriter();
for (int y = 0; y < tileHeight; y++) {
ImageLineInt row = new ImageLineInt(writer.imgInfo, new int[tileWidth]);
int[] rowLine = row.getScanline();
for (int x = 0; x < tileWidth; x++) {
short pixelValue = pixelValues[y][x];
setPixelValue(rowLine, x, pixelValue); // depends on control dependency: [for], data = [x]
}
writer.writeRow(row); // depends on control dependency: [for], data = [none]
}
writer.end();
image.flushStream();
return image;
} }
|
public class class_name {
public static <T, U> Collector<T, ?, Seq<T>> maxAllBy(Function<? super T, ? extends U> function, Comparator<? super U> comparator) {
class Accumulator {
List<T> t = new ArrayList<>();
U u;
void set(T t, U u) {
this.t.clear();
this.t.add(t);
this.u = u;
}
}
return Collector.of(
() -> new Accumulator(),
(a, t) -> {
U u = function.apply(t);
if (a.u == null) {
a.set(t, u);
}
else {
int compare = comparator.compare(a.u, u);
if (compare < 0)
a.set(t, u);
else if (compare == 0)
a.t.add(t);
}
},
(a1, a2) -> {
if (a1.u == null)
return a2;
if (a2.u == null)
return a1;
int compare = comparator.compare(a1.u, a2.u);
if (compare < 0)
return a1;
else if (compare > 0)
return a2;
a1.t.addAll(a2.t);
return a1;
},
a -> Seq.seq(a.t)
);
} }
|
public class class_name {
public static <T, U> Collector<T, ?, Seq<T>> maxAllBy(Function<? super T, ? extends U> function, Comparator<? super U> comparator) {
class Accumulator {
List<T> t = new ArrayList<>();
U u;
void set(T t, U u) {
this.t.clear();
this.t.add(t);
this.u = u;
}
}
return Collector.of(
() -> new Accumulator(),
(a, t) -> {
U u = function.apply(t);
if (a.u == null) {
a.set(t, u); // depends on control dependency: [if], data = [none]
}
else {
int compare = comparator.compare(a.u, u);
if (compare < 0)
a.set(t, u);
else if (compare == 0)
a.t.add(t);
}
},
(a1, a2) -> {
if (a1.u == null)
return a2;
if (a2.u == null)
return a1;
int compare = comparator.compare(a1.u, a2.u);
if (compare < 0)
return a1;
else if (compare > 0)
return a2;
a1.t.addAll(a2.t);
return a1;
},
a -> Seq.seq(a.t)
);
} }
|
public class class_name {
public boolean containsValue(String group, String value) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.containsValue(value);
}
} finally {
readLock.unlock();
}
return false;
} }
|
public class class_name {
public boolean containsValue(String group, String value) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.containsValue(value);
// depends on control dependency: [if], data = [none]
}
} finally {
readLock.unlock();
}
return false;
} }
|
public class class_name {
static char getChecksum(String text) {
int chk = 0;
for (int k = 0; k < text.length(); ++k) {
int idx = CHARS.indexOf(text.charAt(k));
if (idx < 0)
throw new IllegalArgumentException("The character '" + text.charAt(k) + "' is illegal in code 39.");
chk += idx;
}
return CHARS.charAt(chk % 43);
} }
|
public class class_name {
static char getChecksum(String text) {
int chk = 0;
for (int k = 0; k < text.length(); ++k) {
int idx = CHARS.indexOf(text.charAt(k));
if (idx < 0)
throw new IllegalArgumentException("The character '" + text.charAt(k) + "' is illegal in code 39.");
chk += idx; // depends on control dependency: [for], data = [none]
}
return CHARS.charAt(chk % 43);
} }
|
public class class_name {
public SIDestinationAddress getDestinationAddress()
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
{
SibTr.entry(CoreSPIBrowserSession.tc, "getDestinationAddress", this);
SibTr.exit(CoreSPIBrowserSession.tc, "getDestinationAddress", _destinationAddress);
}
return _destinationAddress;
} }
|
public class class_name {
public SIDestinationAddress getDestinationAddress()
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPIBrowserSession.tc.isEntryEnabled())
{
SibTr.entry(CoreSPIBrowserSession.tc, "getDestinationAddress", this); // depends on control dependency: [if], data = [none]
SibTr.exit(CoreSPIBrowserSession.tc, "getDestinationAddress", _destinationAddress); // depends on control dependency: [if], data = [none]
}
return _destinationAddress;
} }
|
public class class_name {
public void execute(Runnable command) {
if (command == null)
throw new NullPointerException();
/*
* Proceed in 3 steps:
*
* 1. If fewer than corePoolSize threads are running, try to
* start a new thread with the given command as its first
* task. The call to addWorker atomically checks runState and
* workerCount, and so prevents false alarms that would add
* threads when it shouldn't, by returning false.
*
* 2. If a task can be successfully queued, then we still need
* to double-check whether we should have added a thread
* (because existing ones died since last checking) or that
* the pool shut down since entry into this method. So we
* recheck state and if necessary roll back the enqueuing if
* stopped, or start a new thread if there are none.
*
* 3. If we cannot queue task, then we try to add a new
* thread. If it fails, we know we are shut down or saturated
* and so reject the task.
*/
int c = ctl.get();
if (workerCountOf(c) < corePoolSize) {
if (addWorker(command, true))
return;
c = ctl.get();
}
if (isRunning(c) && workQueue.offer(command)) {
int recheck = ctl.get();
if (! isRunning(recheck) && remove(command))
reject(command);
else if (workerCountOf(recheck) == 0)
addWorker(null, false);
}
else if (!addWorker(command, false))
reject(command);
} }
|
public class class_name {
public void execute(Runnable command) {
if (command == null)
throw new NullPointerException();
/*
* Proceed in 3 steps:
*
* 1. If fewer than corePoolSize threads are running, try to
* start a new thread with the given command as its first
* task. The call to addWorker atomically checks runState and
* workerCount, and so prevents false alarms that would add
* threads when it shouldn't, by returning false.
*
* 2. If a task can be successfully queued, then we still need
* to double-check whether we should have added a thread
* (because existing ones died since last checking) or that
* the pool shut down since entry into this method. So we
* recheck state and if necessary roll back the enqueuing if
* stopped, or start a new thread if there are none.
*
* 3. If we cannot queue task, then we try to add a new
* thread. If it fails, we know we are shut down or saturated
* and so reject the task.
*/
int c = ctl.get();
if (workerCountOf(c) < corePoolSize) {
if (addWorker(command, true))
return;
c = ctl.get(); // depends on control dependency: [if], data = [none]
}
if (isRunning(c) && workQueue.offer(command)) {
int recheck = ctl.get();
if (! isRunning(recheck) && remove(command))
reject(command);
else if (workerCountOf(recheck) == 0)
addWorker(null, false);
}
else if (!addWorker(command, false))
reject(command);
} }
|
public class class_name {
private static final boolean longMultisetsEqual(long[] firstDeps, long[] secondDeps) {
if (firstDeps.length != secondDeps.length) {
return false;
}
Arrays.sort(firstDeps);
Arrays.sort(secondDeps);
for (int i = 0; i < firstDeps.length; i++) {
if (firstDeps[i] != secondDeps[i]) {
return false;
}
}
return true;
} }
|
public class class_name {
private static final boolean longMultisetsEqual(long[] firstDeps, long[] secondDeps) {
if (firstDeps.length != secondDeps.length) {
return false; // depends on control dependency: [if], data = [none]
}
Arrays.sort(firstDeps);
Arrays.sort(secondDeps);
for (int i = 0; i < firstDeps.length; i++) {
if (firstDeps[i] != secondDeps[i]) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
private void captureEnvData(File dumpDir, File installDir) {
File versionsSource = new File(installDir, "lib/versions");
File fixesSource = new File(installDir, "lib/fixes");
String sharedConfigDir = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty("shared.config.dir");
}
});
File sharedConfigSource = sharedConfigDir != null ? new File(sharedConfigDir) : new File(installDir, "usr/shared/config");
File versionsTarget = new File(dumpDir, "service/versions");
File fixesTarget = new File(dumpDir, "service/fixes");
File sharedConfigTarget = new File(dumpDir, "usr/shared/config");
if (versionsTarget.mkdirs()) {
try {
FileUtils.copyDir(versionsSource, versionsTarget);
} catch (IOException e) {
Debug.printStackTrace(e);
}
}
if (fixesTarget.mkdirs()) {
try {
FileUtils.copyDir(fixesSource, fixesTarget);
} catch (IOException e) {
Debug.printStackTrace(e);
}
}
if (sharedConfigTarget.mkdirs()) {
try {
FileUtils.copyDir(sharedConfigSource, sharedConfigTarget);
} catch (IOException e) {
Debug.printStackTrace(e);
}
}
} }
|
public class class_name {
private void captureEnvData(File dumpDir, File installDir) {
File versionsSource = new File(installDir, "lib/versions");
File fixesSource = new File(installDir, "lib/fixes");
String sharedConfigDir = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty("shared.config.dir");
}
});
File sharedConfigSource = sharedConfigDir != null ? new File(sharedConfigDir) : new File(installDir, "usr/shared/config");
File versionsTarget = new File(dumpDir, "service/versions");
File fixesTarget = new File(dumpDir, "service/fixes");
File sharedConfigTarget = new File(dumpDir, "usr/shared/config");
if (versionsTarget.mkdirs()) {
try {
FileUtils.copyDir(versionsSource, versionsTarget); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
Debug.printStackTrace(e);
} // depends on control dependency: [catch], data = [none]
}
if (fixesTarget.mkdirs()) {
try {
FileUtils.copyDir(fixesSource, fixesTarget); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
Debug.printStackTrace(e);
} // depends on control dependency: [catch], data = [none]
}
if (sharedConfigTarget.mkdirs()) {
try {
FileUtils.copyDir(sharedConfigSource, sharedConfigTarget); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
Debug.printStackTrace(e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
protected int grabFlowControlBytes(int toSend) {
synchronized (flowControlLock) {
if (toSend == 0) {
return 0;
}
int newWindowSize = this.getChannel().getInitialSendWindowSize();
int settingsDelta = newWindowSize - this.initialWindowSize;
//first adjust for any settings frame updates
this.initialWindowSize = newWindowSize;
this.flowControlWindow += settingsDelta;
int min = Math.min(toSend, this.flowControlWindow);
int actualBytes = this.getChannel().grabFlowControlBytes(min);
this.flowControlWindow -= actualBytes;
return actualBytes;
}
} }
|
public class class_name {
protected int grabFlowControlBytes(int toSend) {
synchronized (flowControlLock) {
if (toSend == 0) {
return 0; // depends on control dependency: [if], data = [none]
}
int newWindowSize = this.getChannel().getInitialSendWindowSize();
int settingsDelta = newWindowSize - this.initialWindowSize;
//first adjust for any settings frame updates
this.initialWindowSize = newWindowSize;
this.flowControlWindow += settingsDelta;
int min = Math.min(toSend, this.flowControlWindow);
int actualBytes = this.getChannel().grabFlowControlBytes(min);
this.flowControlWindow -= actualBytes;
return actualBytes;
}
} }
|
public class class_name {
public boolean waitForRegistered(long timeout, TimeUnit unit) {
try {
if (this.registeredLatch.await(timeout, unit)) {
return true;
}
} catch (InterruptedException e) {
LOG.severe("Failed to wait for mesos framework got registered");
return false;
}
return false;
} }
|
public class class_name {
public boolean waitForRegistered(long timeout, TimeUnit unit) {
try {
if (this.registeredLatch.await(timeout, unit)) {
return true; // depends on control dependency: [if], data = [none]
}
} catch (InterruptedException e) {
LOG.severe("Failed to wait for mesos framework got registered");
return false;
} // depends on control dependency: [catch], data = [none]
return false;
} }
|
public class class_name {
public boolean remove(SpdData data) {
if (data == null)
return false;
if (data instanceof SpdLoad) {
return super.remove(data);
} else {
return false;
}
} }
|
public class class_name {
public boolean remove(SpdData data) {
if (data == null)
return false;
if (data instanceof SpdLoad) {
return super.remove(data); // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean logEvent(Context context) {
boolean isReqQueued = false;
String reqPath = isStandardEvent ? Defines.RequestPath.TrackStandardEvent.getPath() : Defines.RequestPath.TrackCustomEvent.getPath();
if (Branch.getInstance() != null) {
Branch.getInstance().handleNewRequest(new ServerRequestLogEvent(context, reqPath));
isReqQueued = true;
}
return isReqQueued;
} }
|
public class class_name {
public boolean logEvent(Context context) {
boolean isReqQueued = false;
String reqPath = isStandardEvent ? Defines.RequestPath.TrackStandardEvent.getPath() : Defines.RequestPath.TrackCustomEvent.getPath();
if (Branch.getInstance() != null) {
Branch.getInstance().handleNewRequest(new ServerRequestLogEvent(context, reqPath)); // depends on control dependency: [if], data = [none]
isReqQueued = true; // depends on control dependency: [if], data = [none]
}
return isReqQueued;
} }
|
public class class_name {
protected void initDatabase() throws NamingException, RepositoryException, IOException
{
DBInitializer dbInitializer = null;
if (containerConfig.dbDialect.equals(DBConstants.DB_DIALECT_ORACLEOCI))
{
LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");
this.connFactory = defaultConnectionFactory();
dbInitializer = new OracleDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_ORACLE))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = new OracleDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_PGSQL))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = new PgSQLDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MYSQL))
{
if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MYSQL_MYISAM))
{
LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only"
+ " if you don't expect any support and performances in read accesses are more important than the consistency"
+ " in your use-case. This dialect is only dedicated to the community.");
}
this.connFactory = new MySQLConnectionFactory(getDataSource(), containerConfig);
dbInitializer = new MysqlDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MSSQL))
{
this.connFactory = new MSSQLConnectionFactory(getDataSource(), containerConfig);
dbInitializer=new MSSQLDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_DERBY))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = defaultDBInitializer();
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_DB2))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = new DB2DBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_SYBASE))
{
this.connFactory = new SybaseConnectionFactory(getDataSource(), containerConfig);
dbInitializer = new SybaseDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_INGRES))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = new IngresSQLDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_HSQLDB))
{
this.connFactory = new HSQLDBConnectionFactory(getDataSource(), containerConfig);
dbInitializer = new HSQLDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else
{
// generic, DB_HSQLDB
this.connFactory = defaultConnectionFactory();
dbInitializer = defaultDBInitializer();
}
// database type
try
{
dbInitializer.init();
}
catch (DBInitializerException e)
{
LOG.error("Error of init db " + e, e);
}
} }
|
public class class_name {
protected void initDatabase() throws NamingException, RepositoryException, IOException
{
DBInitializer dbInitializer = null;
if (containerConfig.dbDialect.equals(DBConstants.DB_DIALECT_ORACLEOCI))
{
LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");
this.connFactory = defaultConnectionFactory();
dbInitializer = new OracleDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_ORACLE))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = new OracleDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_PGSQL))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = new PgSQLDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MYSQL))
{
if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MYSQL_MYISAM))
{
LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only"
+ " if you don't expect any support and performances in read accesses are more important than the consistency"
+ " in your use-case. This dialect is only dedicated to the community."); // depends on control dependency: [if], data = [none]
}
this.connFactory = new MySQLConnectionFactory(getDataSource(), containerConfig);
dbInitializer = new MysqlDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MSSQL))
{
this.connFactory = new MSSQLConnectionFactory(getDataSource(), containerConfig);
dbInitializer=new MSSQLDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_DERBY))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = defaultDBInitializer();
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_DB2))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = new DB2DBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_SYBASE))
{
this.connFactory = new SybaseConnectionFactory(getDataSource(), containerConfig);
dbInitializer = new SybaseDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_INGRES))
{
this.connFactory = defaultConnectionFactory();
dbInitializer = new IngresSQLDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
}
else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_HSQLDB))
{
this.connFactory = new HSQLDBConnectionFactory(getDataSource(), containerConfig);
dbInitializer = new HSQLDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
}
else
{
// generic, DB_HSQLDB
this.connFactory = defaultConnectionFactory();
dbInitializer = defaultDBInitializer();
}
// database type
try
{
dbInitializer.init();
}
catch (DBInitializerException e)
{
LOG.error("Error of init db " + e, e);
}
} }
|
public class class_name {
private static int parseFraction(String v, int multiplier) {
int r = 0;
for (int i = 0; i < v.length(); i++) {
char c = v.charAt(i);
int x = c < '0' || c > '9' ? 0 : (c - '0');
r += multiplier * x;
if (multiplier < 10) {
// We're at the last digit. Check for rounding.
if (i + 1 < v.length()
&& v.charAt(i + 1) >= '5') {
++r;
}
break;
}
multiplier /= 10;
}
return r;
} }
|
public class class_name {
private static int parseFraction(String v, int multiplier) {
int r = 0;
for (int i = 0; i < v.length(); i++) {
char c = v.charAt(i);
int x = c < '0' || c > '9' ? 0 : (c - '0');
r += multiplier * x; // depends on control dependency: [for], data = [none]
if (multiplier < 10) {
// We're at the last digit. Check for rounding.
if (i + 1 < v.length()
&& v.charAt(i + 1) >= '5') {
++r; // depends on control dependency: [if], data = [none]
}
break;
}
multiplier /= 10; // depends on control dependency: [for], data = [none]
}
return r;
} }
|
public class class_name {
private void generateJMeterDirectoryTree() {
File workingDirectory = new File(jmeterDirectory, "bin");
workingDirectory.mkdirs();
JMeterConfigurationHolder.getInstance().setWorkingDirectory(workingDirectory);
customPropertiesDirectory = new File(jmeterDirectory, "custom_properties");
customPropertiesDirectory.mkdirs();
libDirectory = new File(jmeterDirectory, "lib");
libExtDirectory = new File(libDirectory, "ext");
libExtDirectory.mkdirs();
libJUnitDirectory = new File(libDirectory, "junit");
libJUnitDirectory.mkdirs();
testFilesBuildDirectory.mkdirs();
resultsDirectory.mkdirs();
if (generateReports) {
reportDirectory.mkdirs();
}
logsDirectory.mkdirs();
} }
|
public class class_name {
private void generateJMeterDirectoryTree() {
File workingDirectory = new File(jmeterDirectory, "bin");
workingDirectory.mkdirs();
JMeterConfigurationHolder.getInstance().setWorkingDirectory(workingDirectory);
customPropertiesDirectory = new File(jmeterDirectory, "custom_properties");
customPropertiesDirectory.mkdirs();
libDirectory = new File(jmeterDirectory, "lib");
libExtDirectory = new File(libDirectory, "ext");
libExtDirectory.mkdirs();
libJUnitDirectory = new File(libDirectory, "junit");
libJUnitDirectory.mkdirs();
testFilesBuildDirectory.mkdirs();
resultsDirectory.mkdirs();
if (generateReports) {
reportDirectory.mkdirs(); // depends on control dependency: [if], data = [none]
}
logsDirectory.mkdirs();
} }
|
public class class_name {
public static JSONObject toJSONObject(String string) throws JSONException {
String n;
JSONObject o = new JSONObject();
Object v;
JSONTokener x = new JSONTokener(string);
o.put("name", x.nextTo('='));
x.next('=');
o.put("value", x.nextTo(';'));
x.next();
while (x.more()) {
n = unescape(x.nextTo("=;"));
if (x.next() != '=') {
if (n.equals("secure")) {
v = Boolean.TRUE;
} else {
throw x.syntaxError("Missing '=' in cookie parameter.");
}
} else {
v = unescape(x.nextTo(';'));
x.next();
}
o.put(n, v);
}
return o;
} }
|
public class class_name {
public static JSONObject toJSONObject(String string) throws JSONException {
String n;
JSONObject o = new JSONObject();
Object v;
JSONTokener x = new JSONTokener(string);
o.put("name", x.nextTo('='));
x.next('=');
o.put("value", x.nextTo(';'));
x.next();
while (x.more()) {
n = unescape(x.nextTo("=;"));
if (x.next() != '=') {
if (n.equals("secure")) {
v = Boolean.TRUE; // depends on control dependency: [if], data = [none]
} else {
throw x.syntaxError("Missing '=' in cookie parameter.");
}
} else {
v = unescape(x.nextTo(';'));
x.next();
}
o.put(n, v);
}
return o;
} }
|
public class class_name {
@Override
public boolean weekdayRange(String wd1, String wd2, String gmt) {
boolean useGmt = GMT.equalsIgnoreCase(wd2) || GMT.equalsIgnoreCase(gmt);
Calendar cal = getCurrentTime(useGmt);
int currentDay = cal.get(Calendar.DAY_OF_WEEK) - 1;
int from = DAYS.indexOf(wd1 == null ? null : wd1
.toUpperCase(Locale.ENGLISH));
int to = DAYS.indexOf(wd2 == null ? null : wd2.toUpperCase(Locale.ENGLISH));
if (to == -1) {
to = from;
}
if (to < from) {
return currentDay >= from || currentDay <= to;
} else {
return currentDay >= from && currentDay <= to;
}
} }
|
public class class_name {
@Override
public boolean weekdayRange(String wd1, String wd2, String gmt) {
boolean useGmt = GMT.equalsIgnoreCase(wd2) || GMT.equalsIgnoreCase(gmt);
Calendar cal = getCurrentTime(useGmt);
int currentDay = cal.get(Calendar.DAY_OF_WEEK) - 1;
int from = DAYS.indexOf(wd1 == null ? null : wd1
.toUpperCase(Locale.ENGLISH));
int to = DAYS.indexOf(wd2 == null ? null : wd2.toUpperCase(Locale.ENGLISH));
if (to == -1) {
to = from; // depends on control dependency: [if], data = [none]
}
if (to < from) {
return currentDay >= from || currentDay <= to; // depends on control dependency: [if], data = [none]
} else {
return currentDay >= from && currentDay <= to; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setResourceContainerImageName(java.util.Collection<StringFilter> resourceContainerImageName) {
if (resourceContainerImageName == null) {
this.resourceContainerImageName = null;
return;
}
this.resourceContainerImageName = new java.util.ArrayList<StringFilter>(resourceContainerImageName);
} }
|
public class class_name {
public void setResourceContainerImageName(java.util.Collection<StringFilter> resourceContainerImageName) {
if (resourceContainerImageName == null) {
this.resourceContainerImageName = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.resourceContainerImageName = new java.util.ArrayList<StringFilter>(resourceContainerImageName);
} }
|
public class class_name {
List<JCTree> normalizeDefs(List<JCTree> defs, ClassSymbol c) {
ListBuffer<JCStatement> initCode = new ListBuffer<JCStatement>();
ListBuffer<Attribute.TypeCompound> initTAs = new ListBuffer<Attribute.TypeCompound>();
ListBuffer<JCStatement> clinitCode = new ListBuffer<JCStatement>();
ListBuffer<Attribute.TypeCompound> clinitTAs = new ListBuffer<Attribute.TypeCompound>();
ListBuffer<JCTree> methodDefs = new ListBuffer<JCTree>();
// Sort definitions into three listbuffers:
// - initCode for instance initializers
// - clinitCode for class initializers
// - methodDefs for method definitions
for (List<JCTree> l = defs; l.nonEmpty(); l = l.tail) {
JCTree def = l.head;
switch (def.getTag()) {
case BLOCK:
JCBlock block = (JCBlock)def;
if ((block.flags & STATIC) != 0)
clinitCode.append(block);
else if ((block.flags & SYNTHETIC) == 0)
initCode.append(block);
break;
case METHODDEF:
methodDefs.append(def);
break;
case VARDEF:
JCVariableDecl vdef = (JCVariableDecl) def;
VarSymbol sym = vdef.sym;
checkDimension(vdef.pos(), sym.type);
if (vdef.init != null) {
if ((sym.flags() & STATIC) == 0) {
// Always initialize instance variables.
JCStatement init = make.at(vdef.pos()).
Assignment(sym, vdef.init);
initCode.append(init);
endPosTable.replaceTree(vdef, init);
initTAs.addAll(getAndRemoveNonFieldTAs(sym));
} else if (sym.getConstValue() == null) {
// Initialize class (static) variables only if
// they are not compile-time constants.
JCStatement init = make.at(vdef.pos).
Assignment(sym, vdef.init);
clinitCode.append(init);
endPosTable.replaceTree(vdef, init);
clinitTAs.addAll(getAndRemoveNonFieldTAs(sym));
} else {
checkStringConstant(vdef.init.pos(), sym.getConstValue());
/* if the init contains a reference to an external class, add it to the
* constant's pool
*/
vdef.init.accept(classReferenceVisitor);
}
}
break;
default:
Assert.error();
}
}
// Insert any instance initializers into all constructors.
if (initCode.length() != 0) {
List<JCStatement> inits = initCode.toList();
initTAs.addAll(c.getInitTypeAttributes());
List<Attribute.TypeCompound> initTAlist = initTAs.toList();
for (JCTree t : methodDefs) {
normalizeMethod((JCMethodDecl)t, inits, initTAlist);
}
}
// If there are class initializers, create a <clinit> method
// that contains them as its body.
if (clinitCode.length() != 0) {
MethodSymbol clinit = new MethodSymbol(
STATIC | (c.flags() & STRICTFP),
names.clinit,
new MethodType(
List.<Type>nil(), syms.voidType,
List.<Type>nil(), syms.methodClass),
c);
c.members().enter(clinit);
List<JCStatement> clinitStats = clinitCode.toList();
JCBlock block = make.at(clinitStats.head.pos()).Block(0, clinitStats);
block.endpos = TreeInfo.endPos(clinitStats.last());
methodDefs.append(make.MethodDef(clinit, block));
if (!clinitTAs.isEmpty())
clinit.appendUniqueTypeAttributes(clinitTAs.toList());
if (!c.getClassInitTypeAttributes().isEmpty())
clinit.appendUniqueTypeAttributes(c.getClassInitTypeAttributes());
}
// Return all method definitions.
return methodDefs.toList();
} }
|
public class class_name {
List<JCTree> normalizeDefs(List<JCTree> defs, ClassSymbol c) {
ListBuffer<JCStatement> initCode = new ListBuffer<JCStatement>();
ListBuffer<Attribute.TypeCompound> initTAs = new ListBuffer<Attribute.TypeCompound>();
ListBuffer<JCStatement> clinitCode = new ListBuffer<JCStatement>();
ListBuffer<Attribute.TypeCompound> clinitTAs = new ListBuffer<Attribute.TypeCompound>();
ListBuffer<JCTree> methodDefs = new ListBuffer<JCTree>();
// Sort definitions into three listbuffers:
// - initCode for instance initializers
// - clinitCode for class initializers
// - methodDefs for method definitions
for (List<JCTree> l = defs; l.nonEmpty(); l = l.tail) {
JCTree def = l.head;
switch (def.getTag()) {
case BLOCK:
JCBlock block = (JCBlock)def;
if ((block.flags & STATIC) != 0)
clinitCode.append(block);
else if ((block.flags & SYNTHETIC) == 0)
initCode.append(block);
break;
case METHODDEF:
methodDefs.append(def); // depends on control dependency: [for], data = [none]
break;
case VARDEF:
JCVariableDecl vdef = (JCVariableDecl) def;
VarSymbol sym = vdef.sym;
checkDimension(vdef.pos(), sym.type); // depends on control dependency: [for], data = [none]
if (vdef.init != null) {
if ((sym.flags() & STATIC) == 0) {
// Always initialize instance variables.
JCStatement init = make.at(vdef.pos()).
Assignment(sym, vdef.init);
initCode.append(init); // depends on control dependency: [if], data = [none]
endPosTable.replaceTree(vdef, init); // depends on control dependency: [if], data = [none]
initTAs.addAll(getAndRemoveNonFieldTAs(sym)); // depends on control dependency: [if], data = [none]
} else if (sym.getConstValue() == null) {
// Initialize class (static) variables only if
// they are not compile-time constants.
JCStatement init = make.at(vdef.pos).
Assignment(sym, vdef.init);
clinitCode.append(init); // depends on control dependency: [if], data = [none]
endPosTable.replaceTree(vdef, init); // depends on control dependency: [if], data = [none]
clinitTAs.addAll(getAndRemoveNonFieldTAs(sym)); // depends on control dependency: [if], data = [none]
} else {
checkStringConstant(vdef.init.pos(), sym.getConstValue()); // depends on control dependency: [if], data = [none]
/* if the init contains a reference to an external class, add it to the
* constant's pool
*/
vdef.init.accept(classReferenceVisitor); // depends on control dependency: [if], data = [none]
}
}
break;
default:
Assert.error();
}
}
// Insert any instance initializers into all constructors.
if (initCode.length() != 0) {
List<JCStatement> inits = initCode.toList();
initTAs.addAll(c.getInitTypeAttributes());
List<Attribute.TypeCompound> initTAlist = initTAs.toList();
for (JCTree t : methodDefs) {
normalizeMethod((JCMethodDecl)t, inits, initTAlist);
}
}
// If there are class initializers, create a <clinit> method
// that contains them as its body.
if (clinitCode.length() != 0) {
MethodSymbol clinit = new MethodSymbol(
STATIC | (c.flags() & STRICTFP),
names.clinit,
new MethodType(
List.<Type>nil(), syms.voidType,
List.<Type>nil(), syms.methodClass),
c);
c.members().enter(clinit);
List<JCStatement> clinitStats = clinitCode.toList();
JCBlock block = make.at(clinitStats.head.pos()).Block(0, clinitStats);
block.endpos = TreeInfo.endPos(clinitStats.last());
methodDefs.append(make.MethodDef(clinit, block));
if (!clinitTAs.isEmpty())
clinit.appendUniqueTypeAttributes(clinitTAs.toList());
if (!c.getClassInitTypeAttributes().isEmpty())
clinit.appendUniqueTypeAttributes(c.getClassInitTypeAttributes());
}
// Return all method definitions.
return methodDefs.toList();
} }
|
public class class_name {
public static String unescapeSpaces(String in) {
char[] chars = in.toCharArray();
int end = chars.length;
StringBuffer out = new StringBuffer(in.length());
for (int i = 0; i < end; i++) {
/*
* Remove any backslashes that precede spaces.
*/
boolean isSlashSpace = (chars[i] == '\\') && (i + 1 < end) && (chars[i + 1] == ' ');
if (isSlashSpace) {
boolean isStart = (i > 0) && (chars[i - 1] == '=');
boolean isEnd = (i + 2 >= end) || ((i + 2 < end) && (chars[i + 2] == ','));
if (!isStart && !isEnd) {
++i;
}
}
out.append(chars[i]);
}
return new String(out);
} }
|
public class class_name {
public static String unescapeSpaces(String in) {
char[] chars = in.toCharArray();
int end = chars.length;
StringBuffer out = new StringBuffer(in.length());
for (int i = 0; i < end; i++) {
/*
* Remove any backslashes that precede spaces.
*/
boolean isSlashSpace = (chars[i] == '\\') && (i + 1 < end) && (chars[i + 1] == ' ');
if (isSlashSpace) {
boolean isStart = (i > 0) && (chars[i - 1] == '=');
boolean isEnd = (i + 2 >= end) || ((i + 2 < end) && (chars[i + 2] == ','));
if (!isStart && !isEnd) {
++i; // depends on control dependency: [if], data = [none]
}
}
out.append(chars[i]); // depends on control dependency: [for], data = [i]
}
return new String(out);
} }
|
public class class_name {
@Override
public void solvingStarted(DefaultSolverScope<Solution_> solverScope) {
// Starting bestSolution is already set by Solver.solve(Solution)
InnerScoreDirector<Solution_> scoreDirector = solverScope.getScoreDirector();
Score score = scoreDirector.calculateScore();
solverScope.setBestScore(score);
solverScope.setBestSolutionTimeMillis(System.currentTimeMillis());
// The original bestSolution might be the final bestSolution and should have an accurate Score
solverScope.getSolutionDescriptor().setScore(solverScope.getBestSolution(), score);
if (score.isSolutionInitialized()) {
solverScope.setStartingInitializedScore(score);
} else {
solverScope.setStartingInitializedScore(null);
}
if (assertInitialScoreFromScratch) {
scoreDirector.assertWorkingScoreFromScratch(score, "Initial score calculated");
}
if (assertShadowVariablesAreNotStale) {
scoreDirector.assertShadowVariablesAreNotStale(score, "Initial score calculated");
}
} }
|
public class class_name {
@Override
public void solvingStarted(DefaultSolverScope<Solution_> solverScope) {
// Starting bestSolution is already set by Solver.solve(Solution)
InnerScoreDirector<Solution_> scoreDirector = solverScope.getScoreDirector();
Score score = scoreDirector.calculateScore();
solverScope.setBestScore(score);
solverScope.setBestSolutionTimeMillis(System.currentTimeMillis());
// The original bestSolution might be the final bestSolution and should have an accurate Score
solverScope.getSolutionDescriptor().setScore(solverScope.getBestSolution(), score);
if (score.isSolutionInitialized()) {
solverScope.setStartingInitializedScore(score); // depends on control dependency: [if], data = [none]
} else {
solverScope.setStartingInitializedScore(null); // depends on control dependency: [if], data = [none]
}
if (assertInitialScoreFromScratch) {
scoreDirector.assertWorkingScoreFromScratch(score, "Initial score calculated"); // depends on control dependency: [if], data = [none]
}
if (assertShadowVariablesAreNotStale) {
scoreDirector.assertShadowVariablesAreNotStale(score, "Initial score calculated"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings({ "unused", "unchecked" })
private static void rewriteMergeData(String key, String subKey,
NamedList<Object> snl, NamedList<Object> tnl) {
if (snl != null) {
Object o = tnl.get(key);
NamedList<Object> tnnnl;
if (o != null && o instanceof NamedList) {
tnnnl = (NamedList<Object>) o;
} else {
tnnnl = new SimpleOrderedMap<>();
tnl.add(key, tnnnl);
}
tnnnl.add(subKey, snl);
}
} }
|
public class class_name {
@SuppressWarnings({ "unused", "unchecked" })
private static void rewriteMergeData(String key, String subKey,
NamedList<Object> snl, NamedList<Object> tnl) {
if (snl != null) {
Object o = tnl.get(key);
NamedList<Object> tnnnl;
if (o != null && o instanceof NamedList) {
tnnnl = (NamedList<Object>) o; // depends on control dependency: [if], data = [none]
} else {
tnnnl = new SimpleOrderedMap<>(); // depends on control dependency: [if], data = [none]
tnl.add(key, tnnnl); // depends on control dependency: [if], data = [none]
}
tnnnl.add(subKey, snl); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public byte[] transformOut(JdbcPreparedStatementFactory jpsf, byte[] attributeObject) throws CpoException {
byte[] retBytes = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
if (attributeObject != null) {
if (attributeObject.length > 0) {
GZIPOutputStream os = new GZIPOutputStream(baos);
os.write(attributeObject);
os.flush();
os.close();
baos.flush();
baos.close();
retBytes = baos.toByteArray();
} else {
retBytes = new byte[0];
}
}
} catch (Exception e) {
String msg = "Error GZipping Byte Array";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return retBytes;
} }
|
public class class_name {
@Override
public byte[] transformOut(JdbcPreparedStatementFactory jpsf, byte[] attributeObject) throws CpoException {
byte[] retBytes = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
if (attributeObject != null) {
if (attributeObject.length > 0) {
GZIPOutputStream os = new GZIPOutputStream(baos);
os.write(attributeObject); // depends on control dependency: [if], data = [none]
os.flush(); // depends on control dependency: [if], data = [none]
os.close(); // depends on control dependency: [if], data = [none]
baos.flush(); // depends on control dependency: [if], data = [none]
baos.close(); // depends on control dependency: [if], data = [none]
retBytes = baos.toByteArray(); // depends on control dependency: [if], data = [none]
} else {
retBytes = new byte[0]; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
String msg = "Error GZipping Byte Array";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return retBytes;
} }
|
public class class_name {
public void clearAll() {
this.auths.clear();
this.authsByUser.clear();
File[] auths = this.authStoreDir.listFiles(new AuthFilenameFilter());
for (int i = 0; i < auths.length; i++) {
auths[i].delete();
}
} }
|
public class class_name {
public void clearAll() {
this.auths.clear();
this.authsByUser.clear();
File[] auths = this.authStoreDir.listFiles(new AuthFilenameFilter());
for (int i = 0; i < auths.length; i++) {
auths[i].delete();
// depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public void setTargetArns(java.util.Collection<String> targetArns) {
if (targetArns == null) {
this.targetArns = null;
return;
}
this.targetArns = new java.util.ArrayList<String>(targetArns);
} }
|
public class class_name {
public void setTargetArns(java.util.Collection<String> targetArns) {
if (targetArns == null) {
this.targetArns = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.targetArns = new java.util.ArrayList<String>(targetArns);
} }
|
public class class_name {
public void reduce( AppendableVec nv ) {
if( this == nv ) return; // Trivially done
// Combine arrays of elements-per-chunk
long e1[] = nv._espc; // Shorter array of longs?
byte t1[] = nv._chunkTypes;
if( e1.length > _espc.length ) {
e1 = _espc; // Keep the shorter one in e1
t1 = _chunkTypes;
_espc = nv._espc; // Keep longer in the object
_chunkTypes = nv._chunkTypes;
}
for( int i=0; i<e1.length; i++ ){ // Copy non-zero elements over
assert _chunkTypes[i] == 0 || t1[i] == 0;
if( e1[i] != 0 && _espc[i]==0 )
_espc[i] = e1[i];
_chunkTypes[i] |= t1[i];
}
_naCnt += nv._naCnt;
_strCnt += nv._strCnt;
Utils.add(_timCnt,nv._timCnt);
_totalCnt += nv._totalCnt;
} }
|
public class class_name {
public void reduce( AppendableVec nv ) {
if( this == nv ) return; // Trivially done
// Combine arrays of elements-per-chunk
long e1[] = nv._espc; // Shorter array of longs?
byte t1[] = nv._chunkTypes;
if( e1.length > _espc.length ) {
e1 = _espc; // Keep the shorter one in e1 // depends on control dependency: [if], data = [none]
t1 = _chunkTypes; // depends on control dependency: [if], data = [none]
_espc = nv._espc; // Keep longer in the object // depends on control dependency: [if], data = [none]
_chunkTypes = nv._chunkTypes; // depends on control dependency: [if], data = [none]
}
for( int i=0; i<e1.length; i++ ){ // Copy non-zero elements over
assert _chunkTypes[i] == 0 || t1[i] == 0;
if( e1[i] != 0 && _espc[i]==0 )
_espc[i] = e1[i];
_chunkTypes[i] |= t1[i]; // depends on control dependency: [for], data = [i]
}
_naCnt += nv._naCnt;
_strCnt += nv._strCnt;
Utils.add(_timCnt,nv._timCnt);
_totalCnt += nv._totalCnt;
} }
|
public class class_name {
private void openSelector(ThreadNameDeterminer determiner) {
try {
selector = SelectorUtil.open();
} catch (Throwable t) {
throw new ChannelException("Failed to create a selector.", t);
}
// Start the worker thread with the new Selector.
boolean success = false;
try {
DeadLockProofWorker.start(executor, newThreadRenamingRunnable(id, determiner));
success = true;
} finally {
if (!success) {
// Release the Selector if the execution fails.
try {
selector.close();
} catch (Throwable t) {
logger.warn("Failed to close a selector.", t);
}
selector = null;
// The method will return to the caller at this point.
}
}
assert selector != null && selector.isOpen();
} }
|
public class class_name {
private void openSelector(ThreadNameDeterminer determiner) {
try {
selector = SelectorUtil.open(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
throw new ChannelException("Failed to create a selector.", t);
} // depends on control dependency: [catch], data = [none]
// Start the worker thread with the new Selector.
boolean success = false;
try {
DeadLockProofWorker.start(executor, newThreadRenamingRunnable(id, determiner)); // depends on control dependency: [try], data = [none]
success = true; // depends on control dependency: [try], data = [none]
} finally {
if (!success) {
// Release the Selector if the execution fails.
try {
selector.close(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
logger.warn("Failed to close a selector.", t);
} // depends on control dependency: [catch], data = [none]
selector = null; // depends on control dependency: [if], data = [none]
// The method will return to the caller at this point.
}
}
assert selector != null && selector.isOpen();
} }
|
public class class_name {
protected void handleBindException(String userDn, String username, Throwable cause) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to bind as " + userDn + ": " + cause);
}
} }
|
public class class_name {
protected void handleBindException(String userDn, String username, Throwable cause) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to bind as " + userDn + ": " + cause); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Map<Layout, Collection<XmlScope>> getXmlScopes() {
List<File> layoutDirs = layoutsFinder.findLayoutDirs();
Collection<File> layoutFiles = collectionUtils.flatMap(layoutDirs, new CollectionUtils.Function<File, Collection<File>>() {
@Override
public Collection<File> apply(File file) {
return collectionUtils.filter(Arrays.asList(file.listFiles()), new CollectionUtils.Function<File, Boolean>() {
@Override
public Boolean apply(File file) {
return file.getName().endsWith(".xml");
}
});
}
});
Collection<Document> docs = collectionUtils.flatMapOpt(layoutFiles, new CollectionUtils.Function<File, Option<Document>>() {
@Override
public Option<Document> apply(File file) {
return getDocumentFromFile(file);
}
});
return collectionUtils.toMap(collectionUtils.flatMapOpt(docs, new CollectionUtils.Function<Document, Option<Tuple<Layout, Collection<XmlScope>>>>() {
@Override
public Option<Tuple<Layout, Collection<XmlScope>>> apply(Document doc) {
Option<String> optNameSpace = namespaceFinder.getNameSpace(doc);
if (optNameSpace.isPresent()) {
attrPattern = Pattern.compile(String.format(NAMESPACE_ATTRIBUTE_REG, optNameSpace.get()));
Collection<XmlScope> scopes = getScopes(doc);
return Option.of(Tuple.of(new Layout(doc.getDocumentURI()), scopes));
} else {
return Option.absent();
}
}
}));
} }
|
public class class_name {
public Map<Layout, Collection<XmlScope>> getXmlScopes() {
List<File> layoutDirs = layoutsFinder.findLayoutDirs();
Collection<File> layoutFiles = collectionUtils.flatMap(layoutDirs, new CollectionUtils.Function<File, Collection<File>>() {
@Override
public Collection<File> apply(File file) {
return collectionUtils.filter(Arrays.asList(file.listFiles()), new CollectionUtils.Function<File, Boolean>() {
@Override
public Boolean apply(File file) {
return file.getName().endsWith(".xml");
}
});
}
});
Collection<Document> docs = collectionUtils.flatMapOpt(layoutFiles, new CollectionUtils.Function<File, Option<Document>>() {
@Override
public Option<Document> apply(File file) {
return getDocumentFromFile(file);
}
});
return collectionUtils.toMap(collectionUtils.flatMapOpt(docs, new CollectionUtils.Function<Document, Option<Tuple<Layout, Collection<XmlScope>>>>() {
@Override
public Option<Tuple<Layout, Collection<XmlScope>>> apply(Document doc) {
Option<String> optNameSpace = namespaceFinder.getNameSpace(doc);
if (optNameSpace.isPresent()) {
attrPattern = Pattern.compile(String.format(NAMESPACE_ATTRIBUTE_REG, optNameSpace.get())); // depends on control dependency: [if], data = [none]
Collection<XmlScope> scopes = getScopes(doc);
return Option.of(Tuple.of(new Layout(doc.getDocumentURI()), scopes)); // depends on control dependency: [if], data = [none]
} else {
return Option.absent(); // depends on control dependency: [if], data = [none]
}
}
}));
} }
|
public class class_name {
private void init(int port, File commandFileTmp) throws IOException {
if (port != -1) {
serverSocketChannel = SelectorProvider.provider().openServerSocketChannel();
// Open the socket for loopback only..
InetSocketAddress address = new InetSocketAddress(InetAddress.getByName(null), port);
IOException bindError = null;
boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows");
try {
//Attempt bind with reuseAddress set to false.
serverSocketChannel.socket().setReuseAddress(false);
serverSocketChannel.socket().bind(address);
//If we are not on Windows and the bind succeeded, we should set reuseAddr=true
//for future binds.
if (!isWindows) {
serverSocketChannel.socket().setReuseAddress(true);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ServerSocket reuse set to true to allow for later override");
}
}
} catch (IOException ioe) {
// see if we got the error because port is in waiting to be cleaned up.
// If so, no one should be accepting connections on it, and open should fail.
// If that's the case, we can set ReuseAddr to expedite the bind process.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ServerSocket bind failed on first attempt with IOException: " + ioe.getMessage());
}
bindError = ioe;
try {
InetSocketAddress testAddr = new InetSocketAddress(InetAddress.getByName(null), port);
if (!testAddr.isUnresolved()) {
SocketChannel testChannel = SocketChannel.open(testAddr);
// if we get here, socket opened successfully, which means someone is really listening
// so close connection and don't bother trying to bind again
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "attempt to connect to command port to check listen status worked, someone else is using the port!");
}
testChannel.close();
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Test connection addr is unresolvable; " + testAddr);
}
}
} catch (IOException testioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "attempt to connect to command port to check listen status failed with IOException: " + testioe.getMessage());
}
try {
// open (or close) got IOException, retry with reuseAddress set to true
serverSocketChannel.socket().setReuseAddress(true);
serverSocketChannel.socket().bind(address);
bindError = null;
} catch (IOException newioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ServerSocket bind failed on second attempt with IOException: " + newioe.getMessage());
}
bindError = newioe;
}
}
}
if (bindError == null) {
// if we requested an ephemeral port, find out what port we ended up with
if (port == 0) {
port = serverSocketChannel.socket().getLocalPort();
}
listenForCommands = true;
} else {
throw bindError;
}
}
ServerCommandID sci = new ServerCommandID(port, serverUUID);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(commandFileTmp);
fos.write(sci.getIDString().getBytes());
fos.close();
} finally {
Utils.tryToClose(fos);
}
} }
|
public class class_name {
private void init(int port, File commandFileTmp) throws IOException {
if (port != -1) {
serverSocketChannel = SelectorProvider.provider().openServerSocketChannel();
// Open the socket for loopback only..
InetSocketAddress address = new InetSocketAddress(InetAddress.getByName(null), port);
IOException bindError = null;
boolean isWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows");
try {
//Attempt bind with reuseAddress set to false.
serverSocketChannel.socket().setReuseAddress(false);
serverSocketChannel.socket().bind(address);
//If we are not on Windows and the bind succeeded, we should set reuseAddr=true
//for future binds.
if (!isWindows) {
serverSocketChannel.socket().setReuseAddress(true); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ServerSocket reuse set to true to allow for later override"); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException ioe) {
// see if we got the error because port is in waiting to be cleaned up.
// If so, no one should be accepting connections on it, and open should fail.
// If that's the case, we can set ReuseAddr to expedite the bind process.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ServerSocket bind failed on first attempt with IOException: " + ioe.getMessage()); // depends on control dependency: [if], data = [none]
}
bindError = ioe;
try {
InetSocketAddress testAddr = new InetSocketAddress(InetAddress.getByName(null), port);
if (!testAddr.isUnresolved()) {
SocketChannel testChannel = SocketChannel.open(testAddr);
// if we get here, socket opened successfully, which means someone is really listening
// so close connection and don't bother trying to bind again
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "attempt to connect to command port to check listen status worked, someone else is using the port!"); // depends on control dependency: [if], data = [none]
}
testChannel.close(); // depends on control dependency: [if], data = [none]
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Test connection addr is unresolvable; " + testAddr); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException testioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "attempt to connect to command port to check listen status failed with IOException: " + testioe.getMessage()); // depends on control dependency: [if], data = [none]
}
try {
// open (or close) got IOException, retry with reuseAddress set to true
serverSocketChannel.socket().setReuseAddress(true); // depends on control dependency: [try], data = [none]
serverSocketChannel.socket().bind(address); // depends on control dependency: [try], data = [none]
bindError = null; // depends on control dependency: [try], data = [none]
} catch (IOException newioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ServerSocket bind failed on second attempt with IOException: " + newioe.getMessage()); // depends on control dependency: [if], data = [none]
}
bindError = newioe;
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
if (bindError == null) {
// if we requested an ephemeral port, find out what port we ended up with
if (port == 0) {
port = serverSocketChannel.socket().getLocalPort();
}
listenForCommands = true;
} else {
throw bindError;
}
}
ServerCommandID sci = new ServerCommandID(port, serverUUID);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(commandFileTmp);
fos.write(sci.getIDString().getBytes());
fos.close();
} finally {
Utils.tryToClose(fos);
}
} }
|
public class class_name {
public static Transport getInstance (Type type, int channel)
{
// were there more parameters in transport objects, it would be better to have a single map
// of instances and use Transport objects as keys (as in examples of the flyweight
// pattern). however, doing it this way avoids the need to create a new object on lookup
if (_unordered == null) {
int length = Type.values().length;
_unordered = new Transport[length];
@SuppressWarnings({ "unchecked" }) HashIntMap<Transport>[] ordered =
(HashIntMap<Transport>[])new HashIntMap<?>[length];
_ordered = ordered;
}
// for unordered transport, we map on the type alone
int idx = type.ordinal();
if (!type.isOrdered()) {
Transport instance = _unordered[idx];
if (instance == null) {
_unordered[idx] = instance = new Transport(type);
}
return instance;
}
// for ordered transport, we map on the type and channel
HashIntMap<Transport> instances = _ordered[idx];
if (instances == null) {
_ordered[idx] = instances = new HashIntMap<Transport>();
}
Transport instance = instances.get(channel);
if (instance == null) {
instances.put(channel, instance = new Transport(type, channel));
}
return instance;
} }
|
public class class_name {
public static Transport getInstance (Type type, int channel)
{
// were there more parameters in transport objects, it would be better to have a single map
// of instances and use Transport objects as keys (as in examples of the flyweight
// pattern). however, doing it this way avoids the need to create a new object on lookup
if (_unordered == null) {
int length = Type.values().length;
_unordered = new Transport[length]; // depends on control dependency: [if], data = [none]
@SuppressWarnings({ "unchecked" }) HashIntMap<Transport>[] ordered =
(HashIntMap<Transport>[])new HashIntMap<?>[length];
_ordered = ordered; // depends on control dependency: [if], data = [none]
}
// for unordered transport, we map on the type alone
int idx = type.ordinal();
if (!type.isOrdered()) {
Transport instance = _unordered[idx];
if (instance == null) {
_unordered[idx] = instance = new Transport(type); // depends on control dependency: [if], data = [none]
}
return instance; // depends on control dependency: [if], data = [none]
}
// for ordered transport, we map on the type and channel
HashIntMap<Transport> instances = _ordered[idx];
if (instances == null) {
_ordered[idx] = instances = new HashIntMap<Transport>(); // depends on control dependency: [if], data = [none]
}
Transport instance = instances.get(channel);
if (instance == null) {
instances.put(channel, instance = new Transport(type, channel)); // depends on control dependency: [if], data = [none]
}
return instance;
} }
|
public class class_name {
public BoundingBox getBoundingBox() {
GeometryEnvelope envelope = null;
long offset = 0;
boolean hasResults = true;
while (hasResults) {
hasResults = false;
FeatureResultSet resultSet = featureDao.queryForChunk(chunkLimit,
offset);
try {
while (resultSet.moveToNext()) {
hasResults = true;
FeatureRow featureRow = resultSet.getRow();
GeometryEnvelope featureEnvelope = featureRow
.getGeometryEnvelope();
if (featureEnvelope != null) {
if (envelope == null) {
envelope = featureEnvelope;
} else {
envelope = envelope.union(featureEnvelope);
}
}
}
} finally {
resultSet.close();
}
offset += chunkLimit;
}
BoundingBox boundingBox = null;
if (envelope != null) {
boundingBox = new BoundingBox(envelope);
}
return boundingBox;
} }
|
public class class_name {
public BoundingBox getBoundingBox() {
GeometryEnvelope envelope = null;
long offset = 0;
boolean hasResults = true;
while (hasResults) {
hasResults = false; // depends on control dependency: [while], data = [none]
FeatureResultSet resultSet = featureDao.queryForChunk(chunkLimit,
offset);
try {
while (resultSet.moveToNext()) {
hasResults = true; // depends on control dependency: [while], data = [none]
FeatureRow featureRow = resultSet.getRow();
GeometryEnvelope featureEnvelope = featureRow
.getGeometryEnvelope();
if (featureEnvelope != null) {
if (envelope == null) {
envelope = featureEnvelope; // depends on control dependency: [if], data = [none]
} else {
envelope = envelope.union(featureEnvelope); // depends on control dependency: [if], data = [none]
}
}
}
} finally {
resultSet.close();
}
offset += chunkLimit; // depends on control dependency: [while], data = [none]
}
BoundingBox boundingBox = null;
if (envelope != null) {
boundingBox = new BoundingBox(envelope); // depends on control dependency: [if], data = [(envelope]
}
return boundingBox;
} }
|
public class class_name {
private RedisSession getSession(String id, boolean allowExpired) {
Map<Object, Object> entries = getSessionBoundHashOperations(id).entries();
if (entries.isEmpty()) {
return null;
}
MapSession loaded = loadSession(id, entries);
if (!allowExpired && loaded.isExpired()) {
return null;
}
RedisSession result = new RedisSession(loaded);
result.originalLastAccessTime = loaded.getLastAccessedTime();
return result;
} }
|
public class class_name {
private RedisSession getSession(String id, boolean allowExpired) {
Map<Object, Object> entries = getSessionBoundHashOperations(id).entries();
if (entries.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
MapSession loaded = loadSession(id, entries);
if (!allowExpired && loaded.isExpired()) {
return null; // depends on control dependency: [if], data = [none]
}
RedisSession result = new RedisSession(loaded);
result.originalLastAccessTime = loaded.getLastAccessedTime();
return result;
} }
|
public class class_name {
@Nullable
public static DigestAuthClientCredentials getDigestAuthClientCredentials (@Nullable final String sAuthHeader)
{
final ICommonsOrderedMap <String, String> aParams = getDigestAuthParams (sAuthHeader);
if (aParams == null)
return null;
final String sUserName = aParams.remove ("username");
if (sUserName == null)
{
LOGGER.error ("Digest Auth does not container 'username'");
return null;
}
final String sRealm = aParams.remove ("realm");
if (sRealm == null)
{
LOGGER.error ("Digest Auth does not container 'realm'");
return null;
}
final String sNonce = aParams.remove ("nonce");
if (sNonce == null)
{
LOGGER.error ("Digest Auth does not container 'nonce'");
return null;
}
final String sDigestURI = aParams.remove ("uri");
if (sDigestURI == null)
{
LOGGER.error ("Digest Auth does not container 'uri'");
return null;
}
final String sResponse = aParams.remove ("response");
if (sResponse == null)
{
LOGGER.error ("Digest Auth does not container 'response'");
return null;
}
final String sAlgorithm = aParams.remove ("algorithm");
final String sCNonce = aParams.remove ("cnonce");
final String sOpaque = aParams.remove ("opaque");
final String sMessageQOP = aParams.remove ("qop");
final String sNonceCount = aParams.remove ("nc");
if (aParams.isNotEmpty ())
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Digest Auth contains unhandled parameters: " + aParams.toString ());
return new DigestAuthClientCredentials (sUserName,
sRealm,
sNonce,
sDigestURI,
sResponse,
sAlgorithm,
sCNonce,
sOpaque,
sMessageQOP,
sNonceCount);
} }
|
public class class_name {
@Nullable
public static DigestAuthClientCredentials getDigestAuthClientCredentials (@Nullable final String sAuthHeader)
{
final ICommonsOrderedMap <String, String> aParams = getDigestAuthParams (sAuthHeader);
if (aParams == null)
return null;
final String sUserName = aParams.remove ("username");
if (sUserName == null)
{
LOGGER.error ("Digest Auth does not container 'username'"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
final String sRealm = aParams.remove ("realm");
if (sRealm == null)
{
LOGGER.error ("Digest Auth does not container 'realm'"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
final String sNonce = aParams.remove ("nonce");
if (sNonce == null)
{
LOGGER.error ("Digest Auth does not container 'nonce'"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
final String sDigestURI = aParams.remove ("uri");
if (sDigestURI == null)
{
LOGGER.error ("Digest Auth does not container 'uri'"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
final String sResponse = aParams.remove ("response");
if (sResponse == null)
{
LOGGER.error ("Digest Auth does not container 'response'"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
final String sAlgorithm = aParams.remove ("algorithm");
final String sCNonce = aParams.remove ("cnonce");
final String sOpaque = aParams.remove ("opaque");
final String sMessageQOP = aParams.remove ("qop");
final String sNonceCount = aParams.remove ("nc");
if (aParams.isNotEmpty ())
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Digest Auth contains unhandled parameters: " + aParams.toString ());
return new DigestAuthClientCredentials (sUserName,
sRealm,
sNonce,
sDigestURI,
sResponse,
sAlgorithm,
sCNonce,
sOpaque,
sMessageQOP,
sNonceCount);
} }
|
public class class_name {
public static File writeObjectToTempFileNoExceptions(Object o, String filename) {
try {
return writeObjectToTempFile(o, filename);
} catch (Exception e) {
System.err.println("Error writing object to file " + filename);
e.printStackTrace();
return null;
}
} }
|
public class class_name {
public static File writeObjectToTempFileNoExceptions(Object o, String filename) {
try {
return writeObjectToTempFile(o, filename);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
System.err.println("Error writing object to file " + filename);
e.printStackTrace();
return null;
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String join(Collection<? extends Object> lst, String separator) {
StringBuilder buf = new StringBuilder(lst.size() * 64);
boolean first = true;
for (Object value : lst) {
if (first) first = false; else buf.append(separator);
buf.append(value.toString());
}
return buf.toString();
} }
|
public class class_name {
public static String join(Collection<? extends Object> lst, String separator) {
StringBuilder buf = new StringBuilder(lst.size() * 64);
boolean first = true;
for (Object value : lst) {
if (first) first = false; else buf.append(separator);
buf.append(value.toString()); // depends on control dependency: [for], data = [value]
}
return buf.toString();
} }
|
public class class_name {
public static <R> ImmutableGrid<R> copyOf(int rowCount, int columnCount, Iterable<? extends Cell<R>> cells) {
if (cells == null) {
throw new IllegalArgumentException("Cells must not be null");
}
if (!cells.iterator().hasNext()) {
return new EmptyGrid<R>(rowCount, columnCount);
}
return new SparseImmutableGrid<R>(rowCount, columnCount, cells);
} }
|
public class class_name {
public static <R> ImmutableGrid<R> copyOf(int rowCount, int columnCount, Iterable<? extends Cell<R>> cells) {
if (cells == null) {
throw new IllegalArgumentException("Cells must not be null");
}
if (!cells.iterator().hasNext()) {
return new EmptyGrid<R>(rowCount, columnCount); // depends on control dependency: [if], data = [none]
}
return new SparseImmutableGrid<R>(rowCount, columnCount, cells);
} }
|
public class class_name {
public void deleteGroup(String key, IPerson deleter) {
if (!canDeleteGroup(deleter, key)) {
throw new RuntimeAuthorizationException(
deleter, IPermission.DELETE_GROUP_ACTIVITY, key);
}
log.info("Deleting group with key " + key);
// find the current version of this group entity
IEntityGroup group = GroupService.findGroup(key);
// remove this group from the membership list of any current parent
// groups
for (IEntityGroup parent : group.getParentGroups()) {
parent.removeChild(group);
parent.updateMembers();
}
// delete the group
group.delete();
} }
|
public class class_name {
public void deleteGroup(String key, IPerson deleter) {
if (!canDeleteGroup(deleter, key)) {
throw new RuntimeAuthorizationException(
deleter, IPermission.DELETE_GROUP_ACTIVITY, key);
}
log.info("Deleting group with key " + key);
// find the current version of this group entity
IEntityGroup group = GroupService.findGroup(key);
// remove this group from the membership list of any current parent
// groups
for (IEntityGroup parent : group.getParentGroups()) {
parent.removeChild(group); // depends on control dependency: [for], data = [parent]
parent.updateMembers(); // depends on control dependency: [for], data = [parent]
}
// delete the group
group.delete();
} }
|
public class class_name {
void showWarnings(SQLWarning warn) {
if (warn == null) {
return;
}
if (seenWarnings.get(warn) == null) {
// don't re-display warnings we have already seen
seenWarnings.put(warn, new java.util.Date());
handleSQLException(warn);
}
SQLWarning next = warn.getNextWarning();
if (next != warn) {
showWarnings(next);
}
} }
|
public class class_name {
void showWarnings(SQLWarning warn) {
if (warn == null) {
return; // depends on control dependency: [if], data = [none]
}
if (seenWarnings.get(warn) == null) {
// don't re-display warnings we have already seen
seenWarnings.put(warn, new java.util.Date()); // depends on control dependency: [if], data = [none]
handleSQLException(warn); // depends on control dependency: [if], data = [none]
}
SQLWarning next = warn.getNextWarning();
if (next != warn) {
showWarnings(next); // depends on control dependency: [if], data = [(next]
}
} }
|
public class class_name {
public void marshall(ActivityFailedEventDetails activityFailedEventDetails, ProtocolMarshaller protocolMarshaller) {
if (activityFailedEventDetails == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(activityFailedEventDetails.getError(), ERROR_BINDING);
protocolMarshaller.marshall(activityFailedEventDetails.getCause(), CAUSE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ActivityFailedEventDetails activityFailedEventDetails, ProtocolMarshaller protocolMarshaller) {
if (activityFailedEventDetails == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(activityFailedEventDetails.getError(), ERROR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(activityFailedEventDetails.getCause(), CAUSE_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 accept(final WebAppVisitor visitor) {
visitor.visit(this); // First do everything else
for (WebAppListener listener : listeners) {
visitor.visit(listener);
}
if (!filters.isEmpty()) {
// first visit the filters with a filter mapping in mapping order
final List<WebAppFilter> remainingFilters = new ArrayList<>(
filters.values());
for (String filterName : orderedFilters) {
final WebAppFilter filter = filters.get(filterName);
visitor.visit(filter);
remainingFilters.remove(filter);
}
// then visit filters without a mapping order in the order they were
// added
for (WebAppFilter filter : remainingFilters) {
visitor.visit(filter);
}
}
if (!servlets.isEmpty()) {
for (WebAppServlet servlet : getSortedWebAppServlet()) {
// Fix for PAXWEB-205
visitor.visit(servlet);
}
}
if (!constraintsMapping.isEmpty()) {
for (WebAppConstraintMapping constraintMapping : constraintsMapping) {
visitor.visit(constraintMapping);
}
}
for (WebAppErrorPage errorPage : errorPages) {
visitor.visit(errorPage);
}
visitor.end();
} }
|
public class class_name {
public void accept(final WebAppVisitor visitor) {
visitor.visit(this); // First do everything else
for (WebAppListener listener : listeners) {
visitor.visit(listener); // depends on control dependency: [for], data = [listener]
}
if (!filters.isEmpty()) {
// first visit the filters with a filter mapping in mapping order
final List<WebAppFilter> remainingFilters = new ArrayList<>(
filters.values());
for (String filterName : orderedFilters) {
final WebAppFilter filter = filters.get(filterName);
visitor.visit(filter); // depends on control dependency: [for], data = [none]
remainingFilters.remove(filter); // depends on control dependency: [for], data = [none]
}
// then visit filters without a mapping order in the order they were
// added
for (WebAppFilter filter : remainingFilters) {
visitor.visit(filter); // depends on control dependency: [for], data = [filter]
}
}
if (!servlets.isEmpty()) {
for (WebAppServlet servlet : getSortedWebAppServlet()) {
// Fix for PAXWEB-205
visitor.visit(servlet); // depends on control dependency: [for], data = [servlet]
}
}
if (!constraintsMapping.isEmpty()) {
for (WebAppConstraintMapping constraintMapping : constraintsMapping) {
visitor.visit(constraintMapping); // depends on control dependency: [for], data = [constraintMapping]
}
}
for (WebAppErrorPage errorPage : errorPages) {
visitor.visit(errorPage); // depends on control dependency: [for], data = [errorPage]
}
visitor.end();
} }
|
public class class_name {
protected String[] tokenizePattern(String pattern) {
String[] tokenized = null;
Boolean cachePatterns = this.cachePatterns;
if (cachePatterns == null || cachePatterns.booleanValue()) {
tokenized = this.tokenizedPatternCache.get(pattern);
}
if (tokenized == null) {
tokenized = tokenizePath(pattern);
if (cachePatterns == null && this.tokenizedPatternCache.size() >= CACHE_TURNOFF_THRESHOLD) {
// Try to adapt to the runtime situation that we're encountering:
// There are obviously too many different patterns coming in here...
// So let's turn off the cache since the patterns are unlikely to be reoccurring.
deactivatePatternCache();
return tokenized;
}
if (cachePatterns == null || cachePatterns.booleanValue()) {
this.tokenizedPatternCache.put(pattern, tokenized);
}
}
return tokenized;
} }
|
public class class_name {
protected String[] tokenizePattern(String pattern) {
String[] tokenized = null;
Boolean cachePatterns = this.cachePatterns;
if (cachePatterns == null || cachePatterns.booleanValue()) {
tokenized = this.tokenizedPatternCache.get(pattern); // depends on control dependency: [if], data = [none]
}
if (tokenized == null) {
tokenized = tokenizePath(pattern); // depends on control dependency: [if], data = [none]
if (cachePatterns == null && this.tokenizedPatternCache.size() >= CACHE_TURNOFF_THRESHOLD) {
// Try to adapt to the runtime situation that we're encountering:
// There are obviously too many different patterns coming in here...
// So let's turn off the cache since the patterns are unlikely to be reoccurring.
deactivatePatternCache(); // depends on control dependency: [if], data = [none]
return tokenized; // depends on control dependency: [if], data = [none]
}
if (cachePatterns == null || cachePatterns.booleanValue()) {
this.tokenizedPatternCache.put(pattern, tokenized); // depends on control dependency: [if], data = [none]
}
}
return tokenized;
} }
|
public class class_name {
public Observable<ServiceResponse<Page<ActivityInner>>> listByModuleWithServiceResponseAsync(final String resourceGroupName, final String automationAccountName, final String moduleName) {
return listByModuleSinglePageAsync(resourceGroupName, automationAccountName, moduleName)
.concatMap(new Func1<ServiceResponse<Page<ActivityInner>>, Observable<ServiceResponse<Page<ActivityInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ActivityInner>>> call(ServiceResponse<Page<ActivityInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByModuleNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<ActivityInner>>> listByModuleWithServiceResponseAsync(final String resourceGroupName, final String automationAccountName, final String moduleName) {
return listByModuleSinglePageAsync(resourceGroupName, automationAccountName, moduleName)
.concatMap(new Func1<ServiceResponse<Page<ActivityInner>>, Observable<ServiceResponse<Page<ActivityInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ActivityInner>>> call(ServiceResponse<Page<ActivityInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listByModuleNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public void elemAdd(VTensor other) {
checkEqualSize(this, other);
for (int c = 0; c < this.size(); c++) {
addValue(c, other.getValue(c));
}
} }
|
public class class_name {
public void elemAdd(VTensor other) {
checkEqualSize(this, other);
for (int c = 0; c < this.size(); c++) {
addValue(c, other.getValue(c)); // depends on control dependency: [for], data = [c]
}
} }
|
public class class_name {
private List<CmsContainerElementBean> getCachedElements(List<String> clientIds, String pageRootPath)
throws CmsException {
List<CmsContainerElementBean> result = new ArrayList<CmsContainerElementBean>();
for (String id : clientIds) {
try {
result.add(getCachedElement(id, pageRootPath));
} catch (CmsIllegalArgumentException e) {
log(e.getLocalizedMessage(), e);
}
}
return result;
} }
|
public class class_name {
private List<CmsContainerElementBean> getCachedElements(List<String> clientIds, String pageRootPath)
throws CmsException {
List<CmsContainerElementBean> result = new ArrayList<CmsContainerElementBean>();
for (String id : clientIds) {
try {
result.add(getCachedElement(id, pageRootPath)); // depends on control dependency: [try], data = [none]
} catch (CmsIllegalArgumentException e) {
log(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
return result;
} }
|
public class class_name {
public static void addBody(Message message, XHTMLText xhtmlText) {
XHTMLExtension xhtmlExtension = XHTMLExtension.from(message);
if (xhtmlExtension == null) {
// Create an XHTMLExtension and add it to the message
xhtmlExtension = new XHTMLExtension();
message.addExtension(xhtmlExtension);
}
// Add the required bodies to the message
xhtmlExtension.addBody(xhtmlText.toXML());
} }
|
public class class_name {
public static void addBody(Message message, XHTMLText xhtmlText) {
XHTMLExtension xhtmlExtension = XHTMLExtension.from(message);
if (xhtmlExtension == null) {
// Create an XHTMLExtension and add it to the message
xhtmlExtension = new XHTMLExtension(); // depends on control dependency: [if], data = [none]
message.addExtension(xhtmlExtension); // depends on control dependency: [if], data = [(xhtmlExtension]
}
// Add the required bodies to the message
xhtmlExtension.addBody(xhtmlText.toXML());
} }
|
public class class_name {
@Override
public void postProcessInstance(ManagedClassSPI managedClass, Object instance) {
Config config = managedClass.getConfig();
if (config == null) {
return;
}
List<Config> fields = config.findChildren("instance-field");
if (!fields.isEmpty() && !InstanceType.POJO.equals(managedClass.getInstanceType())) {
throw new BugError("Cannot assign instance field on non %s type.", InstanceType.POJO);
}
for (Config field : fields) {
Classes.setFieldValue(instance, field.getAttribute("name"), field.getAttribute("value"));
}
} }
|
public class class_name {
@Override
public void postProcessInstance(ManagedClassSPI managedClass, Object instance) {
Config config = managedClass.getConfig();
if (config == null) {
return;
// depends on control dependency: [if], data = [none]
}
List<Config> fields = config.findChildren("instance-field");
if (!fields.isEmpty() && !InstanceType.POJO.equals(managedClass.getInstanceType())) {
throw new BugError("Cannot assign instance field on non %s type.", InstanceType.POJO);
}
for (Config field : fields) {
Classes.setFieldValue(instance, field.getAttribute("name"), field.getAttribute("value"));
// depends on control dependency: [for], data = [field]
}
} }
|
public class class_name {
protected List<String> buildCommand(GitBranchOptions options, Ref arg1, Ref arg2,
List<Ref> branchList) {
List<String> cmd = new ArrayList<String>();
cmd.add(JavaGitConfiguration.getGitCommand());
cmd.add("branch");
if (null != options) {
Ref commit = options.getOptContains();
if (null != commit) {
cmd.add("--contains");
cmd.add(commit.getName());
}
if (options.isOptVerbose()) {
cmd.add("--verbose");
}
if (options.isOptAbbrev()) {
if (options.getOptAbbrevLen() != GitBranchOptions.DEFAULT_ABBREV_LEN) {
cmd.add("--abbrev=" + Integer.toString(options.getOptAbbrevLen()));
} else {
cmd.add("--abbrev");
}
}
if (options.isOptNoAbbrev()) {
cmd.add("--no-abbrev");
}
if (options.isOptA()) {
cmd.add("-a");
}
if (options.isOptDLower()) {
cmd.add("-d");
}
if (options.isOptMLower()) {
cmd.add("-m");
}
if (options.isOptDUpper()) {
cmd.add("-D");
}
if (options.isOptMUpper()) {
cmd.add("-M");
}
if (options.isOptColor()) {
cmd.add("--color");
}
if (options.isOptNoColor()) {
cmd.add("--no-color");
}
if (options.isOptF()) {
cmd.add("-f");
}
if (options.isOptL()) {
cmd.add("-l");
}
if (options.isOptMerged()) {
cmd.add("--merged");
}
if (options.isOptNoMerged()) {
cmd.add("--no-merged");
}
if (options.isOptR()) {
cmd.add("-r");
}
if (options.isOptTrack()) {
cmd.add("--track");
}
if (options.isOptNoTrack()) {
cmd.add("--no-track");
}
}
if (null != branchList) {
if ((null != arg1) || (null != arg2)) {
throw new IllegalArgumentException();
}
for (Ref branch : branchList) {
cmd.add(branch.getName());
}
} else {
if (null != arg1) {
cmd.add(arg1.getName());
}
if (null != arg2) {
cmd.add(arg2.getName());
}
}
return cmd;
} }
|
public class class_name {
protected List<String> buildCommand(GitBranchOptions options, Ref arg1, Ref arg2,
List<Ref> branchList) {
List<String> cmd = new ArrayList<String>();
cmd.add(JavaGitConfiguration.getGitCommand());
cmd.add("branch");
if (null != options) {
Ref commit = options.getOptContains();
if (null != commit) {
cmd.add("--contains"); // depends on control dependency: [if], data = [none]
cmd.add(commit.getName()); // depends on control dependency: [if], data = [none]
}
if (options.isOptVerbose()) {
cmd.add("--verbose"); // depends on control dependency: [if], data = [none]
}
if (options.isOptAbbrev()) {
if (options.getOptAbbrevLen() != GitBranchOptions.DEFAULT_ABBREV_LEN) {
cmd.add("--abbrev=" + Integer.toString(options.getOptAbbrevLen())); // depends on control dependency: [if], data = [(options.getOptAbbrevLen()]
} else {
cmd.add("--abbrev"); // depends on control dependency: [if], data = [none]
}
}
if (options.isOptNoAbbrev()) {
cmd.add("--no-abbrev"); // depends on control dependency: [if], data = [none]
}
if (options.isOptA()) {
cmd.add("-a"); // depends on control dependency: [if], data = [none]
}
if (options.isOptDLower()) {
cmd.add("-d"); // depends on control dependency: [if], data = [none]
}
if (options.isOptMLower()) {
cmd.add("-m"); // depends on control dependency: [if], data = [none]
}
if (options.isOptDUpper()) {
cmd.add("-D"); // depends on control dependency: [if], data = [none]
}
if (options.isOptMUpper()) {
cmd.add("-M"); // depends on control dependency: [if], data = [none]
}
if (options.isOptColor()) {
cmd.add("--color"); // depends on control dependency: [if], data = [none]
}
if (options.isOptNoColor()) {
cmd.add("--no-color"); // depends on control dependency: [if], data = [none]
}
if (options.isOptF()) {
cmd.add("-f"); // depends on control dependency: [if], data = [none]
}
if (options.isOptL()) {
cmd.add("-l"); // depends on control dependency: [if], data = [none]
}
if (options.isOptMerged()) {
cmd.add("--merged"); // depends on control dependency: [if], data = [none]
}
if (options.isOptNoMerged()) {
cmd.add("--no-merged"); // depends on control dependency: [if], data = [none]
}
if (options.isOptR()) {
cmd.add("-r"); // depends on control dependency: [if], data = [none]
}
if (options.isOptTrack()) {
cmd.add("--track"); // depends on control dependency: [if], data = [none]
}
if (options.isOptNoTrack()) {
cmd.add("--no-track"); // depends on control dependency: [if], data = [none]
}
}
if (null != branchList) {
if ((null != arg1) || (null != arg2)) {
throw new IllegalArgumentException();
}
for (Ref branch : branchList) {
cmd.add(branch.getName()); // depends on control dependency: [for], data = [branch]
}
} else {
if (null != arg1) {
cmd.add(arg1.getName()); // depends on control dependency: [if], data = [none]
}
if (null != arg2) {
cmd.add(arg2.getName()); // depends on control dependency: [if], data = [none]
}
}
return cmd;
} }
|
public class class_name {
public <T> void unregisterService(Class<? super T> serviceInterface) {
Utils.notNull(serviceInterface, "serviceInterface must not be null");
ServiceValidator.validateInterface(serviceInterface, ServiceValidator.TYPE_PUBLISHED);
ServiceInterface svcInterface = serviceInterface.getAnnotation(ServiceInterface.class);
SPFServiceDescriptor svcDesc = ServiceInterface.Convert.toServiceDescriptor(svcInterface);
String token = getAccessToken();
try {
SPFError error = new SPFError();
getService().unregisterService(token, svcDesc, error);
if (!error.isOk()) {
handleError(error);
}
} catch (RemoteException e) {
catchRemoteException(e);
}
} }
|
public class class_name {
public <T> void unregisterService(Class<? super T> serviceInterface) {
Utils.notNull(serviceInterface, "serviceInterface must not be null");
ServiceValidator.validateInterface(serviceInterface, ServiceValidator.TYPE_PUBLISHED);
ServiceInterface svcInterface = serviceInterface.getAnnotation(ServiceInterface.class);
SPFServiceDescriptor svcDesc = ServiceInterface.Convert.toServiceDescriptor(svcInterface);
String token = getAccessToken();
try {
SPFError error = new SPFError();
getService().unregisterService(token, svcDesc, error); // depends on control dependency: [try], data = [none]
if (!error.isOk()) {
handleError(error); // depends on control dependency: [if], data = [none]
}
} catch (RemoteException e) {
catchRemoteException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(Image image, ProtocolMarshaller protocolMarshaller) {
if (image == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(image.getName(), NAME_BINDING);
protocolMarshaller.marshall(image.getArn(), ARN_BINDING);
protocolMarshaller.marshall(image.getBaseImageArn(), BASEIMAGEARN_BINDING);
protocolMarshaller.marshall(image.getDisplayName(), DISPLAYNAME_BINDING);
protocolMarshaller.marshall(image.getState(), STATE_BINDING);
protocolMarshaller.marshall(image.getVisibility(), VISIBILITY_BINDING);
protocolMarshaller.marshall(image.getImageBuilderSupported(), IMAGEBUILDERSUPPORTED_BINDING);
protocolMarshaller.marshall(image.getPlatform(), PLATFORM_BINDING);
protocolMarshaller.marshall(image.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(image.getStateChangeReason(), STATECHANGEREASON_BINDING);
protocolMarshaller.marshall(image.getApplications(), APPLICATIONS_BINDING);
protocolMarshaller.marshall(image.getCreatedTime(), CREATEDTIME_BINDING);
protocolMarshaller.marshall(image.getPublicBaseImageReleasedDate(), PUBLICBASEIMAGERELEASEDDATE_BINDING);
protocolMarshaller.marshall(image.getAppstreamAgentVersion(), APPSTREAMAGENTVERSION_BINDING);
protocolMarshaller.marshall(image.getImagePermissions(), IMAGEPERMISSIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Image image, ProtocolMarshaller protocolMarshaller) {
if (image == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(image.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getBaseImageArn(), BASEIMAGEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getDisplayName(), DISPLAYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getVisibility(), VISIBILITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getImageBuilderSupported(), IMAGEBUILDERSUPPORTED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getPlatform(), PLATFORM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getStateChangeReason(), STATECHANGEREASON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getApplications(), APPLICATIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getCreatedTime(), CREATEDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getPublicBaseImageReleasedDate(), PUBLICBASEIMAGERELEASEDDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getAppstreamAgentVersion(), APPSTREAMAGENTVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(image.getImagePermissions(), IMAGEPERMISSIONS_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 boolean isVersion128() {
String mwversion = "Mediawiki 1.27 or before";
try {
mwversion = this.getVersion();
} catch (Exception e) {
LOGGER.log(Level.INFO,
"Could not retrieve Mediawiki Version via API - will assume "
+ mwversion
+ " you might want to set the Version actively if you are on 1.28 and have the api blocked for non-logged in users");
}
boolean result = mwversion.compareToIgnoreCase("Mediawiki 1.28") >= 0;
return result;
} }
|
public class class_name {
public boolean isVersion128() {
String mwversion = "Mediawiki 1.27 or before";
try {
mwversion = this.getVersion(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.log(Level.INFO,
"Could not retrieve Mediawiki Version via API - will assume "
+ mwversion
+ " you might want to set the Version actively if you are on 1.28 and have the api blocked for non-logged in users");
} // depends on control dependency: [catch], data = [none]
boolean result = mwversion.compareToIgnoreCase("Mediawiki 1.28") >= 0;
return result;
} }
|
public class class_name {
public static void writeCsv(final ResultStream<GraphObject> result, final Writer out, final String propertyView) throws IOException {
final StringBuilder row = new StringBuilder();
boolean headerWritten = false;
for (final GraphObject obj : result) {
// Write column headers
if (!headerWritten) {
row.setLength(0);
for (PropertyKey key : obj.getPropertyKeys(propertyView)) {
row.append("\"").append(key.dbName()).append("\"").append(DEFAULT_FIELD_SEPARATOR);
}
// remove last ;
int pos = row.lastIndexOf("" + DEFAULT_FIELD_SEPARATOR);
if (pos >= 0) {
row.deleteCharAt(pos);
}
// append DOS-style line feed as defined in RFC 4180
out.append(row).append("\r\n");
// flush each line
out.flush();
headerWritten = true;
}
row.setLength(0);
for (PropertyKey key : obj.getPropertyKeys(propertyView)) {
Object value = obj.getProperty(key);
row.append("\"").append((value != null
? escapeForCsv(value)
: "")).append("\"").append(DEFAULT_FIELD_SEPARATOR);
}
// remove last ;
row.deleteCharAt(row.lastIndexOf("" + DEFAULT_FIELD_SEPARATOR));
out.append(row).append("\r\n");
// flush each line
out.flush();
}
} }
|
public class class_name {
public static void writeCsv(final ResultStream<GraphObject> result, final Writer out, final String propertyView) throws IOException {
final StringBuilder row = new StringBuilder();
boolean headerWritten = false;
for (final GraphObject obj : result) {
// Write column headers
if (!headerWritten) {
row.setLength(0); // depends on control dependency: [if], data = [none]
for (PropertyKey key : obj.getPropertyKeys(propertyView)) {
row.append("\"").append(key.dbName()).append("\"").append(DEFAULT_FIELD_SEPARATOR); // depends on control dependency: [for], data = [key]
}
// remove last ;
int pos = row.lastIndexOf("" + DEFAULT_FIELD_SEPARATOR);
if (pos >= 0) {
row.deleteCharAt(pos); // depends on control dependency: [if], data = [(pos]
}
// append DOS-style line feed as defined in RFC 4180
out.append(row).append("\r\n"); // depends on control dependency: [if], data = [none]
// flush each line
out.flush(); // depends on control dependency: [if], data = [none]
headerWritten = true; // depends on control dependency: [if], data = [none]
}
row.setLength(0);
for (PropertyKey key : obj.getPropertyKeys(propertyView)) {
Object value = obj.getProperty(key);
row.append("\"").append((value != null
? escapeForCsv(value)
: "")).append("\"").append(DEFAULT_FIELD_SEPARATOR); // depends on control dependency: [for], data = [none]
}
// remove last ;
row.deleteCharAt(row.lastIndexOf("" + DEFAULT_FIELD_SEPARATOR));
out.append(row).append("\r\n");
// flush each line
out.flush();
}
} }
|
public class class_name {
private void precalculate() {
double par1r = Math.toRadians(this.par1);
double par2r = Math.toRadians(this.par2);
if (Math.abs(par2 - par1) < TOLERANCE) { // single parallel
n = Math.sin(par1r);
} else {
n = (Math.sin(par1r) + Math.sin(par2r)) / 2.0;
}
double c2 = Math.pow(Math.cos(par1r), 2);
C = c2 + 2 * n * Math.sin(par1r);
rho0 = computeRho(lat0);
} }
|
public class class_name {
private void precalculate() {
double par1r = Math.toRadians(this.par1);
double par2r = Math.toRadians(this.par2);
if (Math.abs(par2 - par1) < TOLERANCE) { // single parallel
n = Math.sin(par1r);
// depends on control dependency: [if], data = [none]
} else {
n = (Math.sin(par1r) + Math.sin(par2r)) / 2.0;
// depends on control dependency: [if], data = [none]
}
double c2 = Math.pow(Math.cos(par1r), 2);
C = c2 + 2 * n * Math.sin(par1r);
rho0 = computeRho(lat0);
} }
|
public class class_name {
private Pair<Tree,Tree> copyHelper(Tree node,Map<String,Tree> newNamesToNodes) {
Tree clone;
Tree newFoot = null;
if (node.isLeaf()) {
if (node == foot) { // found the foot node; pass it up.
clone = node.treeFactory().newTreeNode(node.label(),new ArrayList<Tree>(0));
newFoot = clone;
} else {
clone = node.treeFactory().newLeaf(node.label().labelFactory().newLabel(node.label()));
}
} else {
List<Tree> newChildren = new ArrayList<Tree>(node.children().length);
for (Tree child : node.children()) {
Pair<Tree,Tree> newChild = copyHelper(child,newNamesToNodes);
newChildren.add(newChild.first());
if (newChild.second() != null) {
if (newFoot != null) {
System.err.println("Error -- two feet found when copying auxiliary tree " + tree.toString() + "; using last foot found.");
}
newFoot = newChild.second();
}
}
clone = node.treeFactory().newTreeNode(node.label().labelFactory().newLabel(node.label()),newChildren);
if (nodesToNames.containsKey(node)) {
newNamesToNodes.put(nodesToNames.get(node),clone);
}
}
return new Pair<Tree,Tree>(clone,newFoot);
} }
|
public class class_name {
private Pair<Tree,Tree> copyHelper(Tree node,Map<String,Tree> newNamesToNodes) {
Tree clone;
Tree newFoot = null;
if (node.isLeaf()) {
if (node == foot) { // found the foot node; pass it up.
clone = node.treeFactory().newTreeNode(node.label(),new ArrayList<Tree>(0));
// depends on control dependency: [if], data = [(node]
newFoot = clone;
// depends on control dependency: [if], data = [none]
} else {
clone = node.treeFactory().newLeaf(node.label().labelFactory().newLabel(node.label()));
// depends on control dependency: [if], data = [(node]
}
} else {
List<Tree> newChildren = new ArrayList<Tree>(node.children().length);
for (Tree child : node.children()) {
Pair<Tree,Tree> newChild = copyHelper(child,newNamesToNodes);
newChildren.add(newChild.first());
// depends on control dependency: [for], data = [none]
if (newChild.second() != null) {
if (newFoot != null) {
System.err.println("Error -- two feet found when copying auxiliary tree " + tree.toString() + "; using last foot found.");
// depends on control dependency: [if], data = [none]
}
newFoot = newChild.second();
// depends on control dependency: [if], data = [none]
}
}
clone = node.treeFactory().newTreeNode(node.label().labelFactory().newLabel(node.label()),newChildren);
// depends on control dependency: [if], data = [none]
if (nodesToNames.containsKey(node)) {
newNamesToNodes.put(nodesToNames.get(node),clone);
// depends on control dependency: [if], data = [none]
}
}
return new Pair<Tree,Tree>(clone,newFoot);
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.