code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void marshall(ReplicationInstance replicationInstance, ProtocolMarshaller protocolMarshaller) {
if (replicationInstance == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(replicationInstance.getReplicationInstanceIdentifier(), REPLICATIONINSTANCEIDENTIFIER_BINDING);
protocolMarshaller.marshall(replicationInstance.getReplicationInstanceClass(), REPLICATIONINSTANCECLASS_BINDING);
protocolMarshaller.marshall(replicationInstance.getReplicationInstanceStatus(), REPLICATIONINSTANCESTATUS_BINDING);
protocolMarshaller.marshall(replicationInstance.getAllocatedStorage(), ALLOCATEDSTORAGE_BINDING);
protocolMarshaller.marshall(replicationInstance.getInstanceCreateTime(), INSTANCECREATETIME_BINDING);
protocolMarshaller.marshall(replicationInstance.getVpcSecurityGroups(), VPCSECURITYGROUPS_BINDING);
protocolMarshaller.marshall(replicationInstance.getAvailabilityZone(), AVAILABILITYZONE_BINDING);
protocolMarshaller.marshall(replicationInstance.getReplicationSubnetGroup(), REPLICATIONSUBNETGROUP_BINDING);
protocolMarshaller.marshall(replicationInstance.getPreferredMaintenanceWindow(), PREFERREDMAINTENANCEWINDOW_BINDING);
protocolMarshaller.marshall(replicationInstance.getPendingModifiedValues(), PENDINGMODIFIEDVALUES_BINDING);
protocolMarshaller.marshall(replicationInstance.getMultiAZ(), MULTIAZ_BINDING);
protocolMarshaller.marshall(replicationInstance.getEngineVersion(), ENGINEVERSION_BINDING);
protocolMarshaller.marshall(replicationInstance.getAutoMinorVersionUpgrade(), AUTOMINORVERSIONUPGRADE_BINDING);
protocolMarshaller.marshall(replicationInstance.getKmsKeyId(), KMSKEYID_BINDING);
protocolMarshaller.marshall(replicationInstance.getReplicationInstanceArn(), REPLICATIONINSTANCEARN_BINDING);
protocolMarshaller.marshall(replicationInstance.getReplicationInstancePublicIpAddress(), REPLICATIONINSTANCEPUBLICIPADDRESS_BINDING);
protocolMarshaller.marshall(replicationInstance.getReplicationInstancePrivateIpAddress(), REPLICATIONINSTANCEPRIVATEIPADDRESS_BINDING);
protocolMarshaller.marshall(replicationInstance.getReplicationInstancePublicIpAddresses(), REPLICATIONINSTANCEPUBLICIPADDRESSES_BINDING);
protocolMarshaller.marshall(replicationInstance.getReplicationInstancePrivateIpAddresses(), REPLICATIONINSTANCEPRIVATEIPADDRESSES_BINDING);
protocolMarshaller.marshall(replicationInstance.getPubliclyAccessible(), PUBLICLYACCESSIBLE_BINDING);
protocolMarshaller.marshall(replicationInstance.getSecondaryAvailabilityZone(), SECONDARYAVAILABILITYZONE_BINDING);
protocolMarshaller.marshall(replicationInstance.getFreeUntil(), FREEUNTIL_BINDING);
protocolMarshaller.marshall(replicationInstance.getDnsNameServers(), DNSNAMESERVERS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ReplicationInstance replicationInstance, ProtocolMarshaller protocolMarshaller) {
if (replicationInstance == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(replicationInstance.getReplicationInstanceIdentifier(), REPLICATIONINSTANCEIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getReplicationInstanceClass(), REPLICATIONINSTANCECLASS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getReplicationInstanceStatus(), REPLICATIONINSTANCESTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getAllocatedStorage(), ALLOCATEDSTORAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getInstanceCreateTime(), INSTANCECREATETIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getVpcSecurityGroups(), VPCSECURITYGROUPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getAvailabilityZone(), AVAILABILITYZONE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getReplicationSubnetGroup(), REPLICATIONSUBNETGROUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getPreferredMaintenanceWindow(), PREFERREDMAINTENANCEWINDOW_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getPendingModifiedValues(), PENDINGMODIFIEDVALUES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getMultiAZ(), MULTIAZ_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getEngineVersion(), ENGINEVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getAutoMinorVersionUpgrade(), AUTOMINORVERSIONUPGRADE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getKmsKeyId(), KMSKEYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getReplicationInstanceArn(), REPLICATIONINSTANCEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getReplicationInstancePublicIpAddress(), REPLICATIONINSTANCEPUBLICIPADDRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getReplicationInstancePrivateIpAddress(), REPLICATIONINSTANCEPRIVATEIPADDRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getReplicationInstancePublicIpAddresses(), REPLICATIONINSTANCEPUBLICIPADDRESSES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getReplicationInstancePrivateIpAddresses(), REPLICATIONINSTANCEPRIVATEIPADDRESSES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getPubliclyAccessible(), PUBLICLYACCESSIBLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getSecondaryAvailabilityZone(), SECONDARYAVAILABILITYZONE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getFreeUntil(), FREEUNTIL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(replicationInstance.getDnsNameServers(), DNSNAMESERVERS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private DownloadItem buildEsa(ProvisioningFeatureDefinition feature, File outputDir, File installRoot, File licenseRoot, String subsystemLicense) throws IOException {
log("Building ESA for feature " + feature.getSymbolicName(), Project.MSG_VERBOSE);
File outputFile = new File(outputDir, feature.getSymbolicName() + ".esa");
if (outputFile.exists()) {
/*
* If it's already there it means that it has already been generated (possibly with different settings for things like the applies to). As we are changing how we build
* ESAs to go through feature_imports.xml this is guaranteed to happen so just exit.
*/
log(outputFile.getAbsolutePath() + " already exists so skipping ESA generation", Project.MSG_INFO);
return null;
}
int lengthOfInstallRoot = installRoot.getAbsolutePath().length();
Set<String> absPathsForLibertyContent = new HashSet<String>();
Set<String> absPathsForLibertyBundles = new HashSet<String>();
Set<String> absPathsForLibertyLocalizations = new HashSet<String>();
Set<String> absPathsForLibertyIcons = new HashSet<String>();
getFilesForFeature(installRoot, absPathsForLibertyContent, absPathsForLibertyBundles, absPathsForLibertyLocalizations, absPathsForLibertyIcons, feature,
new ContentBasedLocalBundleRepository(installRoot, null, false));
log("Files to include are: " + absPathsForLibertyContent, Project.MSG_VERBOSE);
log("Bundles to include are: " + absPathsForLibertyBundles, Project.MSG_VERBOSE);
log("Localizations to include are: " + absPathsForLibertyLocalizations, Project.MSG_VERBOSE);
log("Creating ESA file: " + outputFile.getAbsolutePath(), Project.MSG_VERBOSE);
ZipOutputStream outputStream = null;
String appliesTo = null;
FileOutputStream tempManifestOutputStream = null;
// Initialize the checksums if we have one
Properties checksumInput = null;
Properties checksumOutput = null;
boolean hasChecksum = false;
File checksumFile = feature.getFeatureChecksumFile();
log("Reading file from: " + checksumFile.getAbsolutePath(), Project.MSG_VERBOSE);
if (checksumFile != null && checksumFile.exists()) {
hasChecksum = true;
checksumInput = new Properties();
FileInputStream checksumInputStream = null;
try {
checksumInputStream = new FileInputStream(checksumFile);
checksumInput.load(checksumInputStream);
} finally {
if (checksumInputStream != null) {
checksumInputStream.close();
}
}
checksumOutput = new Properties();
}
try {
outputStream = new ZipOutputStream(new FileOutputStream(outputFile));
outputStream.putNextEntry(new ZipEntry("OSGI-INF/SUBSYSTEM.MF"));
File manifestFile = feature.getFeatureDefinitionFile();
/*
* We need to modify the manifest to include things like the applies to and license information. This will mess up the generated checksums though so write it to a temp
* file so we can then generate the checksum for it
*/
File tempManifestFile = File.createTempFile(feature.getSymbolicName(), ".mf");
tempManifestOutputStream = new FileOutputStream(tempManifestFile);
// Extract the current manifest contents so that we can add ESA specific headers
StringBuilder manifestBuilder = extract(manifestFile);
/*
* The SUBSYSTEM.MF does not have line length limits (see section 134.2 of the Enterprise OSGi spec) etc so happily add the extra headers we need without worrying about
* length
*/
appliesTo = feature.getHeader("IBM-AppliesTo");
if (appliesTo == null) {
appliesTo = getAppliesTo();
manifestBuilder.append(NEW_LINE);
manifestBuilder.append("IBM-AppliesTo: " + appliesTo);
}
if (feature.getHeader("Subsystem-License") == null) {
manifestBuilder.append(NEW_LINE);
manifestBuilder.append(subsystemLicense);
}
if (feature.getHeader("IBM-License-Agreement") == null) {
manifestBuilder.append(NEW_LINE);
manifestBuilder.append("IBM-License-Agreement: wlp/lafiles/LA");
}
if (!specialFeatureTermsApply() && feature.getHeader("IBM-License-Information") == null) {
manifestBuilder.append(NEW_LINE);
manifestBuilder.append("IBM-License-Information: wlp/lafiles/LI");
}
if (this.productFeature && feature.getHeader("IBM-InstallTo") == null) {
manifestBuilder.append(NEW_LINE);
manifestBuilder.append("IBM-InstallTo: core");
}
// Default the vendor to IBM if it is not set
String vendor = feature.getHeader("Subsystem-Vendor");
if (vendor == null) {
manifestBuilder.append(NEW_LINE);
manifestBuilder.append("Subsystem-Vendor: IBM");
}
// If we have localization files we need a header for it
String subsystemLocalization = feature.getHeader("Subsystem-Localization");
if (!absPathsForLibertyLocalizations.isEmpty() && (subsystemLocalization == null || subsystemLocalization.isEmpty())) {
// Use default
log("The feature " + feature.getSymbolicName() + " has localization files but no subsystem localization header so adding default", Project.MSG_ERR);
subsystemLocalization = "OSGI-INF/l10n/subsystem";
manifestBuilder.append(NEW_LINE);
manifestBuilder.append("Subsystem-Localization: " + subsystemLocalization);
}
// After all ESA headers have been added, write the new manifest to the temporary file
tempManifestOutputStream.write(manifestBuilder.toString().getBytes());
// Finished copying to the temp file, close it and copy to the zip
tempManifestOutputStream.close();
copy(outputStream, tempManifestFile);
outputStream.closeEntry();
// Also add the correct checksum entry
if (hasChecksum) {
String manifestMD5String = MD5Utils.getFileMD5String(tempManifestFile);
checksumOutput.put("OSGI-INF/SUBSYSTEM.MF", manifestMD5String);
}
// All done with the temp manifest so delete it
if (!tempManifestFile.delete()) {
tempManifestFile.deleteOnExit();
}
// Handle normal files, the path matches that in the liberty install
for (String filePath : absPathsForLibertyContent) {
File file = new File(filePath);
if (!file.exists()) {
// This really should not happen but at the time of writing it did for at least one file (see defect 97157).
// As we don't have a validator for invalid manifests this is the only place to catch these errors so fail the
// whole build. All of the errors spotted so far are due to the JavaDoc not being generated so help out the
// build monitor and say this may be a good place to start looking...
throw new BuildException(
"The file "
+ filePath
+ " for feature "
+ feature.getSymbolicName()
+ " is missing.\nAt the time of writting this was always caused by missing JavaDoc bundles where their generation failed due to not having a dependency on the OSGi spec JARs. If the file reported is a JavaDoc file see 97157 for a possible fix.");
}
String pathInWlp = filePath.substring(lengthOfInstallRoot).replaceAll(REGEX_BACKSLASH, "/");
String entryPath = "wlp" + pathInWlp;
outputStream.putNextEntry(new ZipEntry(entryPath));
copy(outputStream, file);
outputStream.closeEntry();
// Write out checksum to the path in ESA
if (hasChecksum) {
// Remove first "/" in path in wlp
String checksumEntry = checksumInput.getProperty(pathInWlp.substring(1));
if (checksumEntry != null && !checksumEntry.isEmpty()) {
checksumOutput.put(entryPath, checksumEntry);
} else {
log("Unable to find checksum entry for file " + pathInWlp, Project.MSG_WARN);
}
}
}
// Bundles all go in the root of the ESAs
for (String filePath : absPathsForLibertyBundles) {
File file = new File(filePath);
if (!file.exists()) {
/*
* This really really should not happen as we resolve bundles to an existing file. Not seen it so far but as above we don't ever validate for this so fail the
* build as a useful validation step to make sure that our manifests are valid
*/
throw new BuildException("The bundle at path " + filePath + " for feature " + feature.getSymbolicName() + " is missing");
}
String entryPath = file.getName();
outputStream.putNextEntry(new ZipEntry(entryPath));
copy(outputStream, file);
outputStream.closeEntry();
// Write out checksum to the path in ESA
if (hasChecksum) {
String pathInWlp = filePath.substring(lengthOfInstallRoot + 1).replaceAll(REGEX_BACKSLASH, "/");
String checksumEntry = checksumInput.getProperty(pathInWlp);
if (checksumEntry != null && !checksumEntry.isEmpty()) {
checksumOutput.put(entryPath, checksumEntry);
} else {
log("Unable to find checksum entry for bundle " + pathInWlp, Project.MSG_WARN);
}
}
}
// Localization files go somewhere determined by a header
for (String filePath : absPathsForLibertyLocalizations) {
// Strip the feature name off the front of the file name so we are left with, for example, _fr.properties
File file = new File(filePath);
String featureName = feature.getSymbolicName();
String fileName = file.getName();
String fileEnding = fileName.startsWith(featureName) ? fileName.substring(featureName.length()) : fileName;
// subsystemLocalization is always set as we fall back to a default above
String entryPath = subsystemLocalization + fileEnding;
outputStream.putNextEntry(new ZipEntry(entryPath));
copy(outputStream, file);
outputStream.closeEntry();
// No checksums for localization files
}
// Always copy in the license files
for (File licenseFile : licenseRoot.listFiles()) {
String entryPath = "wlp/lafiles/" + licenseFile.getName();
outputStream.putNextEntry(new ZipEntry(entryPath));
copy(outputStream, licenseFile);
outputStream.closeEntry();
// No checksums for license files
}
// Add in all of the icons
for (String filePath : absPathsForLibertyIcons) {
// Strip the feature name off the front of the file name so we are left with, for example, OSGI-INF/toolIcon.png
File file = new File(filePath);
String symbolicName = feature.getSymbolicName();
String fileRef = filePath.substring(filePath.lastIndexOf(symbolicName) + symbolicName.length() + 1);
// If we don't do this any path separators will go into the manifest as backslashes on windows
outputStream.putNextEntry(new ZipEntry(fileRef.replace("\\", "/")));
copy(outputStream, file);
outputStream.closeEntry();
}
// If there is a checksum file then include it now
if (hasChecksum) {
String entryPath = "OSGI-INF/checksums.cs";
outputStream.putNextEntry(new ZipEntry(entryPath));
checksumOutput.store(outputStream, null);
outputStream.closeEntry();
}
} finally {
if (outputStream != null) {
outputStream.close();
}
if (tempManifestOutputStream != null) {
tempManifestOutputStream.close();
}
}
// Finally create the download item for the XML file, only need to do this for public features
return getDownloadItem(feature, outputFile, appliesTo);
} } | public class class_name {
private DownloadItem buildEsa(ProvisioningFeatureDefinition feature, File outputDir, File installRoot, File licenseRoot, String subsystemLicense) throws IOException {
log("Building ESA for feature " + feature.getSymbolicName(), Project.MSG_VERBOSE);
File outputFile = new File(outputDir, feature.getSymbolicName() + ".esa");
if (outputFile.exists()) {
/*
* If it's already there it means that it has already been generated (possibly with different settings for things like the applies to). As we are changing how we build
* ESAs to go through feature_imports.xml this is guaranteed to happen so just exit.
*/
log(outputFile.getAbsolutePath() + " already exists so skipping ESA generation", Project.MSG_INFO);
return null;
}
int lengthOfInstallRoot = installRoot.getAbsolutePath().length();
Set<String> absPathsForLibertyContent = new HashSet<String>();
Set<String> absPathsForLibertyBundles = new HashSet<String>();
Set<String> absPathsForLibertyLocalizations = new HashSet<String>();
Set<String> absPathsForLibertyIcons = new HashSet<String>();
getFilesForFeature(installRoot, absPathsForLibertyContent, absPathsForLibertyBundles, absPathsForLibertyLocalizations, absPathsForLibertyIcons, feature,
new ContentBasedLocalBundleRepository(installRoot, null, false));
log("Files to include are: " + absPathsForLibertyContent, Project.MSG_VERBOSE);
log("Bundles to include are: " + absPathsForLibertyBundles, Project.MSG_VERBOSE);
log("Localizations to include are: " + absPathsForLibertyLocalizations, Project.MSG_VERBOSE);
log("Creating ESA file: " + outputFile.getAbsolutePath(), Project.MSG_VERBOSE);
ZipOutputStream outputStream = null;
String appliesTo = null;
FileOutputStream tempManifestOutputStream = null;
// Initialize the checksums if we have one
Properties checksumInput = null;
Properties checksumOutput = null;
boolean hasChecksum = false;
File checksumFile = feature.getFeatureChecksumFile();
log("Reading file from: " + checksumFile.getAbsolutePath(), Project.MSG_VERBOSE);
if (checksumFile != null && checksumFile.exists()) {
hasChecksum = true;
checksumInput = new Properties();
FileInputStream checksumInputStream = null;
try {
checksumInputStream = new FileInputStream(checksumFile); // depends on control dependency: [try], data = [none]
checksumInput.load(checksumInputStream); // depends on control dependency: [try], data = [none]
} finally {
if (checksumInputStream != null) {
checksumInputStream.close(); // depends on control dependency: [if], data = [none]
}
}
checksumOutput = new Properties();
}
try {
outputStream = new ZipOutputStream(new FileOutputStream(outputFile));
outputStream.putNextEntry(new ZipEntry("OSGI-INF/SUBSYSTEM.MF"));
File manifestFile = feature.getFeatureDefinitionFile();
/*
* We need to modify the manifest to include things like the applies to and license information. This will mess up the generated checksums though so write it to a temp
* file so we can then generate the checksum for it
*/
File tempManifestFile = File.createTempFile(feature.getSymbolicName(), ".mf");
tempManifestOutputStream = new FileOutputStream(tempManifestFile);
// Extract the current manifest contents so that we can add ESA specific headers
StringBuilder manifestBuilder = extract(manifestFile);
/*
* The SUBSYSTEM.MF does not have line length limits (see section 134.2 of the Enterprise OSGi spec) etc so happily add the extra headers we need without worrying about
* length
*/
appliesTo = feature.getHeader("IBM-AppliesTo");
if (appliesTo == null) {
appliesTo = getAppliesTo(); // depends on control dependency: [if], data = [none]
manifestBuilder.append(NEW_LINE); // depends on control dependency: [if], data = [none]
manifestBuilder.append("IBM-AppliesTo: " + appliesTo); // depends on control dependency: [if], data = [none]
}
if (feature.getHeader("Subsystem-License") == null) {
manifestBuilder.append(NEW_LINE); // depends on control dependency: [if], data = [none]
manifestBuilder.append(subsystemLicense); // depends on control dependency: [if], data = [none]
}
if (feature.getHeader("IBM-License-Agreement") == null) {
manifestBuilder.append(NEW_LINE); // depends on control dependency: [if], data = [none]
manifestBuilder.append("IBM-License-Agreement: wlp/lafiles/LA"); // depends on control dependency: [if], data = [none]
}
if (!specialFeatureTermsApply() && feature.getHeader("IBM-License-Information") == null) {
manifestBuilder.append(NEW_LINE); // depends on control dependency: [if], data = [none]
manifestBuilder.append("IBM-License-Information: wlp/lafiles/LI"); // depends on control dependency: [if], data = [none]
}
if (this.productFeature && feature.getHeader("IBM-InstallTo") == null) {
manifestBuilder.append(NEW_LINE); // depends on control dependency: [if], data = [none]
manifestBuilder.append("IBM-InstallTo: core"); // depends on control dependency: [if], data = [none]
}
// Default the vendor to IBM if it is not set
String vendor = feature.getHeader("Subsystem-Vendor");
if (vendor == null) {
manifestBuilder.append(NEW_LINE); // depends on control dependency: [if], data = [none]
manifestBuilder.append("Subsystem-Vendor: IBM"); // depends on control dependency: [if], data = [none]
}
// If we have localization files we need a header for it
String subsystemLocalization = feature.getHeader("Subsystem-Localization");
if (!absPathsForLibertyLocalizations.isEmpty() && (subsystemLocalization == null || subsystemLocalization.isEmpty())) {
// Use default
log("The feature " + feature.getSymbolicName() + " has localization files but no subsystem localization header so adding default", Project.MSG_ERR); // depends on control dependency: [if], data = [none]
subsystemLocalization = "OSGI-INF/l10n/subsystem"; // depends on control dependency: [if], data = [none]
manifestBuilder.append(NEW_LINE); // depends on control dependency: [if], data = [none]
manifestBuilder.append("Subsystem-Localization: " + subsystemLocalization); // depends on control dependency: [if], data = [none]
}
// After all ESA headers have been added, write the new manifest to the temporary file
tempManifestOutputStream.write(manifestBuilder.toString().getBytes());
// Finished copying to the temp file, close it and copy to the zip
tempManifestOutputStream.close();
copy(outputStream, tempManifestFile);
outputStream.closeEntry();
// Also add the correct checksum entry
if (hasChecksum) {
String manifestMD5String = MD5Utils.getFileMD5String(tempManifestFile);
checksumOutput.put("OSGI-INF/SUBSYSTEM.MF", manifestMD5String); // depends on control dependency: [if], data = [none]
}
// All done with the temp manifest so delete it
if (!tempManifestFile.delete()) {
tempManifestFile.deleteOnExit(); // depends on control dependency: [if], data = [none]
}
// Handle normal files, the path matches that in the liberty install
for (String filePath : absPathsForLibertyContent) {
File file = new File(filePath);
if (!file.exists()) {
// This really should not happen but at the time of writing it did for at least one file (see defect 97157).
// As we don't have a validator for invalid manifests this is the only place to catch these errors so fail the
// whole build. All of the errors spotted so far are due to the JavaDoc not being generated so help out the
// build monitor and say this may be a good place to start looking...
throw new BuildException(
"The file "
+ filePath
+ " for feature "
+ feature.getSymbolicName()
+ " is missing.\nAt the time of writting this was always caused by missing JavaDoc bundles where their generation failed due to not having a dependency on the OSGi spec JARs. If the file reported is a JavaDoc file see 97157 for a possible fix.");
}
String pathInWlp = filePath.substring(lengthOfInstallRoot).replaceAll(REGEX_BACKSLASH, "/");
String entryPath = "wlp" + pathInWlp;
outputStream.putNextEntry(new ZipEntry(entryPath)); // depends on control dependency: [for], data = [none]
copy(outputStream, file); // depends on control dependency: [for], data = [none]
outputStream.closeEntry(); // depends on control dependency: [for], data = [none]
// Write out checksum to the path in ESA
if (hasChecksum) {
// Remove first "/" in path in wlp
String checksumEntry = checksumInput.getProperty(pathInWlp.substring(1));
if (checksumEntry != null && !checksumEntry.isEmpty()) {
checksumOutput.put(entryPath, checksumEntry); // depends on control dependency: [if], data = [none]
} else {
log("Unable to find checksum entry for file " + pathInWlp, Project.MSG_WARN); // depends on control dependency: [if], data = [none]
}
}
}
// Bundles all go in the root of the ESAs
for (String filePath : absPathsForLibertyBundles) {
File file = new File(filePath);
if (!file.exists()) {
/*
* This really really should not happen as we resolve bundles to an existing file. Not seen it so far but as above we don't ever validate for this so fail the
* build as a useful validation step to make sure that our manifests are valid
*/
throw new BuildException("The bundle at path " + filePath + " for feature " + feature.getSymbolicName() + " is missing");
}
String entryPath = file.getName();
outputStream.putNextEntry(new ZipEntry(entryPath)); // depends on control dependency: [for], data = [none]
copy(outputStream, file); // depends on control dependency: [for], data = [none]
outputStream.closeEntry(); // depends on control dependency: [for], data = [none]
// Write out checksum to the path in ESA
if (hasChecksum) {
String pathInWlp = filePath.substring(lengthOfInstallRoot + 1).replaceAll(REGEX_BACKSLASH, "/");
String checksumEntry = checksumInput.getProperty(pathInWlp);
if (checksumEntry != null && !checksumEntry.isEmpty()) {
checksumOutput.put(entryPath, checksumEntry); // depends on control dependency: [if], data = [none]
} else {
log("Unable to find checksum entry for bundle " + pathInWlp, Project.MSG_WARN); // depends on control dependency: [if], data = [none]
}
}
}
// Localization files go somewhere determined by a header
for (String filePath : absPathsForLibertyLocalizations) {
// Strip the feature name off the front of the file name so we are left with, for example, _fr.properties
File file = new File(filePath);
String featureName = feature.getSymbolicName();
String fileName = file.getName();
String fileEnding = fileName.startsWith(featureName) ? fileName.substring(featureName.length()) : fileName;
// subsystemLocalization is always set as we fall back to a default above
String entryPath = subsystemLocalization + fileEnding;
outputStream.putNextEntry(new ZipEntry(entryPath)); // depends on control dependency: [for], data = [none]
copy(outputStream, file); // depends on control dependency: [for], data = [none]
outputStream.closeEntry(); // depends on control dependency: [for], data = [none]
// No checksums for localization files
}
// Always copy in the license files
for (File licenseFile : licenseRoot.listFiles()) {
String entryPath = "wlp/lafiles/" + licenseFile.getName();
outputStream.putNextEntry(new ZipEntry(entryPath)); // depends on control dependency: [for], data = [none]
copy(outputStream, licenseFile); // depends on control dependency: [for], data = [licenseFile]
outputStream.closeEntry(); // depends on control dependency: [for], data = [none]
// No checksums for license files
}
// Add in all of the icons
for (String filePath : absPathsForLibertyIcons) {
// Strip the feature name off the front of the file name so we are left with, for example, OSGI-INF/toolIcon.png
File file = new File(filePath);
String symbolicName = feature.getSymbolicName();
String fileRef = filePath.substring(filePath.lastIndexOf(symbolicName) + symbolicName.length() + 1);
// If we don't do this any path separators will go into the manifest as backslashes on windows
outputStream.putNextEntry(new ZipEntry(fileRef.replace("\\", "/"))); // depends on control dependency: [for], data = [none]
copy(outputStream, file); // depends on control dependency: [for], data = [none]
outputStream.closeEntry(); // depends on control dependency: [for], data = [none]
}
// If there is a checksum file then include it now
if (hasChecksum) {
String entryPath = "OSGI-INF/checksums.cs";
outputStream.putNextEntry(new ZipEntry(entryPath)); // depends on control dependency: [if], data = [none]
checksumOutput.store(outputStream, null); // depends on control dependency: [if], data = [none]
outputStream.closeEntry(); // depends on control dependency: [if], data = [none]
}
} finally {
if (outputStream != null) {
outputStream.close(); // depends on control dependency: [if], data = [none]
}
if (tempManifestOutputStream != null) {
tempManifestOutputStream.close(); // depends on control dependency: [if], data = [none]
}
}
// Finally create the download item for the XML file, only need to do this for public features
return getDownloadItem(feature, outputFile, appliesTo);
} } |
public class class_name {
public static TableModel fromCSP(CSProperties p, final int dim) {
List<String> dims = keysByMeta(p, "role", "dimension");
if (dims.isEmpty()) {
return null;
}
for (String d : dims) {
if (Integer.parseInt(p.get(d).toString()) == dim) {
final List<String> bounds = keysByMeta(p, "bound", d);
final List<Object> columns = new ArrayList<Object>(bounds.size());
for (String bound : bounds) {
columns.add(Conversions.convert(p.get(bound), double[].class));
}
return new AbstractTableModel() {
@Override
public int getRowCount() {
return dim;
}
@Override
public int getColumnCount() {
return bounds.size();
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return Array.get(columns.get(columnIndex), rowIndex);
}
@Override
public String getColumnName(int column) {
return bounds.get(column);
}
@Override
public Class<?> getColumnClass(int columnIndex) {
return Double.class;
}
};
}
}
return null;
} } | public class class_name {
public static TableModel fromCSP(CSProperties p, final int dim) {
List<String> dims = keysByMeta(p, "role", "dimension");
if (dims.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
for (String d : dims) {
if (Integer.parseInt(p.get(d).toString()) == dim) {
final List<String> bounds = keysByMeta(p, "bound", d);
final List<Object> columns = new ArrayList<Object>(bounds.size());
for (String bound : bounds) {
columns.add(Conversions.convert(p.get(bound), double[].class)); // depends on control dependency: [for], data = [bound]
}
return new AbstractTableModel() {
@Override
public int getRowCount() {
return dim;
}
@Override
public int getColumnCount() {
return bounds.size();
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return Array.get(columns.get(columnIndex), rowIndex);
}
@Override
public String getColumnName(int column) {
return bounds.get(column);
}
@Override
public Class<?> getColumnClass(int columnIndex) {
return Double.class;
}
}; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
public void setMaxInactiveInterval(int time) {
this.maxInactiveTimeSetting = time;
if (time < 0) {
this.maxInactiveTime = NO_TIMEOUT;
} else {
this.maxInactiveTime = (time * 1000L);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "max-inactive time: " + this.maxInactiveTimeSetting);
}
} } | public class class_name {
@Override
public void setMaxInactiveInterval(int time) {
this.maxInactiveTimeSetting = time;
if (time < 0) {
this.maxInactiveTime = NO_TIMEOUT; // depends on control dependency: [if], data = [none]
} else {
this.maxInactiveTime = (time * 1000L); // depends on control dependency: [if], data = [(time]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "max-inactive time: " + this.maxInactiveTimeSetting); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static FieldAnnotation isWrite(Instruction ins, ConstantPoolGen cpg) {
if (ins instanceof PUTFIELD || ins instanceof PUTSTATIC) {
FieldInstruction fins = (FieldInstruction) ins;
String className = fins.getClassName(cpg);
return new FieldAnnotation(className, fins.getName(cpg), fins.getSignature(cpg), fins instanceof PUTSTATIC);
} else {
return null;
}
} } | public class class_name {
public static FieldAnnotation isWrite(Instruction ins, ConstantPoolGen cpg) {
if (ins instanceof PUTFIELD || ins instanceof PUTSTATIC) {
FieldInstruction fins = (FieldInstruction) ins;
String className = fins.getClassName(cpg);
return new FieldAnnotation(className, fins.getName(cpg), fins.getSignature(cpg), fins instanceof PUTSTATIC); // depends on control dependency: [if], data = [ins instanceof PUTSTATIC)]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <T extends JobProperty> T removeProperty(Class<T> clazz) throws IOException {
for (JobProperty<? super JobT> p : properties) {
if (clazz.isInstance(p)) {
removeProperty(p);
return clazz.cast(p);
}
}
return null;
} } | public class class_name {
public <T extends JobProperty> T removeProperty(Class<T> clazz) throws IOException {
for (JobProperty<? super JobT> p : properties) {
if (clazz.isInstance(p)) {
removeProperty(p); // depends on control dependency: [if], data = [none]
return clazz.cast(p); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static void applyOrderBy(MultivaluedMap<String, String> queryParams, Query query) {
List<String> orders = queryParams.get(SORT_PARAM_NAME);
if (orders != null && orders.size() > 0) {
OrderBy orderBy = query.orderBy();
for (String order : orders) {
EbeanUtils.appendOrder(orderBy, order);
}
}
} } | public class class_name {
public static void applyOrderBy(MultivaluedMap<String, String> queryParams, Query query) {
List<String> orders = queryParams.get(SORT_PARAM_NAME);
if (orders != null && orders.size() > 0) {
OrderBy orderBy = query.orderBy();
for (String order : orders) {
EbeanUtils.appendOrder(orderBy, order); // depends on control dependency: [for], data = [order]
}
}
} } |
public class class_name {
public static base_responses update(nitro_service client, nshttpprofile resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nshttpprofile updateresources[] = new nshttpprofile[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new nshttpprofile();
updateresources[i].name = resources[i].name;
updateresources[i].dropinvalreqs = resources[i].dropinvalreqs;
updateresources[i].markhttp09inval = resources[i].markhttp09inval;
updateresources[i].markconnreqinval = resources[i].markconnreqinval;
updateresources[i].cmponpush = resources[i].cmponpush;
updateresources[i].conmultiplex = resources[i].conmultiplex;
updateresources[i].maxreusepool = resources[i].maxreusepool;
updateresources[i].dropextracrlf = resources[i].dropextracrlf;
updateresources[i].incomphdrdelay = resources[i].incomphdrdelay;
updateresources[i].websocket = resources[i].websocket;
updateresources[i].reqtimeout = resources[i].reqtimeout;
updateresources[i].adpttimeout = resources[i].adpttimeout;
updateresources[i].reqtimeoutaction = resources[i].reqtimeoutaction;
updateresources[i].dropextradata = resources[i].dropextradata;
updateresources[i].weblog = resources[i].weblog;
updateresources[i].clientiphdrexpr = resources[i].clientiphdrexpr;
updateresources[i].maxreq = resources[i].maxreq;
updateresources[i].persistentetag = resources[i].persistentetag;
updateresources[i].spdy = resources[i].spdy;
}
result = update_bulk_request(client, updateresources);
}
return result;
} } | public class class_name {
public static base_responses update(nitro_service client, nshttpprofile resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nshttpprofile updateresources[] = new nshttpprofile[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new nshttpprofile(); // depends on control dependency: [for], data = [i]
updateresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i]
updateresources[i].dropinvalreqs = resources[i].dropinvalreqs; // depends on control dependency: [for], data = [i]
updateresources[i].markhttp09inval = resources[i].markhttp09inval; // depends on control dependency: [for], data = [i]
updateresources[i].markconnreqinval = resources[i].markconnreqinval; // depends on control dependency: [for], data = [i]
updateresources[i].cmponpush = resources[i].cmponpush; // depends on control dependency: [for], data = [i]
updateresources[i].conmultiplex = resources[i].conmultiplex; // depends on control dependency: [for], data = [i]
updateresources[i].maxreusepool = resources[i].maxreusepool; // depends on control dependency: [for], data = [i]
updateresources[i].dropextracrlf = resources[i].dropextracrlf; // depends on control dependency: [for], data = [i]
updateresources[i].incomphdrdelay = resources[i].incomphdrdelay; // depends on control dependency: [for], data = [i]
updateresources[i].websocket = resources[i].websocket; // depends on control dependency: [for], data = [i]
updateresources[i].reqtimeout = resources[i].reqtimeout; // depends on control dependency: [for], data = [i]
updateresources[i].adpttimeout = resources[i].adpttimeout; // depends on control dependency: [for], data = [i]
updateresources[i].reqtimeoutaction = resources[i].reqtimeoutaction; // depends on control dependency: [for], data = [i]
updateresources[i].dropextradata = resources[i].dropextradata; // depends on control dependency: [for], data = [i]
updateresources[i].weblog = resources[i].weblog; // depends on control dependency: [for], data = [i]
updateresources[i].clientiphdrexpr = resources[i].clientiphdrexpr; // depends on control dependency: [for], data = [i]
updateresources[i].maxreq = resources[i].maxreq; // depends on control dependency: [for], data = [i]
updateresources[i].persistentetag = resources[i].persistentetag; // depends on control dependency: [for], data = [i]
updateresources[i].spdy = resources[i].spdy; // depends on control dependency: [for], data = [i]
}
result = update_bulk_request(client, updateresources);
}
return result;
} } |
public class class_name {
@Nullable
public static MapLocale getMapLocale(@NonNull Locale locale, boolean acceptFallback) {
MapLocale foundLocale = LOCALE_SET.get(locale);
if (acceptFallback && foundLocale == null) {
foundLocale = getMapLocaleFallback(locale);
}
return foundLocale;
} } | public class class_name {
@Nullable
public static MapLocale getMapLocale(@NonNull Locale locale, boolean acceptFallback) {
MapLocale foundLocale = LOCALE_SET.get(locale);
if (acceptFallback && foundLocale == null) {
foundLocale = getMapLocaleFallback(locale); // depends on control dependency: [if], data = [none]
}
return foundLocale;
} } |
public class class_name {
public ProxySettings setServer(URL url)
{
if (url == null)
{
return this;
}
try
{
return setServer(url.toURI());
}
catch (URISyntaxException e)
{
throw new IllegalArgumentException(e);
}
} } | public class class_name {
public ProxySettings setServer(URL url)
{
if (url == null)
{
return this; // depends on control dependency: [if], data = [none]
}
try
{
return setServer(url.toURI()); // depends on control dependency: [try], data = [none]
}
catch (URISyntaxException e)
{
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(DeregisterPatchBaselineForPatchGroupRequest deregisterPatchBaselineForPatchGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (deregisterPatchBaselineForPatchGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deregisterPatchBaselineForPatchGroupRequest.getBaselineId(), BASELINEID_BINDING);
protocolMarshaller.marshall(deregisterPatchBaselineForPatchGroupRequest.getPatchGroup(), PATCHGROUP_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeregisterPatchBaselineForPatchGroupRequest deregisterPatchBaselineForPatchGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (deregisterPatchBaselineForPatchGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deregisterPatchBaselineForPatchGroupRequest.getBaselineId(), BASELINEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deregisterPatchBaselineForPatchGroupRequest.getPatchGroup(), PATCHGROUP_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int getConfKey(String... args) {
switch (args.length) {
case 0:
printHelp("Missing argument.");
return 1;
case 1:
String varName = args[0].trim();
String propertyName = ENV_VIOLATORS.getOrDefault(varName,
varName.toLowerCase().replace("_", "."));
if (!PropertyKey.isValid(propertyName)) {
printHelp(String.format("%s is not a valid configuration key", propertyName));
return 1;
}
PropertyKey key = PropertyKey.fromString(propertyName);
System.out.println(key.getName());
break;
default:
printHelp("More arguments than expected");
return 1;
}
return 0;
} } | public class class_name {
public static int getConfKey(String... args) {
switch (args.length) {
case 0:
printHelp("Missing argument.");
return 1;
case 1:
String varName = args[0].trim();
String propertyName = ENV_VIOLATORS.getOrDefault(varName,
varName.toLowerCase().replace("_", "."));
if (!PropertyKey.isValid(propertyName)) {
printHelp(String.format("%s is not a valid configuration key", propertyName)); // depends on control dependency: [if], data = [none]
return 1; // depends on control dependency: [if], data = [none]
}
PropertyKey key = PropertyKey.fromString(propertyName);
System.out.println(key.getName());
break;
default:
printHelp("More arguments than expected");
return 1;
}
return 0;
} } |
public class class_name {
public void marshall(BatchAttachToIndex batchAttachToIndex, ProtocolMarshaller protocolMarshaller) {
if (batchAttachToIndex == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchAttachToIndex.getIndexReference(), INDEXREFERENCE_BINDING);
protocolMarshaller.marshall(batchAttachToIndex.getTargetReference(), TARGETREFERENCE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BatchAttachToIndex batchAttachToIndex, ProtocolMarshaller protocolMarshaller) {
if (batchAttachToIndex == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchAttachToIndex.getIndexReference(), INDEXREFERENCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(batchAttachToIndex.getTargetReference(), TARGETREFERENCE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void evaluateRequiredRule(CmmnActivityExecution execution) {
CmmnActivity activity = execution.getActivity();
Object requiredRule = activity.getProperty(PROPERTY_REQUIRED_RULE);
if (requiredRule != null) {
CaseControlRule rule = (CaseControlRule) requiredRule;
boolean required = rule.evaluate(execution);
execution.setRequired(required);
}
} } | public class class_name {
protected void evaluateRequiredRule(CmmnActivityExecution execution) {
CmmnActivity activity = execution.getActivity();
Object requiredRule = activity.getProperty(PROPERTY_REQUIRED_RULE);
if (requiredRule != null) {
CaseControlRule rule = (CaseControlRule) requiredRule;
boolean required = rule.evaluate(execution);
execution.setRequired(required); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ExecutionStepInfo changeTypeWithPreservedNonNull(GraphQLOutputType newType) {
assertTrue(!GraphQLTypeUtil.isNonNull(newType), "newType can't be non null");
if (isNonNullType()) {
return new ExecutionStepInfo(GraphQLNonNull.nonNull(newType), fieldDefinition, field, path, this.parent, arguments, this.fieldContainer);
} else {
return new ExecutionStepInfo(newType, fieldDefinition, field, path, this.parent, arguments, this.fieldContainer);
}
} } | public class class_name {
public ExecutionStepInfo changeTypeWithPreservedNonNull(GraphQLOutputType newType) {
assertTrue(!GraphQLTypeUtil.isNonNull(newType), "newType can't be non null");
if (isNonNullType()) {
return new ExecutionStepInfo(GraphQLNonNull.nonNull(newType), fieldDefinition, field, path, this.parent, arguments, this.fieldContainer); // depends on control dependency: [if], data = [none]
} else {
return new ExecutionStepInfo(newType, fieldDefinition, field, path, this.parent, arguments, this.fieldContainer); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <E> Iterable<E> searchForAll(final Searchable<E> searchable) {
try {
return searchForAll(configureMatcher(searchable).asList());
}
finally {
MatcherHolder.unset();
}
} } | public class class_name {
public <E> Iterable<E> searchForAll(final Searchable<E> searchable) {
try {
return searchForAll(configureMatcher(searchable).asList()); // depends on control dependency: [try], data = [none]
}
finally {
MatcherHolder.unset();
}
} } |
public class class_name {
@SuppressWarnings({"rawtypes", "unchecked"})
public static void reverse(List<?> list) {
int size = list.size();
if (size < REVERSE_THRESHOLD || list instanceof RandomAccess) {
for (int i=0, mid=size>>1, j=size-1; i<mid; i++, j--)
swap(list, i, j);
} else {
// instead of using a raw type here, it's possible to capture
// the wildcard but it will require a call to a supplementary
// private method
ListIterator fwd = list.listIterator();
ListIterator rev = list.listIterator(size);
for (int i=0, mid=list.size()>>1; i<mid; i++) {
Object tmp = fwd.next();
fwd.set(rev.previous());
rev.set(tmp);
}
}
} } | public class class_name {
@SuppressWarnings({"rawtypes", "unchecked"})
public static void reverse(List<?> list) {
int size = list.size();
if (size < REVERSE_THRESHOLD || list instanceof RandomAccess) {
for (int i=0, mid=size>>1, j=size-1; i<mid; i++, j--)
swap(list, i, j);
} else {
// instead of using a raw type here, it's possible to capture
// the wildcard but it will require a call to a supplementary
// private method
ListIterator fwd = list.listIterator();
ListIterator rev = list.listIterator(size);
for (int i=0, mid=list.size()>>1; i<mid; i++) {
Object tmp = fwd.next();
fwd.set(rev.previous()); // depends on control dependency: [for], data = [none]
rev.set(tmp); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
static public Map<String,Object> propertiesToMap(Properties properties)
{
Map<String,Object> map = null;
if (properties != null)
{
map = new Hashtable<String,Object>();
for (Object key : properties.keySet())
{
map.put((String)key, properties.get(key));
}
}
return map;
} } | public class class_name {
static public Map<String,Object> propertiesToMap(Properties properties)
{
Map<String,Object> map = null;
if (properties != null)
{
map = new Hashtable<String,Object>(); // depends on control dependency: [if], data = [none]
for (Object key : properties.keySet())
{
map.put((String)key, properties.get(key)); // depends on control dependency: [for], data = [key]
}
}
return map;
} } |
public class class_name {
public void setDate(Date date) {
dateEditor.setDate(date);
if (getParent() != null) {
getParent().invalidate();
}
} } | public class class_name {
public void setDate(Date date) {
dateEditor.setDate(date);
if (getParent() != null) {
getParent().invalidate(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public CommerceCurrency fetchByG_P_A_Last(long groupId, boolean primary,
boolean active, OrderByComparator<CommerceCurrency> orderByComparator) {
int count = countByG_P_A(groupId, primary, active);
if (count == 0) {
return null;
}
List<CommerceCurrency> list = findByG_P_A(groupId, primary, active,
count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommerceCurrency fetchByG_P_A_Last(long groupId, boolean primary,
boolean active, OrderByComparator<CommerceCurrency> orderByComparator) {
int count = countByG_P_A(groupId, primary, active);
if (count == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<CommerceCurrency> list = findByG_P_A(groupId, primary, active,
count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static Color alphaBlend(Color src, Color dst) {
Color blend;
float srcA = (float) src.getAlpha() / 255.0f;
float dstA = (float) dst.getAlpha() / 255.0f;
float outA = srcA + dstA * (1 - srcA);
if (outA > 0) {
float outR = ((float) src.getRed() * srcA + (float) dst.getRed() * dstA * (1.0f - srcA)) / outA;
float outG = ((float) src.getGreen() * srcA + (float) dst.getGreen() * dstA * (1.0f - srcA)) / outA;
float outB = ((float) src.getBlue() * srcA + (float) dst.getBlue() * dstA * (1.0f - srcA)) / outA;
blend = new Color((int) outR, (int) outG, (int) outB, (int) (outA * 255.0f));
} else {
blend = new Color(0, 0, 0, 0);
}
if ((src instanceof UIResource) || (dst instanceof UIResource)) {
blend = new ColorUIResource(blend);
}
return blend;
} } | public class class_name {
public static Color alphaBlend(Color src, Color dst) {
Color blend;
float srcA = (float) src.getAlpha() / 255.0f;
float dstA = (float) dst.getAlpha() / 255.0f;
float outA = srcA + dstA * (1 - srcA);
if (outA > 0) {
float outR = ((float) src.getRed() * srcA + (float) dst.getRed() * dstA * (1.0f - srcA)) / outA;
float outG = ((float) src.getGreen() * srcA + (float) dst.getGreen() * dstA * (1.0f - srcA)) / outA;
float outB = ((float) src.getBlue() * srcA + (float) dst.getBlue() * dstA * (1.0f - srcA)) / outA;
blend = new Color((int) outR, (int) outG, (int) outB, (int) (outA * 255.0f)); // depends on control dependency: [if], data = [(outA]
} else {
blend = new Color(0, 0, 0, 0); // depends on control dependency: [if], data = [0)]
}
if ((src instanceof UIResource) || (dst instanceof UIResource)) {
blend = new ColorUIResource(blend); // depends on control dependency: [if], data = [none]
}
return blend;
} } |
public class class_name {
public CmsProperty readPropertyObject(
CmsRequestContext context,
CmsResource resource,
String key,
boolean search,
Locale locale)
throws CmsException {
CmsProperty result = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
if (null == locale) {
result = m_driverManager.readPropertyObject(dbc, resource, key, search);
} else {
result = m_driverManager.readPropertyObject(dbc, resource, key, search, locale);
}
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_READ_PROP_FOR_RESOURCE_2, key, context.getSitePath(resource)),
e);
} finally {
dbc.clear();
}
return result;
} } | public class class_name {
public CmsProperty readPropertyObject(
CmsRequestContext context,
CmsResource resource,
String key,
boolean search,
Locale locale)
throws CmsException {
CmsProperty result = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
if (null == locale) {
result = m_driverManager.readPropertyObject(dbc, resource, key, search); // depends on control dependency: [if], data = [none]
} else {
result = m_driverManager.readPropertyObject(dbc, resource, key, search, locale); // depends on control dependency: [if], data = [locale)]
}
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_READ_PROP_FOR_RESOURCE_2, key, context.getSitePath(resource)),
e);
} finally {
dbc.clear();
}
return result;
} } |
public class class_name {
private void handleQueueMemberEvent(QueueMemberEvent event)
{
final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue());
if (queue == null)
{
logger.error("Ignored QueueEntryEvent for unknown queue " + event.getQueue());
return;
}
AsteriskQueueMemberImpl member = queue.getMember(event.getLocation());
if (member == null)
{
member = new AsteriskQueueMemberImpl(server, queue, event.getLocation(), QueueMemberState.valueOf(event
.getStatus()), event.getPaused(), event.getPenalty(), event.getMembership(), event.getCallsTaken(),
event.getLastCall());
queue.addMember(member);
}
else
{
manageQueueMemberChange(queue, member, event);
}
} } | public class class_name {
private void handleQueueMemberEvent(QueueMemberEvent event)
{
final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue());
if (queue == null)
{
logger.error("Ignored QueueEntryEvent for unknown queue " + event.getQueue()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
AsteriskQueueMemberImpl member = queue.getMember(event.getLocation());
if (member == null)
{
member = new AsteriskQueueMemberImpl(server, queue, event.getLocation(), QueueMemberState.valueOf(event
.getStatus()), event.getPaused(), event.getPenalty(), event.getMembership(), event.getCallsTaken(),
event.getLastCall()); // depends on control dependency: [if], data = [none]
queue.addMember(member); // depends on control dependency: [if], data = [(member]
}
else
{
manageQueueMemberChange(queue, member, event); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <K, V> void addMappableCopiesToMap(Collection<Mappable<K, V>> aMappables, Map<K, V> aMap)
{
if (aMappables == null || aMap == null)
return;
Mappable<K, V> mappable = null;
Copier previous = null;
for (Iterator<Mappable<K, V>> i = aMappables.iterator(); i.hasNext();)
{
mappable = i.next();
previous = (Copier) aMap.get(mappable.getKey());
if (previous != null)
{
// copy data
previous.copy((Copier) mappable);
}
else
{
// add to map
aMap.put((K) mappable.getKey(), (V) mappable.getValue());
}
}
} } | public class class_name {
public static <K, V> void addMappableCopiesToMap(Collection<Mappable<K, V>> aMappables, Map<K, V> aMap)
{
if (aMappables == null || aMap == null)
return;
Mappable<K, V> mappable = null;
Copier previous = null;
for (Iterator<Mappable<K, V>> i = aMappables.iterator(); i.hasNext();)
{
mappable = i.next();
// depends on control dependency: [for], data = [i]
previous = (Copier) aMap.get(mappable.getKey());
// depends on control dependency: [for], data = [none]
if (previous != null)
{
// copy data
previous.copy((Copier) mappable);
// depends on control dependency: [if], data = [none]
}
else
{
// add to map
aMap.put((K) mappable.getKey(), (V) mappable.getValue());
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static void tryAddNamedPropertyChangeListenerUnchecked(
Object target, String propertyName,
PropertyChangeListener propertyChangeListener)
{
Objects.requireNonNull(target, "The target may not be null");
Objects.requireNonNull(propertyName,
"The propertyName may not be null");
Objects.requireNonNull(propertyChangeListener,
"The propertyChangeListener may not be null");
if (maintainsNamedPropertyChangeListeners(target.getClass()))
{
PropertyChangeUtils.addNamedPropertyChangeListenerUnchecked(
target, propertyName, propertyChangeListener);
}
} } | public class class_name {
public static void tryAddNamedPropertyChangeListenerUnchecked(
Object target, String propertyName,
PropertyChangeListener propertyChangeListener)
{
Objects.requireNonNull(target, "The target may not be null");
Objects.requireNonNull(propertyName,
"The propertyName may not be null");
Objects.requireNonNull(propertyChangeListener,
"The propertyChangeListener may not be null");
if (maintainsNamedPropertyChangeListeners(target.getClass()))
{
PropertyChangeUtils.addNamedPropertyChangeListenerUnchecked(
target, propertyName, propertyChangeListener);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void disableTwoPhaseIterator() {
super.disableTwoPhaseIterator();
for (MtasSpanSequenceItem item : items) {
item.getQuery().disableTwoPhaseIterator();
}
if (ignoreQuery != null) {
ignoreQuery.disableTwoPhaseIterator();
}
} } | public class class_name {
@Override
public void disableTwoPhaseIterator() {
super.disableTwoPhaseIterator();
for (MtasSpanSequenceItem item : items) {
item.getQuery().disableTwoPhaseIterator(); // depends on control dependency: [for], data = [item]
}
if (ignoreQuery != null) {
ignoreQuery.disableTwoPhaseIterator(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <T> List<T> mergeListNoDuplicate(List<T> one, List<T> two) {
if (isAllNull(one, two)) return null;
List<T> result = new ArrayList<>();
if (isAllNotNull(one, two)) {
result.addAll(one);
for (T t : two) {
if (one.indexOf(t) == -1) {
result.add(t);
}
}
} else {
result.addAll(findFirstNotNull(one, two));
}
return result;
} } | public class class_name {
public static <T> List<T> mergeListNoDuplicate(List<T> one, List<T> two) {
if (isAllNull(one, two)) return null;
List<T> result = new ArrayList<>();
if (isAllNotNull(one, two)) {
result.addAll(one); // depends on control dependency: [if], data = [none]
for (T t : two) {
if (one.indexOf(t) == -1) {
result.add(t); // depends on control dependency: [if], data = [none]
}
}
} else {
result.addAll(findFirstNotNull(one, two)); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public byte[] update(byte[] input){
if(!cfg){
throw new RuntimeException("Cipher not configured.");//TODO
}
if(input.length == 0)
return new byte[]{};//null;
if(bufferIndex != 0){
byte[] in2 = Arrays.copyOf(buffer, input.length + bufferIndex);//new byte[input.length + bufferIndex];
//System.out.println(Misc.bytesToHex(in2));
//System.arraycopy(buffer, 0, in2, 0, bufferIndex);
System.arraycopy(input, 0, in2, bufferIndex, input.length);
input = in2;
}
int numBlocks = (int) Math.floor(input.length/blockSize);
//System.out.println(numBlocks);
byte[] out = new byte[blockSize * numBlocks];
for(int i = 0; i < numBlocks; i++){
//System.out.println("i:"+i+" block:" + blockNo);
System.arraycopy(input, blockSize*i, buffer, 0, blockSize);
System.arraycopy(cryptBlock(), 0, out, i * blockSize, blockSize);
blockNo++;
}
buffer = new byte[blockSize];
if(input.length % blockSize == 0){
bufferIndex = 0;
}else{
//buffer = new byte[BLOCKSIZE];
System.arraycopy(input, numBlocks*blockSize, buffer, 0, input.length - numBlocks*blockSize);
bufferIndex = input.length - numBlocks*blockSize;
}
//System.out.println(Misc.bytesToHex(out));
return out;
} } | public class class_name {
public byte[] update(byte[] input){
if(!cfg){
throw new RuntimeException("Cipher not configured.");//TODO
}
if(input.length == 0)
return new byte[]{};//null;
if(bufferIndex != 0){
byte[] in2 = Arrays.copyOf(buffer, input.length + bufferIndex);//new byte[input.length + bufferIndex];
//System.out.println(Misc.bytesToHex(in2));
//System.arraycopy(buffer, 0, in2, 0, bufferIndex);
System.arraycopy(input, 0, in2, bufferIndex, input.length); // depends on control dependency: [if], data = [none]
input = in2; // depends on control dependency: [if], data = [none]
}
int numBlocks = (int) Math.floor(input.length/blockSize);
//System.out.println(numBlocks);
byte[] out = new byte[blockSize * numBlocks];
for(int i = 0; i < numBlocks; i++){
//System.out.println("i:"+i+" block:" + blockNo);
System.arraycopy(input, blockSize*i, buffer, 0, blockSize); // depends on control dependency: [for], data = [i]
System.arraycopy(cryptBlock(), 0, out, i * blockSize, blockSize); // depends on control dependency: [for], data = [i]
blockNo++; // depends on control dependency: [for], data = [none]
}
buffer = new byte[blockSize];
if(input.length % blockSize == 0){
bufferIndex = 0; // depends on control dependency: [if], data = [none]
}else{
//buffer = new byte[BLOCKSIZE];
System.arraycopy(input, numBlocks*blockSize, buffer, 0, input.length - numBlocks*blockSize); // depends on control dependency: [if], data = [none]
bufferIndex = input.length - numBlocks*blockSize; // depends on control dependency: [if], data = [none]
}
//System.out.println(Misc.bytesToHex(out));
return out;
} } |
public class class_name {
public void keyPressed(KeyEvent k) {
// System.out.println("Key pressed: " + k.getKeyCode());
if (k.getKeyCode() == KeyEvent.VK_ENTER) {
finishCreate();
} else if (k.getKeyCode() == KeyEvent.VK_ESCAPE) {
dispose();
}
} } | public class class_name {
public void keyPressed(KeyEvent k) {
// System.out.println("Key pressed: " + k.getKeyCode());
if (k.getKeyCode() == KeyEvent.VK_ENTER) {
finishCreate(); // depends on control dependency: [if], data = [none]
} else if (k.getKeyCode() == KeyEvent.VK_ESCAPE) {
dispose(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(OverallVolume overallVolume, ProtocolMarshaller protocolMarshaller) {
if (overallVolume == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(overallVolume.getVolumeStatistics(), VOLUMESTATISTICS_BINDING);
protocolMarshaller.marshall(overallVolume.getReadRatePercent(), READRATEPERCENT_BINDING);
protocolMarshaller.marshall(overallVolume.getDomainIspPlacements(), DOMAINISPPLACEMENTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(OverallVolume overallVolume, ProtocolMarshaller protocolMarshaller) {
if (overallVolume == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(overallVolume.getVolumeStatistics(), VOLUMESTATISTICS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(overallVolume.getReadRatePercent(), READRATEPERCENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(overallVolume.getDomainIspPlacements(), DOMAINISPPLACEMENTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String join(String... values) {
if (values == null || values.length == 0) {
return null;
}
StringBuilder sb = new StringBuilder();
for (String value : values) {
sb.append(',').append(value);
}
return sb.substring(1);
} } | public class class_name {
public static String join(String... values) {
if (values == null || values.length == 0) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
for (String value : values) {
sb.append(',').append(value); // depends on control dependency: [for], data = [value]
}
return sb.substring(1);
} } |
public class class_name {
boolean handleCommonMethods(Object delegate, Method method, Object[] args) throws Throwable {
if ("abort".equals(method.getName()) || "close".equals(method.getName())) {
try {
Reflection.invoke(delegate, method, args);
return true;
} finally {
closed = true;
afterClosure();
interruptWaiters();
}
} else if ("addShutdownListener".equals(method.getName()) && args[0] != null)
shutdownListeners.add((ShutdownListener) args[0]);
else if ("removeShutdownListener".equals(method.getName()) && args[0] != null)
shutdownListeners.remove((ShutdownListener) args[0]);
return false;
} } | public class class_name {
boolean handleCommonMethods(Object delegate, Method method, Object[] args) throws Throwable {
if ("abort".equals(method.getName()) || "close".equals(method.getName())) {
try {
Reflection.invoke(delegate, method, args); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} finally {
closed = true;
afterClosure();
interruptWaiters();
}
} else if ("addShutdownListener".equals(method.getName()) && args[0] != null)
shutdownListeners.add((ShutdownListener) args[0]);
else if ("removeShutdownListener".equals(method.getName()) && args[0] != null)
shutdownListeners.remove((ShutdownListener) args[0]);
return false;
} } |
public class class_name {
public static Mode getUMask(@Nullable String confUmask) {
int umask = Constants.DEFAULT_FILE_SYSTEM_UMASK;
if (confUmask != null) {
if ((confUmask.length() > 4) || !isValid(confUmask)) {
throw new IllegalArgumentException(ExceptionMessage.INVALID_CONFIGURATION_VALUE
.getMessage(confUmask, PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK));
}
int newUmask = 0;
int lastIndex = confUmask.length() - 1;
for (int i = 0; i <= lastIndex; i++) {
newUmask += (confUmask.charAt(i) - '0') << 3 * (lastIndex - i);
}
umask = newUmask;
}
return new Mode((short) umask);
} } | public class class_name {
public static Mode getUMask(@Nullable String confUmask) {
int umask = Constants.DEFAULT_FILE_SYSTEM_UMASK;
if (confUmask != null) {
if ((confUmask.length() > 4) || !isValid(confUmask)) {
throw new IllegalArgumentException(ExceptionMessage.INVALID_CONFIGURATION_VALUE
.getMessage(confUmask, PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK));
}
int newUmask = 0;
int lastIndex = confUmask.length() - 1;
for (int i = 0; i <= lastIndex; i++) {
newUmask += (confUmask.charAt(i) - '0') << 3 * (lastIndex - i); // depends on control dependency: [for], data = [i]
}
umask = newUmask; // depends on control dependency: [if], data = [none]
}
return new Mode((short) umask);
} } |
public class class_name {
public void errorFuture(UUID taskId, Exception e) {
DistributedFuture<GROUP, Serializable> future = remove(taskId);
if(future != null) {
future.setException(e);
}
} } | public class class_name {
public void errorFuture(UUID taskId, Exception e) {
DistributedFuture<GROUP, Serializable> future = remove(taskId);
if(future != null) {
future.setException(e); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static TernaryValue tryStrictEqualityComparison(Node left, Node right) {
// First, try to evaluate based on the general type.
ValueType leftValueType = NodeUtil.getKnownValueType(left);
ValueType rightValueType = NodeUtil.getKnownValueType(right);
if (leftValueType != ValueType.UNDETERMINED && rightValueType != ValueType.UNDETERMINED) {
// Strict equality can only be true for values of the same type.
if (leftValueType != rightValueType) {
return TernaryValue.FALSE;
}
switch (leftValueType) {
case VOID:
case NULL:
return TernaryValue.TRUE;
case NUMBER: {
if (NodeUtil.isNaN(left)) {
return TernaryValue.FALSE;
}
if (NodeUtil.isNaN(right)) {
return TernaryValue.FALSE;
}
Double lv = NodeUtil.getNumberValue(left);
Double rv = NodeUtil.getNumberValue(right);
if (lv != null && rv != null) {
return TernaryValue.forBoolean(lv.doubleValue() == rv.doubleValue());
}
break;
}
case STRING: {
String lv = NodeUtil.getStringValue(left);
String rv = NodeUtil.getStringValue(right);
if (lv != null && rv != null) {
// In JS, browsers parse \v differently. So do not consider strings
// equal if one contains \v.
if (lv.indexOf('\u000B') != -1 || rv.indexOf('\u000B') != -1) {
return TernaryValue.UNKNOWN;
} else {
return lv.equals(rv) ? TernaryValue.TRUE : TernaryValue.FALSE;
}
} else if (left.isTypeOf() && right.isTypeOf()
&& left.getFirstChild().isName() && right.getFirstChild().isName()
&& left.getFirstChild().getString().equals(right.getFirstChild().getString())) {
// Special case, typeof a == typeof a is always true.
return TernaryValue.TRUE;
}
break;
}
case BOOLEAN: {
TernaryValue lv = NodeUtil.getPureBooleanValue(left);
TernaryValue rv = NodeUtil.getPureBooleanValue(right);
return lv.and(rv).or(lv.not().and(rv.not()));
}
default: // Symbol and Object cannot be folded in the general case.
return TernaryValue.UNKNOWN;
}
}
// Then, try to evaluate based on the value of the node. There's only one special case:
// Any strict equality comparison against NaN returns false.
if (NodeUtil.isNaN(left) || NodeUtil.isNaN(right)) {
return TernaryValue.FALSE;
}
return TernaryValue.UNKNOWN;
} } | public class class_name {
private static TernaryValue tryStrictEqualityComparison(Node left, Node right) {
// First, try to evaluate based on the general type.
ValueType leftValueType = NodeUtil.getKnownValueType(left);
ValueType rightValueType = NodeUtil.getKnownValueType(right);
if (leftValueType != ValueType.UNDETERMINED && rightValueType != ValueType.UNDETERMINED) {
// Strict equality can only be true for values of the same type.
if (leftValueType != rightValueType) {
return TernaryValue.FALSE; // depends on control dependency: [if], data = [none]
}
switch (leftValueType) {
case VOID:
case NULL:
return TernaryValue.TRUE;
case NUMBER: {
if (NodeUtil.isNaN(left)) {
return TernaryValue.FALSE; // depends on control dependency: [if], data = [none]
}
if (NodeUtil.isNaN(right)) {
return TernaryValue.FALSE; // depends on control dependency: [if], data = [none]
}
Double lv = NodeUtil.getNumberValue(left);
Double rv = NodeUtil.getNumberValue(right);
if (lv != null && rv != null) {
return TernaryValue.forBoolean(lv.doubleValue() == rv.doubleValue()); // depends on control dependency: [if], data = [(lv]
}
break;
}
case STRING: {
String lv = NodeUtil.getStringValue(left);
String rv = NodeUtil.getStringValue(right);
if (lv != null && rv != null) {
// In JS, browsers parse \v differently. So do not consider strings
// equal if one contains \v.
if (lv.indexOf('\u000B') != -1 || rv.indexOf('\u000B') != -1) {
return TernaryValue.UNKNOWN; // depends on control dependency: [if], data = [none]
} else {
return lv.equals(rv) ? TernaryValue.TRUE : TernaryValue.FALSE; // depends on control dependency: [if], data = [none]
}
} else if (left.isTypeOf() && right.isTypeOf()
&& left.getFirstChild().isName() && right.getFirstChild().isName()
&& left.getFirstChild().getString().equals(right.getFirstChild().getString())) {
// Special case, typeof a == typeof a is always true.
return TernaryValue.TRUE; // depends on control dependency: [if], data = [none]
}
break;
}
case BOOLEAN: {
TernaryValue lv = NodeUtil.getPureBooleanValue(left);
TernaryValue rv = NodeUtil.getPureBooleanValue(right);
return lv.and(rv).or(lv.not().and(rv.not()));
}
default: // Symbol and Object cannot be folded in the general case.
return TernaryValue.UNKNOWN;
}
}
// Then, try to evaluate based on the value of the node. There's only one special case:
// Any strict equality comparison against NaN returns false.
if (NodeUtil.isNaN(left) || NodeUtil.isNaN(right)) {
return TernaryValue.FALSE;
}
return TernaryValue.UNKNOWN;
} } |
public class class_name {
public static boolean matchRegexOrEquals(final String inputSelector, final String item) {
//see if inputSelector is wrapped in '/' chars
String testregex = inputSelector;
if (testregex.length()>=2 && testregex.indexOf('/') == 0 && testregex.lastIndexOf('/') == testregex.length() - 1) {
testregex = inputSelector.substring(1, inputSelector.length() - 1);
return item.matches(testregex.trim());
}
boolean match = false;
try {
match = item.matches(inputSelector.trim());
} catch (PatternSyntaxException e) {
}
return match || inputSelector.trim().equals(item);
} } | public class class_name {
public static boolean matchRegexOrEquals(final String inputSelector, final String item) {
//see if inputSelector is wrapped in '/' chars
String testregex = inputSelector;
if (testregex.length()>=2 && testregex.indexOf('/') == 0 && testregex.lastIndexOf('/') == testregex.length() - 1) {
testregex = inputSelector.substring(1, inputSelector.length() - 1); // depends on control dependency: [if], data = [none]
return item.matches(testregex.trim()); // depends on control dependency: [if], data = [none]
}
boolean match = false;
try {
match = item.matches(inputSelector.trim()); // depends on control dependency: [try], data = [none]
} catch (PatternSyntaxException e) {
} // depends on control dependency: [catch], data = [none]
return match || inputSelector.trim().equals(item);
} } |
public class class_name {
public static List<SoyValueProvider> concatLists(List<SoyList> args) {
ImmutableList.Builder<SoyValueProvider> flattened = ImmutableList.builder();
for (SoyList soyList : args) {
flattened.addAll(soyList.asJavaList());
}
return flattened.build();
} } | public class class_name {
public static List<SoyValueProvider> concatLists(List<SoyList> args) {
ImmutableList.Builder<SoyValueProvider> flattened = ImmutableList.builder();
for (SoyList soyList : args) {
flattened.addAll(soyList.asJavaList()); // depends on control dependency: [for], data = [soyList]
}
return flattened.build();
} } |
public class class_name {
static private Properties loadPropertiesFile(
final String resourceName,
Properties defaults)
throws IOException
{
// This static method should eventually be moved to a thread-specific class
// so that we can cache the ContextClassLoader and bottleneck all properties file
// loading throughout Xalan.
Properties props = new Properties(defaults);
InputStream is = null;
BufferedInputStream bis = null;
try
{
if (ACCESS_CONTROLLER_CLASS != null)
{
is = (InputStream) AccessController
.doPrivileged(new PrivilegedAction() {
public Object run()
{
return OutputPropertiesFactory.class
.getResourceAsStream(resourceName);
}
});
}
else
{
// User may be using older JDK ( JDK < 1.2 )
is = OutputPropertiesFactory.class
.getResourceAsStream(resourceName);
}
// j2objc: resource wasn't found, load defaults from string.
if (is == null) {
if (resourceName.equals(PROP_FILE_HTML)) {
is = new ByteArrayInputStream(
PROP_FILE_HTML_STR.getBytes(StandardCharsets.UTF_8));
}
if (resourceName.equals(PROP_FILE_TEXT)) {
is = new ByteArrayInputStream(
PROP_FILE_TEXT_STR.getBytes(StandardCharsets.UTF_8));
}
if (resourceName.equals(PROP_FILE_XML)) {
is = new ByteArrayInputStream(
PROP_FILE_XML_STR.getBytes(StandardCharsets.UTF_8));
}
if (resourceName.equals(PROP_FILE_UNKNOWN)) {
is = new ByteArrayInputStream(
PROP_FILE_UNKNOWN_STR.getBytes(StandardCharsets.UTF_8));
}
}
bis = new BufferedInputStream(is);
props.load(bis);
}
catch (IOException ioe)
{
if (defaults == null)
{
throw ioe;
}
else
{
throw new WrappedRuntimeException(
Utils.messages.createMessage(
MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
new Object[] { resourceName }),
ioe);
//"Could not load '"+resourceName+"' (check CLASSPATH), now using just the defaults ", ioe);
}
}
catch (SecurityException se)
{
// Repeat IOException handling for sandbox/applet case -sc
if (defaults == null)
{
throw se;
}
else
{
throw new WrappedRuntimeException(
Utils.messages.createMessage(
MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
new Object[] { resourceName }),
se);
//"Could not load '"+resourceName+"' (check CLASSPATH, applet security), now using just the defaults ", se);
}
}
finally
{
if (bis != null)
{
bis.close();
}
if (is != null)
{
is.close();
}
}
// Note that we're working at the HashTable level here,
// and not at the Properties level! This is important
// because we don't want to modify the default properties.
// NB: If fixupPropertyString ends up changing the property
// name or value, we need to remove the old key and re-add
// with the new key and value. However, then our Enumeration
// could lose its place in the HashTable. So, we first
// clone the HashTable and enumerate over that since the
// clone will not change. When we migrate to Collections,
// this code should be revisited and cleaned up to use
// an Iterator which may (or may not) alleviate the need for
// the clone. Many thanks to Padraig O'hIceadha
// <padraig@gradient.ie> for finding this problem. Bugzilla 2000.
Enumeration keys = ((Properties) props.clone()).keys();
while (keys.hasMoreElements())
{
String key = (String) keys.nextElement();
// Now check if the given key was specified as a
// System property. If so, the system property
// overides the default value in the propery file.
String value = null;
try
{
value = System.getProperty(key);
}
catch (SecurityException se)
{
// No-op for sandbox/applet case, leave null -sc
}
if (value == null)
value = (String) props.get(key);
String newKey = fixupPropertyString(key, true);
String newValue = null;
try
{
newValue = System.getProperty(newKey);
}
catch (SecurityException se)
{
// No-op for sandbox/applet case, leave null -sc
}
if (newValue == null)
newValue = fixupPropertyString(value, false);
else
newValue = fixupPropertyString(newValue, false);
if (key != newKey || value != newValue)
{
props.remove(key);
props.put(newKey, newValue);
}
}
return props;
} } | public class class_name {
static private Properties loadPropertiesFile(
final String resourceName,
Properties defaults)
throws IOException
{
// This static method should eventually be moved to a thread-specific class
// so that we can cache the ContextClassLoader and bottleneck all properties file
// loading throughout Xalan.
Properties props = new Properties(defaults);
InputStream is = null;
BufferedInputStream bis = null;
try
{
if (ACCESS_CONTROLLER_CLASS != null)
{
is = (InputStream) AccessController
.doPrivileged(new PrivilegedAction() {
public Object run()
{
return OutputPropertiesFactory.class
.getResourceAsStream(resourceName);
}
}); // depends on control dependency: [if], data = [none]
}
else
{
// User may be using older JDK ( JDK < 1.2 )
is = OutputPropertiesFactory.class
.getResourceAsStream(resourceName); // depends on control dependency: [if], data = [none]
}
// j2objc: resource wasn't found, load defaults from string.
if (is == null) {
if (resourceName.equals(PROP_FILE_HTML)) {
is = new ByteArrayInputStream(
PROP_FILE_HTML_STR.getBytes(StandardCharsets.UTF_8)); // depends on control dependency: [if], data = [none]
}
if (resourceName.equals(PROP_FILE_TEXT)) {
is = new ByteArrayInputStream(
PROP_FILE_TEXT_STR.getBytes(StandardCharsets.UTF_8)); // depends on control dependency: [if], data = [none]
}
if (resourceName.equals(PROP_FILE_XML)) {
is = new ByteArrayInputStream(
PROP_FILE_XML_STR.getBytes(StandardCharsets.UTF_8)); // depends on control dependency: [if], data = [none]
}
if (resourceName.equals(PROP_FILE_UNKNOWN)) {
is = new ByteArrayInputStream(
PROP_FILE_UNKNOWN_STR.getBytes(StandardCharsets.UTF_8)); // depends on control dependency: [if], data = [none]
}
}
bis = new BufferedInputStream(is);
props.load(bis);
}
catch (IOException ioe)
{
if (defaults == null)
{
throw ioe;
}
else
{
throw new WrappedRuntimeException(
Utils.messages.createMessage(
MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
new Object[] { resourceName }),
ioe);
//"Could not load '"+resourceName+"' (check CLASSPATH), now using just the defaults ", ioe);
}
}
catch (SecurityException se)
{
// Repeat IOException handling for sandbox/applet case -sc
if (defaults == null)
{
throw se;
}
else
{
throw new WrappedRuntimeException(
Utils.messages.createMessage(
MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
new Object[] { resourceName }),
se);
//"Could not load '"+resourceName+"' (check CLASSPATH, applet security), now using just the defaults ", se);
}
}
finally
{
if (bis != null)
{
bis.close(); // depends on control dependency: [if], data = [none]
}
if (is != null)
{
is.close(); // depends on control dependency: [if], data = [none]
}
}
// Note that we're working at the HashTable level here,
// and not at the Properties level! This is important
// because we don't want to modify the default properties.
// NB: If fixupPropertyString ends up changing the property
// name or value, we need to remove the old key and re-add
// with the new key and value. However, then our Enumeration
// could lose its place in the HashTable. So, we first
// clone the HashTable and enumerate over that since the
// clone will not change. When we migrate to Collections,
// this code should be revisited and cleaned up to use
// an Iterator which may (or may not) alleviate the need for
// the clone. Many thanks to Padraig O'hIceadha
// <padraig@gradient.ie> for finding this problem. Bugzilla 2000.
Enumeration keys = ((Properties) props.clone()).keys();
while (keys.hasMoreElements())
{
String key = (String) keys.nextElement();
// Now check if the given key was specified as a
// System property. If so, the system property
// overides the default value in the propery file.
String value = null;
try
{
value = System.getProperty(key);
}
catch (SecurityException se)
{
// No-op for sandbox/applet case, leave null -sc
}
if (value == null)
value = (String) props.get(key);
String newKey = fixupPropertyString(key, true);
String newValue = null;
try
{
newValue = System.getProperty(newKey);
}
catch (SecurityException se)
{
// No-op for sandbox/applet case, leave null -sc
}
if (newValue == null)
newValue = fixupPropertyString(value, false);
else
newValue = fixupPropertyString(newValue, false);
if (key != newKey || value != newValue)
{
props.remove(key);
props.put(newKey, newValue);
}
}
return props;
} } |
public class class_name {
public void put(String key, byte[] value) {
if (this.compiledStatement != null) {
if (value == null) {
this.compiledStatement.bindNull(compiledStatementBindIndex++);
} else {
compiledStatement.bindBlob(compiledStatementBindIndex++, value);
}
} else if (values != null) {
values.put(key, value);
return;
}
names.add(key);
// values.put(key, value);
args.add(value);
valueType.add(ParamType.BYTE_ARRAY);
} } | public class class_name {
public void put(String key, byte[] value) {
if (this.compiledStatement != null) {
if (value == null) {
this.compiledStatement.bindNull(compiledStatementBindIndex++); // depends on control dependency: [if], data = [none]
} else {
compiledStatement.bindBlob(compiledStatementBindIndex++, value); // depends on control dependency: [if], data = [none]
}
} else if (values != null) {
values.put(key, value); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
names.add(key);
// values.put(key, value);
args.add(value);
valueType.add(ParamType.BYTE_ARRAY);
} } |
public class class_name {
private static String unescapeString(String str){
if(str.startsWith("\"") && str.endsWith("\"")){
String s = str.replaceAll("\\\\\"", "\"");
return s.substring(1, s.length() -1);
}
return null;
} } | public class class_name {
private static String unescapeString(String str){
if(str.startsWith("\"") && str.endsWith("\"")){
String s = str.replaceAll("\\\\\"", "\"");
return s.substring(1, s.length() -1); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public boolean containsSymbol(char[] buffer, int offset, int length) {
// search for identical symbol
int bucket = hash(buffer, offset, length) % fTableSize;
OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
if (length == entry.characters.length) {
for (int i = 0; i < length; i++) {
if (buffer[offset + i] != entry.characters[i]) {
continue OUTER;
}
}
return true;
}
}
return false;
} } | public class class_name {
public boolean containsSymbol(char[] buffer, int offset, int length) {
// search for identical symbol
int bucket = hash(buffer, offset, length) % fTableSize;
OUTER: for (Entry entry = fBuckets[bucket]; entry != null; entry = entry.next) {
if (length == entry.characters.length) {
for (int i = 0; i < length; i++) {
if (buffer[offset + i] != entry.characters[i]) {
continue OUTER;
}
}
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@Override
public int getMaxFractionalDigitsForTimestamp() {
if (getConnection() == null) {
// if no connection is there we cannot do anything...
Scope.getCurrentScope().getLog(getClass()).warning(
LogType.LOG, "No database connection available - specified"
+ " DATETIME/TIMESTAMP precision will be tried");
return DEFAULT_MAX_TIMESTAMP_FRACTIONAL_DIGITS;
}
return DEFAULT_MAX_TIMESTAMP_FRACTIONAL_DIGITS;
} } | public class class_name {
@Override
public int getMaxFractionalDigitsForTimestamp() {
if (getConnection() == null) {
// if no connection is there we cannot do anything...
Scope.getCurrentScope().getLog(getClass()).warning(
LogType.LOG, "No database connection available - specified"
+ " DATETIME/TIMESTAMP precision will be tried"); // depends on control dependency: [if], data = [none]
return DEFAULT_MAX_TIMESTAMP_FRACTIONAL_DIGITS; // depends on control dependency: [if], data = [none]
}
return DEFAULT_MAX_TIMESTAMP_FRACTIONAL_DIGITS;
} } |
public class class_name {
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
@Pure
public static int compare(GeoLocation l1, GeoLocation l2) {
if (l1 == l2) {
return 0;
}
if (l1 == null && l2 != null) {
return Integer.MIN_VALUE;
}
if (l2 == null && l1 != null) {
return Integer.MAX_VALUE;
}
assert l1 != null && l2 != null;
final Rectangle2d b1 = l1.toBounds2D().toBoundingBox();
final Rectangle2d b2 = l2.toBounds2D().toBoundingBox();
assert b1 != null && b2 != null;
if (b1.isEmpty() && b2.isEmpty()) {
final GeoId id1 = l1.toGeoId();
final GeoId id2 = l2.toGeoId();
assert id1 != null && id2 != null;
return id1.compareTo(id2);
}
if (b1.isEmpty()) {
assert !b2.isEmpty();
return Integer.MIN_VALUE;
}
if (b2.isEmpty()) {
assert !b1.isEmpty();
return Integer.MAX_VALUE;
}
assert !b1.isEmpty() && !b2.isEmpty();
int cmp = MathUtil.compareEpsilon(b1.getMinX(), b2.getMinX());
if (cmp != 0) {
return cmp;
}
cmp = MathUtil.compareEpsilon(b1.getMinY(), b2.getMinY());
if (cmp != 0) {
return cmp;
}
cmp = MathUtil.compareEpsilon(b1.getMaxX(), b2.getMaxX());
if (cmp != 0) {
return cmp;
}
return MathUtil.compareEpsilon(b1.getMaxY(), b2.getMaxY());
} } | public class class_name {
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
@Pure
public static int compare(GeoLocation l1, GeoLocation l2) {
if (l1 == l2) {
return 0; // depends on control dependency: [if], data = [none]
}
if (l1 == null && l2 != null) {
return Integer.MIN_VALUE; // depends on control dependency: [if], data = [none]
}
if (l2 == null && l1 != null) {
return Integer.MAX_VALUE; // depends on control dependency: [if], data = [none]
}
assert l1 != null && l2 != null;
final Rectangle2d b1 = l1.toBounds2D().toBoundingBox();
final Rectangle2d b2 = l2.toBounds2D().toBoundingBox();
assert b1 != null && b2 != null;
if (b1.isEmpty() && b2.isEmpty()) {
final GeoId id1 = l1.toGeoId();
final GeoId id2 = l2.toGeoId();
assert id1 != null && id2 != null; // depends on control dependency: [if], data = [none]
return id1.compareTo(id2); // depends on control dependency: [if], data = [none]
}
if (b1.isEmpty()) {
assert !b2.isEmpty(); // depends on control dependency: [if], data = [none]
return Integer.MIN_VALUE; // depends on control dependency: [if], data = [none]
}
if (b2.isEmpty()) {
assert !b1.isEmpty(); // depends on control dependency: [if], data = [none]
return Integer.MAX_VALUE; // depends on control dependency: [if], data = [none]
}
assert !b1.isEmpty() && !b2.isEmpty();
int cmp = MathUtil.compareEpsilon(b1.getMinX(), b2.getMinX());
if (cmp != 0) {
return cmp; // depends on control dependency: [if], data = [none]
}
cmp = MathUtil.compareEpsilon(b1.getMinY(), b2.getMinY());
if (cmp != 0) {
return cmp; // depends on control dependency: [if], data = [none]
}
cmp = MathUtil.compareEpsilon(b1.getMaxX(), b2.getMaxX());
if (cmp != 0) {
return cmp; // depends on control dependency: [if], data = [none]
}
return MathUtil.compareEpsilon(b1.getMaxY(), b2.getMaxY());
} } |
public class class_name {
public static String fsToWellFormed(String value, boolean lenient) {
if (value == null || value.isEmpty()) {
return LogicalValue.ANY.getAbbreviation();
}
if (LogicalValue.ANY.getAbbreviation().equals(value) || LogicalValue.NA.getAbbreviation().equals(value)) {
return value;
}
//return value.replaceAll("([._-])", "\\\\$1");
int startLenient = -1;
int endLenient = value.length() - 1;
if (lenient) {
char prev = ' ';
for (int x = 0; x < value.length(); x++) {
char c = value.charAt(x);
if (startLenient < 0 && c != '?' && c != '*') {
startLenient = x;
}
switch (c) {
case '*':
case '?':
if (prev != '*' && prev != '?') {
endLenient = x - 1;
}
break;
case '\\':
//skip the next character as it is quoted
x += 1;
//don't break because we need to set endLenient
default:
endLenient = value.length() - 1;
break;
}
prev = c;
}
}
boolean quoted = false;
StringBuilder buffer = new StringBuilder(value);
for (int x = 0; x < buffer.length(); x++) {
char c = buffer.charAt(x);
if (c == '.' || c == '_' || c == '-') {
buffer.insert(x++, '\\');
endLenient += 1;
} else if (lenient && x >= startLenient && x <= endLenient) {
if (!quoted && c == '\\') {
quoted = true;
continue;
}
if (!quoted && !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))) {
buffer.insert(x++, '\\');
endLenient += 1;
}
quoted = false;
}
}
return buffer.toString();
} } | public class class_name {
public static String fsToWellFormed(String value, boolean lenient) {
if (value == null || value.isEmpty()) {
return LogicalValue.ANY.getAbbreviation(); // depends on control dependency: [if], data = [none]
}
if (LogicalValue.ANY.getAbbreviation().equals(value) || LogicalValue.NA.getAbbreviation().equals(value)) {
return value; // depends on control dependency: [if], data = [none]
}
//return value.replaceAll("([._-])", "\\\\$1");
int startLenient = -1;
int endLenient = value.length() - 1;
if (lenient) {
char prev = ' ';
for (int x = 0; x < value.length(); x++) {
char c = value.charAt(x);
if (startLenient < 0 && c != '?' && c != '*') {
startLenient = x; // depends on control dependency: [if], data = [none]
}
switch (c) {
case '*':
case '?':
if (prev != '*' && prev != '?') {
endLenient = x - 1; // depends on control dependency: [if], data = [none]
}
break;
case '\\':
//skip the next character as it is quoted
x += 1;
//don't break because we need to set endLenient
default:
endLenient = value.length() - 1;
break;
}
prev = c; // depends on control dependency: [for], data = [none]
}
}
boolean quoted = false;
StringBuilder buffer = new StringBuilder(value);
for (int x = 0; x < buffer.length(); x++) {
char c = buffer.charAt(x);
if (c == '.' || c == '_' || c == '-') {
buffer.insert(x++, '\\'); // depends on control dependency: [if], data = [none]
endLenient += 1; // depends on control dependency: [if], data = [none]
} else if (lenient && x >= startLenient && x <= endLenient) {
if (!quoted && c == '\\') {
quoted = true; // depends on control dependency: [if], data = [none]
continue;
}
if (!quoted && !((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))) {
buffer.insert(x++, '\\'); // depends on control dependency: [if], data = [none]
endLenient += 1; // depends on control dependency: [if], data = [none]
}
quoted = false; // depends on control dependency: [if], data = [none]
}
}
return buffer.toString();
} } |
public class class_name {
public static void finishThread(){
//--Create Task
final long threadId = Thread.currentThread().getId();
Runnable finish = new Runnable(){
public void run(){
releaseThreadControl(threadId);
}
};
//--Run Task
if(isThreaded){
//(case: multithreaded)
attemptThreadControl( threadId, finish );
} else {
//(case: no threading)
throw new IllegalStateException("finishThreads() called outside of threaded environment");
}
} } | public class class_name {
public static void finishThread(){
//--Create Task
final long threadId = Thread.currentThread().getId();
Runnable finish = new Runnable(){
public void run(){
releaseThreadControl(threadId);
}
};
//--Run Task
if(isThreaded){
//(case: multithreaded)
attemptThreadControl( threadId, finish );
// depends on control dependency: [if], data = [none]
} else {
//(case: no threading)
throw new IllegalStateException("finishThreads() called outside of threaded environment");
}
} } |
public class class_name {
private void releaseDisplayView() {
if (mDisplayView instanceof GLCameraEncoderView) {
((GLCameraEncoderView) mDisplayView).releaseCamera();
} else if (mDisplayView instanceof GLCameraView)
((GLCameraView) mDisplayView).releaseCamera();
} } | public class class_name {
private void releaseDisplayView() {
if (mDisplayView instanceof GLCameraEncoderView) {
((GLCameraEncoderView) mDisplayView).releaseCamera(); // depends on control dependency: [if], data = [none]
} else if (mDisplayView instanceof GLCameraView)
((GLCameraView) mDisplayView).releaseCamera();
} } |
public class class_name {
private void validateCCIConnectionFactory(ConnectionFactory cf, ConnectionFactoryService cfSvc,
String user, @Sensitive String password,
LinkedHashMap<String, Object> result) throws ResourceException {
try {
ResourceAdapterMetaData adapterData = cf.getMetaData();
result.put("resourceAdapterName", adapterData.getAdapterName());
result.put("resourceAdapterVersion", adapterData.getAdapterVersion());
String spec = adapterData.getSpecVersion();
if (spec != null && spec.length() > 0)
result.put("resourceAdapterJCASupport", spec);
String vendor = adapterData.getAdapterVendorName();
if (vendor != null && vendor.length() > 0)
result.put("resourceAdapterVendor", vendor);
String desc = adapterData.getAdapterShortDescription();
if (desc != null && desc.length() > 0)
result.put("resourceAdapterDescription", desc);
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) {
}
ConnectionSpec conSpec = null;
if (user != null || password != null) {
String conFactoryClassName = cf.getClass().getName();
String conSpecClassName = conFactoryClassName.replace("ConnectionFactory", "ConnectionSpec");
if (!conFactoryClassName.equals(conSpecClassName))
conSpec = createConnectionSpec(cf, conSpecClassName, user, password);
if (conSpec == null) {
// TODO find ConnectionSpec impl another way?
throw new RuntimeException("Unable to locate javax.resource.cci.ConnectionSpec impl from resource adapter.");
}
}
Connection con;
try {
cfSvc.setValidating(true); // initializes a ThreadLocal that instructs the allocate operation to perform additional validation
con = conSpec == null ? cf.getConnection() : cf.getConnection(conSpec);
} finally {
cfSvc.setValidating(false);
}
try {
try {
ConnectionMetaData conData = con.getMetaData();
try {
String prodName = conData.getEISProductName();
if (prodName != null && prodName.length() > 0)
result.put("eisProductName", prodName);
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) {
}
try {
String prodVersion = conData.getEISProductVersion();
if (prodVersion != null && prodVersion.length() > 0)
result.put("eisProductVersion", prodVersion);
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) {
}
String userName = conData.getUserName();
if (userName != null && userName.length() > 0)
result.put("user", userName);
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) {
}
try {
con.createInteraction().close();
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) {
}
} finally {
con.close();
}
} } | public class class_name {
private void validateCCIConnectionFactory(ConnectionFactory cf, ConnectionFactoryService cfSvc,
String user, @Sensitive String password,
LinkedHashMap<String, Object> result) throws ResourceException {
try {
ResourceAdapterMetaData adapterData = cf.getMetaData();
result.put("resourceAdapterName", adapterData.getAdapterName());
result.put("resourceAdapterVersion", adapterData.getAdapterVersion());
String spec = adapterData.getSpecVersion();
if (spec != null && spec.length() > 0)
result.put("resourceAdapterJCASupport", spec);
String vendor = adapterData.getAdapterVendorName();
if (vendor != null && vendor.length() > 0)
result.put("resourceAdapterVendor", vendor);
String desc = adapterData.getAdapterShortDescription();
if (desc != null && desc.length() > 0)
result.put("resourceAdapterDescription", desc);
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) {
}
ConnectionSpec conSpec = null;
if (user != null || password != null) {
String conFactoryClassName = cf.getClass().getName();
String conSpecClassName = conFactoryClassName.replace("ConnectionFactory", "ConnectionSpec");
if (!conFactoryClassName.equals(conSpecClassName))
conSpec = createConnectionSpec(cf, conSpecClassName, user, password);
if (conSpec == null) {
// TODO find ConnectionSpec impl another way?
throw new RuntimeException("Unable to locate javax.resource.cci.ConnectionSpec impl from resource adapter.");
}
}
Connection con;
try {
cfSvc.setValidating(true); // initializes a ThreadLocal that instructs the allocate operation to perform additional validation
con = conSpec == null ? cf.getConnection() : cf.getConnection(conSpec);
} finally {
cfSvc.setValidating(false);
}
try {
try {
ConnectionMetaData conData = con.getMetaData();
try {
String prodName = conData.getEISProductName();
if (prodName != null && prodName.length() > 0)
result.put("eisProductName", prodName);
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
try {
String prodVersion = conData.getEISProductVersion();
if (prodVersion != null && prodVersion.length() > 0)
result.put("eisProductVersion", prodVersion);
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
String userName = conData.getUserName();
if (userName != null && userName.length() > 0)
result.put("user", userName);
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
try {
con.createInteraction().close(); // depends on control dependency: [try], data = [none]
} catch (NotSupportedException ignore) {
} catch (UnsupportedOperationException ignore) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} finally {
con.close();
}
} } |
public class class_name {
public ServiceCall<DetectedFaces> detectFaces(DetectFacesOptions detectFacesOptions) {
Validator.notNull(detectFacesOptions, "detectFacesOptions cannot be null");
Validator.isTrue((detectFacesOptions.imagesFile() != null) || (detectFacesOptions.url() != null),
"At least one of imagesFile or url must be supplied.");
String[] pathSegments = { "v3/detect_faces" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("watson_vision_combined", "v3", "detectFaces");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (detectFacesOptions.acceptLanguage() != null) {
builder.header("Accept-Language", detectFacesOptions.acceptLanguage());
}
MultipartBody.Builder multipartBuilder = new MultipartBody.Builder();
multipartBuilder.setType(MultipartBody.FORM);
if (detectFacesOptions.imagesFile() != null) {
RequestBody imagesFileBody = RequestUtils.inputStreamBody(detectFacesOptions.imagesFile(), detectFacesOptions
.imagesFileContentType());
multipartBuilder.addFormDataPart("images_file", detectFacesOptions.imagesFilename(), imagesFileBody);
}
if (detectFacesOptions.url() != null) {
multipartBuilder.addFormDataPart("url", detectFacesOptions.url());
}
builder.body(multipartBuilder.build());
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DetectedFaces.class));
} } | public class class_name {
public ServiceCall<DetectedFaces> detectFaces(DetectFacesOptions detectFacesOptions) {
Validator.notNull(detectFacesOptions, "detectFacesOptions cannot be null");
Validator.isTrue((detectFacesOptions.imagesFile() != null) || (detectFacesOptions.url() != null),
"At least one of imagesFile or url must be supplied.");
String[] pathSegments = { "v3/detect_faces" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("watson_vision_combined", "v3", "detectFaces");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
if (detectFacesOptions.acceptLanguage() != null) {
builder.header("Accept-Language", detectFacesOptions.acceptLanguage()); // depends on control dependency: [if], data = [none]
}
MultipartBody.Builder multipartBuilder = new MultipartBody.Builder();
multipartBuilder.setType(MultipartBody.FORM);
if (detectFacesOptions.imagesFile() != null) {
RequestBody imagesFileBody = RequestUtils.inputStreamBody(detectFacesOptions.imagesFile(), detectFacesOptions
.imagesFileContentType());
multipartBuilder.addFormDataPart("images_file", detectFacesOptions.imagesFilename(), imagesFileBody); // depends on control dependency: [if], data = [none]
}
if (detectFacesOptions.url() != null) {
multipartBuilder.addFormDataPart("url", detectFacesOptions.url()); // depends on control dependency: [if], data = [none]
}
builder.body(multipartBuilder.build());
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DetectedFaces.class));
} } |
public class class_name {
public boolean hasMessageOf(String property, String messageKey) {
assertArgumentNotNull("property", property);
assertArgumentNotNull("messageKey", messageKey);
final UserMessageItem item = getPropertyItem(property);
return item != null && item.getMessageList().stream().anyMatch(message -> {
final String myKey = resolveMessageKey(messageKey);
if (message.isResource()) {
if (myKey.equals(resolveMessageKey(message.getMessageKey()))) {
return true;
}
} else { // direct message
if (message.getValidatorMessageKey().filter(vlkey -> resolveMessageKey(vlkey).equals(myKey)).isPresent()) {
return true;
}
}
return false;
});
} } | public class class_name {
public boolean hasMessageOf(String property, String messageKey) {
assertArgumentNotNull("property", property);
assertArgumentNotNull("messageKey", messageKey);
final UserMessageItem item = getPropertyItem(property);
return item != null && item.getMessageList().stream().anyMatch(message -> {
final String myKey = resolveMessageKey(messageKey);
if (message.isResource()) {
if (myKey.equals(resolveMessageKey(message.getMessageKey()))) {
return true; // depends on control dependency: [if], data = [none]
}
} else { // direct message
if (message.getValidatorMessageKey().filter(vlkey -> resolveMessageKey(vlkey).equals(myKey)).isPresent()) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
});
} } |
public class class_name {
static Map<SourceEntity, Long> getPreviousWatermarksForAllTables(SourceState state) {
Map<SourceEntity, Long> result = Maps.newHashMap();
Map<SourceEntity, Long> prevLowWatermarksByTable = Maps.newHashMap();
Map<SourceEntity, Long> prevActualHighWatermarksByTable = Maps.newHashMap();
Set<SourceEntity> tablesWithFailedTasks = Sets.newHashSet();
Set<SourceEntity> tablesWithNoUpdatesOnPreviousRun = Sets.newHashSet();
boolean commitOnFullSuccess = JobCommitPolicy.getCommitPolicy(state) == JobCommitPolicy.COMMIT_ON_FULL_SUCCESS;
for (WorkUnitState previousWus : state.getPreviousWorkUnitStates()) {
Optional<SourceEntity> sourceEntity = SourceEntity.fromState(previousWus);
if (!sourceEntity.isPresent()) {
log.warn("Missing source entity for WorkUnit state: " + previousWus);
continue;
}
SourceEntity table = sourceEntity.get();
long lowWm = ConfigurationKeys.DEFAULT_WATERMARK_VALUE;
LongWatermark waterMarkObj = previousWus.getWorkunit().getLowWatermark(LongWatermark.class);
// new job state file(version 0.2.1270) , water mark format:
// "watermark.interval.value": "{\"low.watermark.to.json\":{\"value\":20160101000000},\"expected.watermark.to.json\":{\"value\":20160715230234}}",
if(waterMarkObj != null){
lowWm = waterMarkObj.getValue();
}
// job state file(version 0.2.805)
// "workunit.low.water.mark": "20160711000000",
// "workunit.state.runtime.high.water.mark": "20160716140338",
else if(previousWus.getProperties().containsKey(ConfigurationKeys.WORK_UNIT_LOW_WATER_MARK_KEY)){
lowWm = Long.parseLong(previousWus.getProperties().getProperty(ConfigurationKeys.WORK_UNIT_LOW_WATER_MARK_KEY));
log.warn("can not find low water mark in json format, getting value from " + ConfigurationKeys.WORK_UNIT_LOW_WATER_MARK_KEY + " low water mark " + lowWm);
}
if (!prevLowWatermarksByTable.containsKey(table)) {
prevLowWatermarksByTable.put(table, lowWm);
} else {
prevLowWatermarksByTable.put(table, Math.min(prevLowWatermarksByTable.get(table), lowWm));
}
long highWm = ConfigurationKeys.DEFAULT_WATERMARK_VALUE;
waterMarkObj = previousWus.getActualHighWatermark(LongWatermark.class);
if(waterMarkObj != null){
highWm = waterMarkObj.getValue();
}
else if(previousWus.getProperties().containsKey(ConfigurationKeys.WORK_UNIT_STATE_RUNTIME_HIGH_WATER_MARK)){
highWm = Long.parseLong(previousWus.getProperties().getProperty(ConfigurationKeys.WORK_UNIT_STATE_RUNTIME_HIGH_WATER_MARK));
log.warn("can not find high water mark in json format, getting value from " + ConfigurationKeys.WORK_UNIT_STATE_RUNTIME_HIGH_WATER_MARK + " high water mark " + highWm);
}
if (!prevActualHighWatermarksByTable.containsKey(table)) {
prevActualHighWatermarksByTable.put(table, highWm);
} else {
prevActualHighWatermarksByTable.put(table, Math.max(prevActualHighWatermarksByTable.get(table), highWm));
}
if (commitOnFullSuccess && !isSuccessfulOrCommited(previousWus)) {
tablesWithFailedTasks.add(table);
}
if (!isAnyDataProcessed(previousWus)) {
tablesWithNoUpdatesOnPreviousRun.add(table);
}
}
for (Map.Entry<SourceEntity, Long> entry : prevLowWatermarksByTable.entrySet()) {
if (tablesWithFailedTasks.contains(entry.getKey())) {
log.info("Resetting low watermark to {} because previous run failed.", entry.getValue());
result.put(entry.getKey(), entry.getValue());
} else if (tablesWithNoUpdatesOnPreviousRun.contains(entry.getKey())
&& state.getPropAsBoolean(ConfigurationKeys.SOURCE_QUERYBASED_RESET_EMPTY_PARTITION_WATERMARK,
ConfigurationKeys.DEFAULT_SOURCE_QUERYBASED_RESET_EMPTY_PARTITION_WATERMARK)) {
log.info("Resetting low watermakr to {} because previous run processed no data.", entry.getValue());
result.put(entry.getKey(), entry.getValue());
} else {
result.put(entry.getKey(), prevActualHighWatermarksByTable.get(entry.getKey()));
}
}
return result;
} } | public class class_name {
static Map<SourceEntity, Long> getPreviousWatermarksForAllTables(SourceState state) {
Map<SourceEntity, Long> result = Maps.newHashMap();
Map<SourceEntity, Long> prevLowWatermarksByTable = Maps.newHashMap();
Map<SourceEntity, Long> prevActualHighWatermarksByTable = Maps.newHashMap();
Set<SourceEntity> tablesWithFailedTasks = Sets.newHashSet();
Set<SourceEntity> tablesWithNoUpdatesOnPreviousRun = Sets.newHashSet();
boolean commitOnFullSuccess = JobCommitPolicy.getCommitPolicy(state) == JobCommitPolicy.COMMIT_ON_FULL_SUCCESS;
for (WorkUnitState previousWus : state.getPreviousWorkUnitStates()) {
Optional<SourceEntity> sourceEntity = SourceEntity.fromState(previousWus);
if (!sourceEntity.isPresent()) {
log.warn("Missing source entity for WorkUnit state: " + previousWus); // depends on control dependency: [if], data = [none]
continue;
}
SourceEntity table = sourceEntity.get();
long lowWm = ConfigurationKeys.DEFAULT_WATERMARK_VALUE;
LongWatermark waterMarkObj = previousWus.getWorkunit().getLowWatermark(LongWatermark.class);
// new job state file(version 0.2.1270) , water mark format:
// "watermark.interval.value": "{\"low.watermark.to.json\":{\"value\":20160101000000},\"expected.watermark.to.json\":{\"value\":20160715230234}}",
if(waterMarkObj != null){
lowWm = waterMarkObj.getValue(); // depends on control dependency: [if], data = [none]
}
// job state file(version 0.2.805)
// "workunit.low.water.mark": "20160711000000",
// "workunit.state.runtime.high.water.mark": "20160716140338",
else if(previousWus.getProperties().containsKey(ConfigurationKeys.WORK_UNIT_LOW_WATER_MARK_KEY)){
lowWm = Long.parseLong(previousWus.getProperties().getProperty(ConfigurationKeys.WORK_UNIT_LOW_WATER_MARK_KEY)); // depends on control dependency: [if], data = [none]
log.warn("can not find low water mark in json format, getting value from " + ConfigurationKeys.WORK_UNIT_LOW_WATER_MARK_KEY + " low water mark " + lowWm); // depends on control dependency: [if], data = [none]
}
if (!prevLowWatermarksByTable.containsKey(table)) {
prevLowWatermarksByTable.put(table, lowWm); // depends on control dependency: [if], data = [none]
} else {
prevLowWatermarksByTable.put(table, Math.min(prevLowWatermarksByTable.get(table), lowWm)); // depends on control dependency: [if], data = [none]
}
long highWm = ConfigurationKeys.DEFAULT_WATERMARK_VALUE;
waterMarkObj = previousWus.getActualHighWatermark(LongWatermark.class); // depends on control dependency: [for], data = [previousWus]
if(waterMarkObj != null){
highWm = waterMarkObj.getValue(); // depends on control dependency: [if], data = [none]
}
else if(previousWus.getProperties().containsKey(ConfigurationKeys.WORK_UNIT_STATE_RUNTIME_HIGH_WATER_MARK)){
highWm = Long.parseLong(previousWus.getProperties().getProperty(ConfigurationKeys.WORK_UNIT_STATE_RUNTIME_HIGH_WATER_MARK)); // depends on control dependency: [if], data = [none]
log.warn("can not find high water mark in json format, getting value from " + ConfigurationKeys.WORK_UNIT_STATE_RUNTIME_HIGH_WATER_MARK + " high water mark " + highWm); // depends on control dependency: [if], data = [none]
}
if (!prevActualHighWatermarksByTable.containsKey(table)) {
prevActualHighWatermarksByTable.put(table, highWm); // depends on control dependency: [if], data = [none]
} else {
prevActualHighWatermarksByTable.put(table, Math.max(prevActualHighWatermarksByTable.get(table), highWm)); // depends on control dependency: [if], data = [none]
}
if (commitOnFullSuccess && !isSuccessfulOrCommited(previousWus)) {
tablesWithFailedTasks.add(table); // depends on control dependency: [if], data = [none]
}
if (!isAnyDataProcessed(previousWus)) {
tablesWithNoUpdatesOnPreviousRun.add(table); // depends on control dependency: [if], data = [none]
}
}
for (Map.Entry<SourceEntity, Long> entry : prevLowWatermarksByTable.entrySet()) {
if (tablesWithFailedTasks.contains(entry.getKey())) {
log.info("Resetting low watermark to {} because previous run failed.", entry.getValue()); // depends on control dependency: [if], data = [none]
result.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none]
} else if (tablesWithNoUpdatesOnPreviousRun.contains(entry.getKey())
&& state.getPropAsBoolean(ConfigurationKeys.SOURCE_QUERYBASED_RESET_EMPTY_PARTITION_WATERMARK,
ConfigurationKeys.DEFAULT_SOURCE_QUERYBASED_RESET_EMPTY_PARTITION_WATERMARK)) {
log.info("Resetting low watermakr to {} because previous run processed no data.", entry.getValue()); // depends on control dependency: [if], data = [none]
result.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none]
} else {
result.put(entry.getKey(), prevActualHighWatermarksByTable.get(entry.getKey())); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
private boolean isHHSign(String str)
{
boolean sign = true;
try
{
char r = (char) Integer.parseInt(str, 16);
}
catch (NumberFormatException e)
{
sign = false;
}
return sign;
} } | public class class_name {
private boolean isHHSign(String str)
{
boolean sign = true;
try
{
char r = (char) Integer.parseInt(str, 16);
}
catch (NumberFormatException e)
{
sign = false;
} // depends on control dependency: [catch], data = [none]
return sign;
} } |
public class class_name {
private void addHomozygousGenotype(Variant variant, int numAllele, String[] alternateAlleles, VariantStats stats, String[] homCounts) {
if (homCounts.length == alternateAlleles.length) {
for (int i = 0; i < homCounts.length; i++) {
Integer alleles[] = new Integer[2];
getHomozygousGenotype(i + 1, alleles);
String gt = VariantVcfFactory.mapToMultiallelicIndex(alleles[0], numAllele) + "/" + VariantVcfFactory.mapToMultiallelicIndex(alleles[1], numAllele);
Genotype genotype = new Genotype(gt, variant.getReference(), alternateAlleles[numAllele]);
stats.addGenotype(genotype, Integer.parseInt(homCounts[i]));
}
}
} } | public class class_name {
private void addHomozygousGenotype(Variant variant, int numAllele, String[] alternateAlleles, VariantStats stats, String[] homCounts) {
if (homCounts.length == alternateAlleles.length) {
for (int i = 0; i < homCounts.length; i++) {
Integer alleles[] = new Integer[2];
getHomozygousGenotype(i + 1, alleles); // depends on control dependency: [for], data = [i]
String gt = VariantVcfFactory.mapToMultiallelicIndex(alleles[0], numAllele) + "/" + VariantVcfFactory.mapToMultiallelicIndex(alleles[1], numAllele);
Genotype genotype = new Genotype(gt, variant.getReference(), alternateAlleles[numAllele]);
stats.addGenotype(genotype, Integer.parseInt(homCounts[i])); // depends on control dependency: [for], data = [i]
}
}
} } |
public class class_name {
private void increaseBeliefCount(String bName) {
Object belief = this.getBelief(bName);
int count = 0;
if (belief!=null) {
count = (Integer) belief;
}
this.setBelief(bName, count + 1);
} } | public class class_name {
private void increaseBeliefCount(String bName) {
Object belief = this.getBelief(bName);
int count = 0;
if (belief!=null) {
count = (Integer) belief; // depends on control dependency: [if], data = [none]
}
this.setBelief(bName, count + 1);
} } |
public class class_name {
public void cleanupFinalBeanManagers(@Observes AfterDeploymentValidation adv)
{
for (BeanManagerInfo bmi : bmpSingleton.bmInfos.values())
{
bmi.finalBm = null;
bmi.booted = true;
/*possible issue with >weld< based servers:
if #getBeanManager gets called in a custom AfterDeploymentValidation observer >after< this observer,
the wrong bean-manager might get stored (not deterministic due to the unspecified order of observers).
finally a bean-manager for a single bda will be stored and returned (which isn't the bm exposed via jndi).*/
}
} } | public class class_name {
public void cleanupFinalBeanManagers(@Observes AfterDeploymentValidation adv)
{
for (BeanManagerInfo bmi : bmpSingleton.bmInfos.values())
{
bmi.finalBm = null; // depends on control dependency: [for], data = [bmi]
bmi.booted = true; // depends on control dependency: [for], data = [bmi]
/*possible issue with >weld< based servers:
if #getBeanManager gets called in a custom AfterDeploymentValidation observer >after< this observer,
the wrong bean-manager might get stored (not deterministic due to the unspecified order of observers).
finally a bean-manager for a single bda will be stored and returned (which isn't the bm exposed via jndi).*/
}
} } |
public class class_name {
private List<String> getHeaderValues(String headerName) {
if (additionalHttpHeaders.get(headerName) == null) {
additionalHttpHeaders.put(headerName, new ArrayList<String>());
}
return additionalHttpHeaders.get(headerName);
} } | public class class_name {
private List<String> getHeaderValues(String headerName) {
if (additionalHttpHeaders.get(headerName) == null) {
additionalHttpHeaders.put(headerName, new ArrayList<String>()); // depends on control dependency: [if], data = [none]
}
return additionalHttpHeaders.get(headerName);
} } |
public class class_name {
@Contract(pure = true)
public byte peekByte(int index) {
assert hasRemainingBytes(index + 1);
for (int i = first; ; i = next(i)) {
ByteBuf buf = bufs[i];
if (index < buf.readRemaining())
return buf.peek(index);
index -= buf.readRemaining();
}
} } | public class class_name {
@Contract(pure = true)
public byte peekByte(int index) {
assert hasRemainingBytes(index + 1);
for (int i = first; ; i = next(i)) {
ByteBuf buf = bufs[i];
if (index < buf.readRemaining())
return buf.peek(index);
index -= buf.readRemaining(); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private void fetch() {
next.clear();
// We need to remember for what thread the IEnumVARIANT was marshaled. Because if we want to interpret this
// VARIANT as an interface pointer later on, we need to do this in the same thread!
next.thread = e.getComThread();
int r = e.next(1,next);
if(r==0) {
next = null;
e.dispose();
}
} } | public class class_name {
private void fetch() {
next.clear();
// We need to remember for what thread the IEnumVARIANT was marshaled. Because if we want to interpret this
// VARIANT as an interface pointer later on, we need to do this in the same thread!
next.thread = e.getComThread();
int r = e.next(1,next);
if(r==0) {
next = null; // depends on control dependency: [if], data = [none]
e.dispose(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static JsArrayInteger toJsArray(byte[] data) {
JsArrayInteger jsan = (JsArrayInteger) JsArrayInteger.createArray();
int len = data.length;
for (int i = len - 1; i >= 0; i--) {
jsan.set(i, data[i]);
}
return jsan;
} } | public class class_name {
public static JsArrayInteger toJsArray(byte[] data) {
JsArrayInteger jsan = (JsArrayInteger) JsArrayInteger.createArray();
int len = data.length;
for (int i = len - 1; i >= 0; i--) {
jsan.set(i, data[i]); // depends on control dependency: [for], data = [i]
}
return jsan;
} } |
public class class_name {
@FFDCIgnore(IllegalArgumentException.class)
private String evaluateCallerSearchFilter(boolean immediateOnly) {
try {
return elHelper.processString("callerSearchFilter", this.idStoreDefinition.callerSearchFilter(), immediateOnly);
} catch (IllegalArgumentException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) {
Tr.warning(tc, "JAVAEESEC_WARNING_IDSTORE_CONFIG", new Object[] { "callerSearchFilter", "" });
}
return ""; /* Default value from spec. */
}
} } | public class class_name {
@FFDCIgnore(IllegalArgumentException.class)
private String evaluateCallerSearchFilter(boolean immediateOnly) {
try {
return elHelper.processString("callerSearchFilter", this.idStoreDefinition.callerSearchFilter(), immediateOnly); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) {
Tr.warning(tc, "JAVAEESEC_WARNING_IDSTORE_CONFIG", new Object[] { "callerSearchFilter", "" }); // depends on control dependency: [if], data = [none]
}
return ""; /* Default value from spec. */
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void newlineAndIndent(){
if (isWriting()){
if (isClosed){
write(Indentation.tabs(depth)); // \n\t\t\t\...
} else {
depth++;
write(Indentation.closedTabs(depth)); // >\n\t\t\t\...
isClosed = true;
}
}
} } | public class class_name {
private void newlineAndIndent(){
if (isWriting()){
if (isClosed){
write(Indentation.tabs(depth)); // \n\t\t\t\... // depends on control dependency: [if], data = [none]
} else {
depth++; // depends on control dependency: [if], data = [none]
write(Indentation.closedTabs(depth)); // >\n\t\t\t\... // depends on control dependency: [if], data = [none]
isClosed = true; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public double getValueAt(final int at) {
if (userRecallAtCutoff.containsKey(at)) {
double sum = 0.0;
double rec = 0.0;
for (U u : userRecallAtCutoff.get(at).keySet()) {
double urec = getValueAt(u, at);
double utotal = userTotalRecall.get(u);
if (!Double.isNaN(urec)) {
rec += urec * utotal;
sum += utotal;
}
}
if (sum == 0.0) {
rec = 0.0;
} else {
rec = rec / sum;
}
return rec;
}
return Double.NaN;
} } | public class class_name {
@Override
public double getValueAt(final int at) {
if (userRecallAtCutoff.containsKey(at)) {
double sum = 0.0;
double rec = 0.0;
for (U u : userRecallAtCutoff.get(at).keySet()) {
double urec = getValueAt(u, at);
double utotal = userTotalRecall.get(u);
if (!Double.isNaN(urec)) {
rec += urec * utotal; // depends on control dependency: [if], data = [none]
sum += utotal; // depends on control dependency: [if], data = [none]
}
}
if (sum == 0.0) {
rec = 0.0; // depends on control dependency: [if], data = [none]
} else {
rec = rec / sum; // depends on control dependency: [if], data = [none]
}
return rec; // depends on control dependency: [if], data = [none]
}
return Double.NaN;
} } |
public class class_name {
public static int compare(final String str1, final String str2, final boolean nullIsLess) {
if (str1 == str2) {
return 0;
}
if (str1 == null) {
return nullIsLess ? -1 : 1;
}
if (str2 == null) {
return nullIsLess ? 1 : - 1;
}
return str1.compareTo(str2);
} } | public class class_name {
public static int compare(final String str1, final String str2, final boolean nullIsLess) {
if (str1 == str2) {
return 0; // depends on control dependency: [if], data = [none]
}
if (str1 == null) {
return nullIsLess ? -1 : 1; // depends on control dependency: [if], data = [none]
}
if (str2 == null) {
return nullIsLess ? 1 : - 1; // depends on control dependency: [if], data = [none]
}
return str1.compareTo(str2);
} } |
public class class_name {
public String getRequestedSessionId(HttpServletRequest _request)
{
SessionAffinityContext sac = getSessionAffinityContext(_request);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[GET_REQUESTED_SESSION_ID], sac.isFirstSessionIdValid());
}
String reqSessId = sac.getRequestedSessionID();
// if we have multiple session ids, the "requested" one is either the
// first one that is valid, or if none are valid, the first one in the list
boolean idIsValid = _coreHttpSessionManager.isRequestedSessionIDValid(reqSessId, 0);
// getSession may or may not have been called. We need to check if the first
// id is valid and if not, then check if we need to update the allSessionIds
// list
if (reqSessId != null && !idIsValid && !sac.isAllSessionIdsSetViaSet()
|| !sac.isAllSessionIdsSetViaSet() && !sac.isFirstSessionIdValid()) { //PM89885 added || condition
List allSessionIds = _sam.getAllCookieValues(_request);
sac.setAllSessionIds(allSessionIds);
}
if (sac.getNumSessionIds() > 1)
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE))
{
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[GET_REQUESTED_SESSION_ID], "multiple incoming ids");
}
while (!idIsValid && _sam.setNextId(sac))
{
reqSessId = sac.getRequestedSessionID();
idIsValid = _coreHttpSessionManager.isRequestedSessionIDValid(reqSessId, 0);
}
if (!idIsValid)
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE))
{
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[GET_REQUESTED_SESSION_ID], "none valid - return first");
}
reqSessId = sac.getFirstRequestedSessionID();
}
} else if (!idIsValid && !sac.isFirstSessionIdValid()){
// Only session available is the one sent from the client so return that one
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[GET_REQUESTED_SESSION_ID], "return the only one id sent from client");
}
reqSessId = sac.getFirstRequestedSessionID();
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE))
{
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[GET_REQUESTED_SESSION_ID], reqSessId);
}
return reqSessId;
} } | public class class_name {
public String getRequestedSessionId(HttpServletRequest _request)
{
SessionAffinityContext sac = getSessionAffinityContext(_request);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[GET_REQUESTED_SESSION_ID], sac.isFirstSessionIdValid()); // depends on control dependency: [if], data = [none]
}
String reqSessId = sac.getRequestedSessionID();
// if we have multiple session ids, the "requested" one is either the
// first one that is valid, or if none are valid, the first one in the list
boolean idIsValid = _coreHttpSessionManager.isRequestedSessionIDValid(reqSessId, 0);
// getSession may or may not have been called. We need to check if the first
// id is valid and if not, then check if we need to update the allSessionIds
// list
if (reqSessId != null && !idIsValid && !sac.isAllSessionIdsSetViaSet()
|| !sac.isAllSessionIdsSetViaSet() && !sac.isFirstSessionIdValid()) { //PM89885 added || condition
List allSessionIds = _sam.getAllCookieValues(_request);
sac.setAllSessionIds(allSessionIds); // depends on control dependency: [if], data = [none]
}
if (sac.getNumSessionIds() > 1)
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE))
{
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[GET_REQUESTED_SESSION_ID], "multiple incoming ids"); // depends on control dependency: [if], data = [none]
}
while (!idIsValid && _sam.setNextId(sac))
{
reqSessId = sac.getRequestedSessionID(); // depends on control dependency: [while], data = [none]
idIsValid = _coreHttpSessionManager.isRequestedSessionIDValid(reqSessId, 0); // depends on control dependency: [while], data = [none]
}
if (!idIsValid)
{
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE))
{
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[GET_REQUESTED_SESSION_ID], "none valid - return first"); // depends on control dependency: [if], data = [none]
}
reqSessId = sac.getFirstRequestedSessionID(); // depends on control dependency: [if], data = [none]
}
} else if (!idIsValid && !sac.isFirstSessionIdValid()){
// Only session available is the one sent from the client so return that one
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[GET_REQUESTED_SESSION_ID], "return the only one id sent from client"); // depends on control dependency: [if], data = [none]
}
reqSessId = sac.getFirstRequestedSessionID(); // depends on control dependency: [if], data = [none]
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE))
{
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[GET_REQUESTED_SESSION_ID], reqSessId); // depends on control dependency: [if], data = [none]
}
return reqSessId;
} } |
public class class_name {
public static clusterinstance[] get(nitro_service service, Long clid[]) throws Exception{
if (clid !=null && clid.length>0) {
clusterinstance response[] = new clusterinstance[clid.length];
clusterinstance obj[] = new clusterinstance[clid.length];
for (int i=0;i<clid.length;i++) {
obj[i] = new clusterinstance();
obj[i].set_clid(clid[i]);
response[i] = (clusterinstance) obj[i].get_resource(service);
}
return response;
}
return null;
} } | public class class_name {
public static clusterinstance[] get(nitro_service service, Long clid[]) throws Exception{
if (clid !=null && clid.length>0) {
clusterinstance response[] = new clusterinstance[clid.length];
clusterinstance obj[] = new clusterinstance[clid.length];
for (int i=0;i<clid.length;i++) {
obj[i] = new clusterinstance(); // depends on control dependency: [for], data = [i]
obj[i].set_clid(clid[i]); // depends on control dependency: [for], data = [i]
response[i] = (clusterinstance) obj[i].get_resource(service); // depends on control dependency: [for], data = [i]
}
return response;
}
return null;
} } |
public class class_name {
@Override
public boolean onSchedule(PackingPlan packing) {
LOG.info("Starting to deploy topology: " + LocalContext.topologyName(config));
synchronized (processToContainer) {
LOG.info("Starting executor for TMaster");
startExecutor(0, null);
// for each container, run its own executor
for (PackingPlan.ContainerPlan container : packing.getContainers()) {
startExecutor(container.getId(), container.getInstances());
}
}
LOG.info("Executor for each container have been started.");
return true;
} } | public class class_name {
@Override
public boolean onSchedule(PackingPlan packing) {
LOG.info("Starting to deploy topology: " + LocalContext.topologyName(config));
synchronized (processToContainer) {
LOG.info("Starting executor for TMaster");
startExecutor(0, null);
// for each container, run its own executor
for (PackingPlan.ContainerPlan container : packing.getContainers()) {
startExecutor(container.getId(), container.getInstances()); // depends on control dependency: [for], data = [container]
}
}
LOG.info("Executor for each container have been started.");
return true;
} } |
public class class_name {
public void marshall(AffectedEntity affectedEntity, ProtocolMarshaller protocolMarshaller) {
if (affectedEntity == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(affectedEntity.getEntityArn(), ENTITYARN_BINDING);
protocolMarshaller.marshall(affectedEntity.getEventArn(), EVENTARN_BINDING);
protocolMarshaller.marshall(affectedEntity.getEntityValue(), ENTITYVALUE_BINDING);
protocolMarshaller.marshall(affectedEntity.getEntityUrl(), ENTITYURL_BINDING);
protocolMarshaller.marshall(affectedEntity.getAwsAccountId(), AWSACCOUNTID_BINDING);
protocolMarshaller.marshall(affectedEntity.getLastUpdatedTime(), LASTUPDATEDTIME_BINDING);
protocolMarshaller.marshall(affectedEntity.getStatusCode(), STATUSCODE_BINDING);
protocolMarshaller.marshall(affectedEntity.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AffectedEntity affectedEntity, ProtocolMarshaller protocolMarshaller) {
if (affectedEntity == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(affectedEntity.getEntityArn(), ENTITYARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(affectedEntity.getEventArn(), EVENTARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(affectedEntity.getEntityValue(), ENTITYVALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(affectedEntity.getEntityUrl(), ENTITYURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(affectedEntity.getAwsAccountId(), AWSACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(affectedEntity.getLastUpdatedTime(), LASTUPDATEDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(affectedEntity.getStatusCode(), STATUSCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(affectedEntity.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(Geometry geometry, ProtocolMarshaller protocolMarshaller) {
if (geometry == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(geometry.getBoundingBox(), BOUNDINGBOX_BINDING);
protocolMarshaller.marshall(geometry.getPolygon(), POLYGON_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Geometry geometry, ProtocolMarshaller protocolMarshaller) {
if (geometry == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(geometry.getBoundingBox(), BOUNDINGBOX_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(geometry.getPolygon(), POLYGON_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 StyleRow queryForRow(StyleMappingRow styleMappingRow) {
StyleRow styleRow = null;
AttributesRow attributesRow = queryForIdRow(styleMappingRow
.getRelatedId());
if (attributesRow != null) {
styleRow = getRow(attributesRow);
}
return styleRow;
} } | public class class_name {
public StyleRow queryForRow(StyleMappingRow styleMappingRow) {
StyleRow styleRow = null;
AttributesRow attributesRow = queryForIdRow(styleMappingRow
.getRelatedId());
if (attributesRow != null) {
styleRow = getRow(attributesRow); // depends on control dependency: [if], data = [(attributesRow]
}
return styleRow;
} } |
public class class_name {
public Optional<ZonedDateTime> lastExecution(final ZonedDateTime date) {
Preconditions.checkNotNull(date);
try {
ZonedDateTime previousMatch = previousClosestMatch(date);
if (previousMatch.equals(date)) {
previousMatch = previousClosestMatch(date.minusSeconds(1));
}
return Optional.of(previousMatch);
} catch (final NoSuchValueException e) {
return Optional.empty();
}
} } | public class class_name {
public Optional<ZonedDateTime> lastExecution(final ZonedDateTime date) {
Preconditions.checkNotNull(date);
try {
ZonedDateTime previousMatch = previousClosestMatch(date);
if (previousMatch.equals(date)) {
previousMatch = previousClosestMatch(date.minusSeconds(1)); // depends on control dependency: [if], data = [none]
}
return Optional.of(previousMatch); // depends on control dependency: [try], data = [none]
} catch (final NoSuchValueException e) {
return Optional.empty();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public List<Integer> getReplicatingPartitionList(int index) {
List<Node> preferenceNodesList = new ArrayList<Node>(getNumReplicas());
List<Integer> replicationPartitionsList = new ArrayList<Integer>(getNumReplicas());
// Copy Zone based Replication Factor
HashMap<Integer, Integer> requiredRepFactor = new HashMap<Integer, Integer>();
requiredRepFactor.putAll(zoneReplicationFactor);
// Cross-check if individual zone replication factor equals global
int sum = 0;
for(Integer zoneRepFactor: requiredRepFactor.values()) {
sum += zoneRepFactor;
}
if(sum != getNumReplicas())
throw new IllegalArgumentException("Number of zone replicas is not equal to the total replication factor");
if(getPartitionToNode().length == 0) {
return new ArrayList<Integer>(0);
}
for(int i = 0; i < getPartitionToNode().length; i++) {
// add this one if we haven't already, and it can satisfy some zone
// replicationFactor
Node currentNode = getNodeByPartition(index);
if(!preferenceNodesList.contains(currentNode)) {
preferenceNodesList.add(currentNode);
if(checkZoneRequirement(requiredRepFactor, currentNode.getZoneId()))
replicationPartitionsList.add(index);
}
// if we have enough, go home
if(replicationPartitionsList.size() >= getNumReplicas())
return replicationPartitionsList;
// move to next clockwise slot on the ring
index = (index + 1) % getPartitionToNode().length;
}
// we don't have enough, but that may be okay
return replicationPartitionsList;
} } | public class class_name {
@Override
public List<Integer> getReplicatingPartitionList(int index) {
List<Node> preferenceNodesList = new ArrayList<Node>(getNumReplicas());
List<Integer> replicationPartitionsList = new ArrayList<Integer>(getNumReplicas());
// Copy Zone based Replication Factor
HashMap<Integer, Integer> requiredRepFactor = new HashMap<Integer, Integer>();
requiredRepFactor.putAll(zoneReplicationFactor);
// Cross-check if individual zone replication factor equals global
int sum = 0;
for(Integer zoneRepFactor: requiredRepFactor.values()) {
sum += zoneRepFactor; // depends on control dependency: [for], data = [zoneRepFactor]
}
if(sum != getNumReplicas())
throw new IllegalArgumentException("Number of zone replicas is not equal to the total replication factor");
if(getPartitionToNode().length == 0) {
return new ArrayList<Integer>(0); // depends on control dependency: [if], data = [0)]
}
for(int i = 0; i < getPartitionToNode().length; i++) {
// add this one if we haven't already, and it can satisfy some zone
// replicationFactor
Node currentNode = getNodeByPartition(index);
if(!preferenceNodesList.contains(currentNode)) {
preferenceNodesList.add(currentNode); // depends on control dependency: [if], data = [none]
if(checkZoneRequirement(requiredRepFactor, currentNode.getZoneId()))
replicationPartitionsList.add(index);
}
// if we have enough, go home
if(replicationPartitionsList.size() >= getNumReplicas())
return replicationPartitionsList;
// move to next clockwise slot on the ring
index = (index + 1) % getPartitionToNode().length; // depends on control dependency: [for], data = [none]
}
// we don't have enough, but that may be okay
return replicationPartitionsList;
} } |
public class class_name {
public GeometryEnvelope getOrBuildEnvelope() {
GeometryEnvelope envelope = getEnvelope();
if (envelope == null) {
Geometry geometry = getGeometry();
if (geometry != null) {
envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry);
}
}
return envelope;
} } | public class class_name {
public GeometryEnvelope getOrBuildEnvelope() {
GeometryEnvelope envelope = getEnvelope();
if (envelope == null) {
Geometry geometry = getGeometry();
if (geometry != null) {
envelope = GeometryEnvelopeBuilder.buildEnvelope(geometry); // depends on control dependency: [if], data = [(geometry]
}
}
return envelope;
} } |
public class class_name {
public final void warn(String message, Throwable throwable)
{
if (isWarnEnabled())
{
out.print( "[ maven embedder WARNING] " );
out.println( message );
if (null != throwable)
{
throwable.printStackTrace( out );
}
}
} } | public class class_name {
public final void warn(String message, Throwable throwable)
{
if (isWarnEnabled())
{
out.print( "[ maven embedder WARNING] " ); // depends on control dependency: [if], data = [none]
out.println( message ); // depends on control dependency: [if], data = [none]
if (null != throwable)
{
throwable.printStackTrace( out ); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public EClass getIfcAxis2Placement3D() {
if (ifcAxis2Placement3DEClass == null) {
ifcAxis2Placement3DEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(33);
}
return ifcAxis2Placement3DEClass;
} } | public class class_name {
@Override
public EClass getIfcAxis2Placement3D() {
if (ifcAxis2Placement3DEClass == null) {
ifcAxis2Placement3DEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(33);
// depends on control dependency: [if], data = [none]
}
return ifcAxis2Placement3DEClass;
} } |
public class class_name {
static public MethodAccess get (Class type) {
boolean isInterface = type.isInterface();
if (!isInterface && type.getSuperclass() == null && type != Object.class)
throw new IllegalArgumentException("The type must not be an interface, a primitive type, or void.");
ArrayList<Method> methods = new ArrayList<Method>();
if (!isInterface) {
Class nextClass = type;
while (nextClass != Object.class) {
addDeclaredMethodsToList(nextClass, methods);
nextClass = nextClass.getSuperclass();
}
} else
recursiveAddInterfaceMethodsToList(type, methods);
int n = methods.size();
String[] methodNames = new String[n];
Class[][] parameterTypes = new Class[n][];
Class[] returnTypes = new Class[n];
for (int i = 0; i < n; i++) {
Method method = methods.get(i);
methodNames[i] = method.getName();
parameterTypes[i] = method.getParameterTypes();
returnTypes[i] = method.getReturnType();
}
String className = type.getName();
String accessClassName = className + "MethodAccess";
if (accessClassName.startsWith("java.")) accessClassName = "reflectasm." + accessClassName;
Class accessClass;
AccessClassLoader loader = AccessClassLoader.get(type);
synchronized (loader) {
accessClass = loader.loadAccessClass(accessClassName);
if (accessClass == null) {
String accessClassNameInternal = accessClassName.replace('.', '/');
String classNameInternal = className.replace('.', '/');
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
MethodVisitor mv;
cw.visit(V1_1, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, "com/esotericsoftware/reflectasm/MethodAccess",
null);
{
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESPECIAL, "com/esotericsoftware/reflectasm/MethodAccess", "<init>", "()V");
mv.visitInsn(RETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
{
mv = cw.visitMethod(ACC_PUBLIC + ACC_VARARGS, "invoke",
"(Ljava/lang/Object;I[Ljava/lang/Object;)Ljava/lang/Object;", null, null);
mv.visitCode();
if (!methods.isEmpty()) {
mv.visitVarInsn(ALOAD, 1);
mv.visitTypeInsn(CHECKCAST, classNameInternal);
mv.visitVarInsn(ASTORE, 4);
mv.visitVarInsn(ILOAD, 2);
Label[] labels = new Label[n];
for (int i = 0; i < n; i++)
labels[i] = new Label();
Label defaultLabel = new Label();
mv.visitTableSwitchInsn(0, labels.length - 1, defaultLabel, labels);
StringBuilder buffer = new StringBuilder(128);
for (int i = 0; i < n; i++) {
mv.visitLabel(labels[i]);
if (i == 0)
mv.visitFrame(Opcodes.F_APPEND, 1, new Object[] {classNameInternal}, 0, null);
else
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitVarInsn(ALOAD, 4);
buffer.setLength(0);
buffer.append('(');
Class[] paramTypes = parameterTypes[i];
Class returnType = returnTypes[i];
for (int paramIndex = 0; paramIndex < paramTypes.length; paramIndex++) {
mv.visitVarInsn(ALOAD, 3);
mv.visitIntInsn(BIPUSH, paramIndex);
mv.visitInsn(AALOAD);
Type paramType = Type.getType(paramTypes[paramIndex]);
switch (paramType.getSort()) {
case Type.BOOLEAN:
mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z");
break;
case Type.BYTE:
mv.visitTypeInsn(CHECKCAST, "java/lang/Byte");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B");
break;
case Type.CHAR:
mv.visitTypeInsn(CHECKCAST, "java/lang/Character");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C");
break;
case Type.SHORT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Short");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S");
break;
case Type.INT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I");
break;
case Type.FLOAT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Float");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F");
break;
case Type.LONG:
mv.visitTypeInsn(CHECKCAST, "java/lang/Long");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J");
break;
case Type.DOUBLE:
mv.visitTypeInsn(CHECKCAST, "java/lang/Double");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D");
break;
case Type.ARRAY:
mv.visitTypeInsn(CHECKCAST, paramType.getDescriptor());
break;
case Type.OBJECT:
mv.visitTypeInsn(CHECKCAST, paramType.getInternalName());
break;
}
buffer.append(paramType.getDescriptor());
}
buffer.append(')');
buffer.append(Type.getDescriptor(returnType));
int invoke;
if (isInterface)
invoke = INVOKEINTERFACE;
else if (Modifier.isStatic(methods.get(i).getModifiers()))
invoke = INVOKESTATIC;
else
invoke = INVOKEVIRTUAL;
mv.visitMethodInsn(invoke, classNameInternal, methodNames[i], buffer.toString());
switch (Type.getType(returnType).getSort()) {
case Type.VOID:
mv.visitInsn(ACONST_NULL);
break;
case Type.BOOLEAN:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;");
break;
case Type.BYTE:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;");
break;
case Type.CHAR:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;");
break;
case Type.SHORT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;");
break;
case Type.INT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;");
break;
case Type.FLOAT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;");
break;
case Type.LONG:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;");
break;
case Type.DOUBLE:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;");
break;
}
mv.visitInsn(ARETURN);
}
mv.visitLabel(defaultLabel);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
}
mv.visitTypeInsn(NEW, "java/lang/IllegalArgumentException");
mv.visitInsn(DUP);
mv.visitTypeInsn(NEW, "java/lang/StringBuilder");
mv.visitInsn(DUP);
mv.visitLdcInsn("Method not found: ");
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "(Ljava/lang/String;)V");
mv.visitVarInsn(ILOAD, 2);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(I)Ljava/lang/StringBuilder;");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;");
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "(Ljava/lang/String;)V");
mv.visitInsn(ATHROW);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
cw.visitEnd();
byte[] data = cw.toByteArray();
accessClass = loader.defineAccessClass(accessClassName, data);
}
}
try {
MethodAccess access = (MethodAccess)accessClass.newInstance();
access.methodNames = methodNames;
access.parameterTypes = parameterTypes;
access.returnTypes = returnTypes;
return access;
} catch (Throwable t) {
throw new RuntimeException("Error constructing method access class: " + accessClassName, t);
}
} } | public class class_name {
static public MethodAccess get (Class type) {
boolean isInterface = type.isInterface();
if (!isInterface && type.getSuperclass() == null && type != Object.class)
throw new IllegalArgumentException("The type must not be an interface, a primitive type, or void.");
ArrayList<Method> methods = new ArrayList<Method>();
if (!isInterface) {
Class nextClass = type;
while (nextClass != Object.class) {
addDeclaredMethodsToList(nextClass, methods);
// depends on control dependency: [while], data = [(nextClass]
nextClass = nextClass.getSuperclass();
// depends on control dependency: [while], data = [none]
}
} else
recursiveAddInterfaceMethodsToList(type, methods);
int n = methods.size();
String[] methodNames = new String[n];
Class[][] parameterTypes = new Class[n][];
Class[] returnTypes = new Class[n];
for (int i = 0; i < n; i++) {
Method method = methods.get(i);
methodNames[i] = method.getName();
// depends on control dependency: [for], data = [i]
parameterTypes[i] = method.getParameterTypes();
// depends on control dependency: [for], data = [i]
returnTypes[i] = method.getReturnType();
// depends on control dependency: [for], data = [i]
}
String className = type.getName();
String accessClassName = className + "MethodAccess";
if (accessClassName.startsWith("java.")) accessClassName = "reflectasm." + accessClassName;
Class accessClass;
AccessClassLoader loader = AccessClassLoader.get(type);
synchronized (loader) {
accessClass = loader.loadAccessClass(accessClassName);
if (accessClass == null) {
String accessClassNameInternal = accessClassName.replace('.', '/');
String classNameInternal = className.replace('.', '/');
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
MethodVisitor mv;
cw.visit(V1_1, ACC_PUBLIC + ACC_SUPER, accessClassNameInternal, null, "com/esotericsoftware/reflectasm/MethodAccess",
null);
// depends on control dependency: [if], data = [none]
{
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESPECIAL, "com/esotericsoftware/reflectasm/MethodAccess", "<init>", "()V");
mv.visitInsn(RETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
{
mv = cw.visitMethod(ACC_PUBLIC + ACC_VARARGS, "invoke",
"(Ljava/lang/Object;I[Ljava/lang/Object;)Ljava/lang/Object;", null, null);
mv.visitCode();
if (!methods.isEmpty()) {
mv.visitVarInsn(ALOAD, 1);
mv.visitTypeInsn(CHECKCAST, classNameInternal);
mv.visitVarInsn(ASTORE, 4);
mv.visitVarInsn(ILOAD, 2);
Label[] labels = new Label[n];
for (int i = 0; i < n; i++)
labels[i] = new Label();
Label defaultLabel = new Label();
mv.visitTableSwitchInsn(0, labels.length - 1, defaultLabel, labels);
StringBuilder buffer = new StringBuilder(128);
for (int i = 0; i < n; i++) {
mv.visitLabel(labels[i]);
if (i == 0)
mv.visitFrame(Opcodes.F_APPEND, 1, new Object[] {classNameInternal}, 0, null);
else
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitVarInsn(ALOAD, 4);
buffer.setLength(0);
buffer.append('(');
Class[] paramTypes = parameterTypes[i];
Class returnType = returnTypes[i];
for (int paramIndex = 0; paramIndex < paramTypes.length; paramIndex++) {
mv.visitVarInsn(ALOAD, 3);
mv.visitIntInsn(BIPUSH, paramIndex);
mv.visitInsn(AALOAD);
Type paramType = Type.getType(paramTypes[paramIndex]);
switch (paramType.getSort()) {
case Type.BOOLEAN:
mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z");
break;
case Type.BYTE:
mv.visitTypeInsn(CHECKCAST, "java/lang/Byte");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B");
break;
case Type.CHAR:
mv.visitTypeInsn(CHECKCAST, "java/lang/Character");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C");
break;
case Type.SHORT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Short");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S");
break;
case Type.INT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I");
break;
case Type.FLOAT:
mv.visitTypeInsn(CHECKCAST, "java/lang/Float");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F");
break;
case Type.LONG:
mv.visitTypeInsn(CHECKCAST, "java/lang/Long");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J");
break;
case Type.DOUBLE:
mv.visitTypeInsn(CHECKCAST, "java/lang/Double");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D");
break;
case Type.ARRAY:
mv.visitTypeInsn(CHECKCAST, paramType.getDescriptor());
break;
case Type.OBJECT:
mv.visitTypeInsn(CHECKCAST, paramType.getInternalName());
break;
}
buffer.append(paramType.getDescriptor());
}
buffer.append(')');
buffer.append(Type.getDescriptor(returnType));
int invoke;
if (isInterface)
invoke = INVOKEINTERFACE;
else if (Modifier.isStatic(methods.get(i).getModifiers()))
invoke = INVOKESTATIC;
else
invoke = INVOKEVIRTUAL;
mv.visitMethodInsn(invoke, classNameInternal, methodNames[i], buffer.toString());
switch (Type.getType(returnType).getSort()) {
case Type.VOID:
mv.visitInsn(ACONST_NULL);
break;
case Type.BOOLEAN:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;");
break;
case Type.BYTE:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;");
break;
case Type.CHAR:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;");
break;
case Type.SHORT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;");
break;
case Type.INT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;");
break;
case Type.FLOAT:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;");
break;
case Type.LONG:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;");
break;
case Type.DOUBLE:
mv.visitMethodInsn(INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;");
break;
}
mv.visitInsn(ARETURN);
}
mv.visitLabel(defaultLabel);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
}
mv.visitTypeInsn(NEW, "java/lang/IllegalArgumentException");
mv.visitInsn(DUP);
mv.visitTypeInsn(NEW, "java/lang/StringBuilder");
mv.visitInsn(DUP);
mv.visitLdcInsn("Method not found: ");
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuilder", "<init>", "(Ljava/lang/String;)V");
mv.visitVarInsn(ILOAD, 2);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "append", "(I)Ljava/lang/StringBuilder;");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuilder", "toString", "()Ljava/lang/String;");
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/IllegalArgumentException", "<init>", "(Ljava/lang/String;)V");
mv.visitInsn(ATHROW);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
cw.visitEnd();
byte[] data = cw.toByteArray();
accessClass = loader.defineAccessClass(accessClassName, data);
}
}
try {
MethodAccess access = (MethodAccess)accessClass.newInstance();
access.methodNames = methodNames;
access.parameterTypes = parameterTypes;
access.returnTypes = returnTypes;
return access;
} catch (Throwable t) {
throw new RuntimeException("Error constructing method access class: " + accessClassName, t);
}
} } |
public class class_name {
public static List<Type> getAllTypeArguments(Type javaType) {
if (!(javaType instanceof ParameterizedType)) {
return Collections.emptyList();
}
return Lists.immutableListOf(((ParameterizedType) javaType).getActualTypeArguments());
} } | public class class_name {
public static List<Type> getAllTypeArguments(Type javaType) {
if (!(javaType instanceof ParameterizedType)) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return Lists.immutableListOf(((ParameterizedType) javaType).getActualTypeArguments());
} } |
public class class_name {
public static ClassLoader resolveClassLoaderForBeanProxy(String contextId, Class<?> proxiedType, TypeInfo typeInfo, ProxyServices proxyServices) {
Class<?> superClass = typeInfo.getSuperClass();
if (superClass.getName().startsWith(JAVA)) {
ClassLoader cl = proxyServices.getClassLoader(proxiedType);
if (cl == null) {
cl = Thread.currentThread().getContextClassLoader();
}
return cl;
}
return Container.instance(contextId).services().get(ProxyServices.class).getClassLoader(superClass);
} } | public class class_name {
public static ClassLoader resolveClassLoaderForBeanProxy(String contextId, Class<?> proxiedType, TypeInfo typeInfo, ProxyServices proxyServices) {
Class<?> superClass = typeInfo.getSuperClass();
if (superClass.getName().startsWith(JAVA)) {
ClassLoader cl = proxyServices.getClassLoader(proxiedType);
if (cl == null) {
cl = Thread.currentThread().getContextClassLoader(); // depends on control dependency: [if], data = [none]
}
return cl; // depends on control dependency: [if], data = [none]
}
return Container.instance(contextId).services().get(ProxyServices.class).getClassLoader(superClass);
} } |
public class class_name {
private MethodDeclaration generateGetParamMethodForSoyElementClass(
TemplateParam param, boolean isAbstract) {
JsType jsType = JsType.forIncrementalDomState(param.type());
String accessorSuffix =
Ascii.toUpperCase(param.name().substring(0, 1)) + param.name().substring(1);
if (isAbstract) {
return MethodDeclaration.create(
"get" + accessorSuffix,
JsDoc.builder()
.addAnnotation("abstract")
.addParameterizedAnnotation("return", jsType.typeExpr())
.build(),
Statement.of(ImmutableList.of()));
}
Expression value = id("this").dotAccess("data").dotAccess(param.name());
if (param.hasDefault()) {
value =
templateTranslationContext
.codeGenerator()
.declarationBuilder()
.setRhs(value)
.build()
.ref();
value =
value.withInitialStatement(
genParamDefault(
param,
value,
alias,
getJsTypeForParamTypeCheck(param.type()),
/* declareStatic= */ false));
}
MethodDeclaration getParamMethod =
MethodDeclaration.create(
"get" + accessorSuffix,
JsDoc.builder().addAnnotation("override").addAnnotation("public").build(),
Statement.returnValue(value));
return getParamMethod;
} } | public class class_name {
private MethodDeclaration generateGetParamMethodForSoyElementClass(
TemplateParam param, boolean isAbstract) {
JsType jsType = JsType.forIncrementalDomState(param.type());
String accessorSuffix =
Ascii.toUpperCase(param.name().substring(0, 1)) + param.name().substring(1);
if (isAbstract) {
return MethodDeclaration.create(
"get" + accessorSuffix,
JsDoc.builder()
.addAnnotation("abstract")
.addParameterizedAnnotation("return", jsType.typeExpr())
.build(),
Statement.of(ImmutableList.of())); // depends on control dependency: [if], data = [none]
}
Expression value = id("this").dotAccess("data").dotAccess(param.name());
if (param.hasDefault()) {
value =
templateTranslationContext
.codeGenerator()
.declarationBuilder()
.setRhs(value)
.build()
.ref(); // depends on control dependency: [if], data = [none]
value =
value.withInitialStatement(
genParamDefault(
param,
value,
alias,
getJsTypeForParamTypeCheck(param.type()),
/* declareStatic= */ false)); // depends on control dependency: [if], data = [none]
}
MethodDeclaration getParamMethod =
MethodDeclaration.create(
"get" + accessorSuffix,
JsDoc.builder().addAnnotation("override").addAnnotation("public").build(),
Statement.returnValue(value));
return getParamMethod;
} } |
public class class_name {
public void enabled(double seconds) {
double end = System.currentTimeMillis() + (seconds * 1000);
try {
double timeTook = elementPresent(seconds);
WebDriverWait wait = new WebDriverWait(element.getDriver(), (long) (seconds - timeTook), DEFAULT_POLLING_INTERVAL);
wait.until(ExpectedConditions.elementToBeClickable(element.defineByElement()));
timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkEnabled(seconds, timeTook);
} catch (TimeoutException e) {
checkEnabled(seconds, seconds);
}
} } | public class class_name {
public void enabled(double seconds) {
double end = System.currentTimeMillis() + (seconds * 1000);
try {
double timeTook = elementPresent(seconds);
WebDriverWait wait = new WebDriverWait(element.getDriver(), (long) (seconds - timeTook), DEFAULT_POLLING_INTERVAL);
wait.until(ExpectedConditions.elementToBeClickable(element.defineByElement())); // depends on control dependency: [try], data = [none]
timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; // depends on control dependency: [try], data = [none]
checkEnabled(seconds, timeTook); // depends on control dependency: [try], data = [none]
} catch (TimeoutException e) {
checkEnabled(seconds, seconds);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Vector<Object> marshallize()
{
Vector<Object> vector = super.marshallize();
// replace the URL set by DocumentNode. This is to maintain backwar compatibility. Shifting the indexes would break everything.
String url = null;
if (vector.size() == 5) {
url = (String) vector.set(NODE_REPOSITORY_UID_INDEX, repositoryUID);
} else {
vector.add(NODE_REPOSITORY_UID_INDEX, repositoryUID);
}
vector.add(NODE_SUT_NAME_INDEX, sutName);
vector.add(NODE_SECTION_INDEX, StringUtils.defaultString(section));
if (isNotBlank(url)) {
vector.add(NODE_URL_INDEX, url);
}
return vector;
} } | public class class_name {
@Override
public Vector<Object> marshallize()
{
Vector<Object> vector = super.marshallize();
// replace the URL set by DocumentNode. This is to maintain backwar compatibility. Shifting the indexes would break everything.
String url = null;
if (vector.size() == 5) {
url = (String) vector.set(NODE_REPOSITORY_UID_INDEX, repositoryUID); // depends on control dependency: [if], data = [none]
} else {
vector.add(NODE_REPOSITORY_UID_INDEX, repositoryUID); // depends on control dependency: [if], data = [none]
}
vector.add(NODE_SUT_NAME_INDEX, sutName);
vector.add(NODE_SECTION_INDEX, StringUtils.defaultString(section));
if (isNotBlank(url)) {
vector.add(NODE_URL_INDEX, url); // depends on control dependency: [if], data = [none]
}
return vector;
} } |
public class class_name {
@Override
public boolean isSet(String propName) {
if (propName.equals("level")) {
return isSetLevel();
}
if (propName.equals("inGroup")) {
return isSetInGroup();
}
return super.isSet(propName);
} } | public class class_name {
@Override
public boolean isSet(String propName) {
if (propName.equals("level")) {
return isSetLevel(); // depends on control dependency: [if], data = [none]
}
if (propName.equals("inGroup")) {
return isSetInGroup(); // depends on control dependency: [if], data = [none]
}
return super.isSet(propName);
} } |
public class class_name {
public boolean addHeader(String name, String content) {
try {
return add(new Header(name, content));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} } | public class class_name {
public boolean addHeader(String name, String content) {
try {
return add(new Header(name, content)); // depends on control dependency: [try], data = [none]
} catch (DocumentException de) {
throw new ExceptionConverter(de);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void addFilter(Filter filter) {
boolean exists = false;
for (Filter initedFilter : this.filters) {
if (initedFilter.getClass() == filter.getClass()) {
exists = true;
break;
}
}
if (!exists) {
filter.init(this);
this.filters.add(filter);
}
} } | public class class_name {
private void addFilter(Filter filter) {
boolean exists = false;
for (Filter initedFilter : this.filters) {
if (initedFilter.getClass() == filter.getClass()) {
exists = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!exists) {
filter.init(this); // depends on control dependency: [if], data = [none]
this.filters.add(filter); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected EntityImporter buildEntityImporter(String upload, Class<?> clazz) {
try {
UploadedFile file = get(upload, UploadedFile.class);
if (null == file) {
logger.error("cannot get upload file {}.", upload);
return null;
}
String fileName = get(upload + "FileName");
InputStream is = new FileInputStream((File) file.getContent());
String formatName = Strings.capitalize(Strings.substringAfterLast(fileName, "."));
Option<TransferFormat> format = Enums.get(TransferFormat.class, formatName);
return (format.isDefined()) ? ImporterFactory.getEntityImporter(format.get(), is, clazz, null) : null;
} catch (Exception e) {
logger.error("error", e);
return null;
}
} } | public class class_name {
protected EntityImporter buildEntityImporter(String upload, Class<?> clazz) {
try {
UploadedFile file = get(upload, UploadedFile.class);
if (null == file) {
logger.error("cannot get upload file {}.", upload); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
String fileName = get(upload + "FileName");
InputStream is = new FileInputStream((File) file.getContent());
String formatName = Strings.capitalize(Strings.substringAfterLast(fileName, "."));
Option<TransferFormat> format = Enums.get(TransferFormat.class, formatName);
return (format.isDefined()) ? ImporterFactory.getEntityImporter(format.get(), is, clazz, null) : null; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("error", e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public T mapRow(ResultSet rs, int rowNumber) throws SQLException {
Assert.state(this.mappedClass != null, "Mapped class was not specified");
T mappedObject;
try {
mappedObject = mappedClass.newInstance();
}
catch(Exception ex) {
throw new RuntimeException(ex);
}
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
for (int index = 1; index <= columnCount; index++) {
String column = JdbcUtils.lookupColumnName(rsmd, index);
Field field = this.mappedFields.get(column.replaceAll(" ", ""));
if (field != null) {
Object value = getColumnValue(rs, index, field);
if (logger.isTraceEnabled() && rowNumber == 0) {
logger.trace("Mapping column '" + column + "' to property '" +
field.getName() + "' of type " + field.getType());
}
try {
field.set(mappedObject, value);
}
catch (IllegalArgumentException e) {
if (value == null && primitivesDefaultedForNullValue) {
logger.debug("Intercepted IllegalArgumentException for row " + rowNumber +
" and column '" + column + "' with value " + value +
" when setting property '" + field.getName() + "' of type " + field.getType() +
" on object: " + mappedObject);
}
else {
throw e;
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
return mappedObject;
} } | public class class_name {
@Override
public T mapRow(ResultSet rs, int rowNumber) throws SQLException {
Assert.state(this.mappedClass != null, "Mapped class was not specified");
T mappedObject;
try {
mappedObject = mappedClass.newInstance();
}
catch(Exception ex) {
throw new RuntimeException(ex);
}
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
for (int index = 1; index <= columnCount; index++) {
String column = JdbcUtils.lookupColumnName(rsmd, index);
Field field = this.mappedFields.get(column.replaceAll(" ", ""));
if (field != null) {
Object value = getColumnValue(rs, index, field);
if (logger.isTraceEnabled() && rowNumber == 0) {
logger.trace("Mapping column '" + column + "' to property '" +
field.getName() + "' of type " + field.getType());
}
try {
field.set(mappedObject, value);
}
catch (IllegalArgumentException e) {
if (value == null && primitivesDefaultedForNullValue) {
logger.debug("Intercepted IllegalArgumentException for row " + rowNumber +
" and column '" + column + "' with value " + value +
" when setting property '" + field.getName() + "' of type " + field.getType() +
" on object: " + mappedObject); // depends on control dependency: [if], data = [none]
}
else {
throw e;
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
return mappedObject;
} } |
public class class_name {
protected MessageFormat getMessageFormat(ResourceBundle bundle, String code, Locale locale)
throws MissingResourceException {
Map<String, Map<Locale, MessageFormat>> codeMap = this.cachedBundleMessageFormats.get(bundle);
Map<Locale, MessageFormat> localeMap = null;
if (codeMap != null) {
localeMap = codeMap.get(code);
if (localeMap != null) {
MessageFormat result = localeMap.get(locale);
if (result != null) {
return result;
}
}
}
String msg = getStringOrNull(bundle, code);
if (msg != null) {
if (codeMap == null) {
codeMap = new ConcurrentHashMap<>();
Map<String, Map<Locale, MessageFormat>> existing =
this.cachedBundleMessageFormats.putIfAbsent(bundle, codeMap);
if (existing != null) {
codeMap = existing;
}
}
if (localeMap == null) {
localeMap = new ConcurrentHashMap<>();
Map<Locale, MessageFormat> existing = codeMap.putIfAbsent(code, localeMap);
if (existing != null) {
localeMap = existing;
}
}
MessageFormat result = createMessageFormat(msg, locale);
localeMap.put(locale, result);
return result;
}
return null;
} } | public class class_name {
protected MessageFormat getMessageFormat(ResourceBundle bundle, String code, Locale locale)
throws MissingResourceException {
Map<String, Map<Locale, MessageFormat>> codeMap = this.cachedBundleMessageFormats.get(bundle);
Map<Locale, MessageFormat> localeMap = null;
if (codeMap != null) {
localeMap = codeMap.get(code);
if (localeMap != null) {
MessageFormat result = localeMap.get(locale);
if (result != null) {
return result;
}
}
}
String msg = getStringOrNull(bundle, code);
if (msg != null) {
if (codeMap == null) {
codeMap = new ConcurrentHashMap<>(); // depends on control dependency: [if], data = [none]
Map<String, Map<Locale, MessageFormat>> existing =
this.cachedBundleMessageFormats.putIfAbsent(bundle, codeMap);
if (existing != null) {
codeMap = existing; // depends on control dependency: [if], data = [none]
}
}
if (localeMap == null) {
localeMap = new ConcurrentHashMap<>(); // depends on control dependency: [if], data = [none]
Map<Locale, MessageFormat> existing = codeMap.putIfAbsent(code, localeMap);
if (existing != null) {
localeMap = existing; // depends on control dependency: [if], data = [none]
}
}
MessageFormat result = createMessageFormat(msg, locale);
localeMap.put(locale, result);
return result;
}
return null;
} } |
public class class_name {
public void to(WebContext context) {
HttpServletResponse response = context.response();
if (!mediaType.isEmpty()) {
response.setHeader("Content-Type", mediaType);
}
if (status > 0) {
response.setStatus(status);
}
try {
response.sendRedirect(response.encodeRedirectURL(url));
} catch (IOException e) {
throw new UncheckedException(e);
}
} } | public class class_name {
public void to(WebContext context) {
HttpServletResponse response = context.response();
if (!mediaType.isEmpty()) {
response.setHeader("Content-Type", mediaType); // depends on control dependency: [if], data = [none]
}
if (status > 0) {
response.setStatus(status); // depends on control dependency: [if], data = [(status]
}
try {
response.sendRedirect(response.encodeRedirectURL(url)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new UncheckedException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public GVRSceneObject getSceneObjectByName(final String name) {
if (null == name || name.isEmpty()) {
return null;
}
return mSceneRoot.getSceneObjectByName(name);
} } | public class class_name {
public GVRSceneObject getSceneObjectByName(final String name) {
if (null == name || name.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
return mSceneRoot.getSceneObjectByName(name);
} } |
public class class_name {
public static String getAbsolutePath(String path, Class<?> baseClass) {
String normalPath;
if (path == null) {
normalPath = StrUtil.EMPTY;
} else {
normalPath = normalize(path);
if (isAbsolutePath(normalPath)) {
// 给定的路径已经是绝对路径了
return normalPath;
}
}
// 相对于ClassPath路径
final URL url = ResourceUtil.getResource(normalPath, baseClass);
if (null != url) {
// 对于jar中文件包含file:前缀,需要去掉此类前缀,在此做标准化,since 3.0.8 解决中文或空格路径被编码的问题
return FileUtil.normalize(URLUtil.getDecodedPath(url));
}
// 如果资源不存在,则返回一个拼接的资源绝对路径
final String classPath = ClassUtil.getClassPath();
if (null == classPath) {
// throw new NullPointerException("ClassPath is null !");
// 在jar运行模式中,ClassPath有可能获取不到,此时返回原始相对路径(此时获取的文件为相对工作目录)
return path;
}
// 资源不存在的情况下使用标准化路径有问题,使用原始路径拼接后标准化路径
return normalize(classPath.concat(path));
} } | public class class_name {
public static String getAbsolutePath(String path, Class<?> baseClass) {
String normalPath;
if (path == null) {
normalPath = StrUtil.EMPTY;
// depends on control dependency: [if], data = [none]
} else {
normalPath = normalize(path);
// depends on control dependency: [if], data = [(path]
if (isAbsolutePath(normalPath)) {
// 给定的路径已经是绝对路径了
return normalPath;
// depends on control dependency: [if], data = [none]
}
}
// 相对于ClassPath路径
final URL url = ResourceUtil.getResource(normalPath, baseClass);
if (null != url) {
// 对于jar中文件包含file:前缀,需要去掉此类前缀,在此做标准化,since 3.0.8 解决中文或空格路径被编码的问题
return FileUtil.normalize(URLUtil.getDecodedPath(url));
// depends on control dependency: [if], data = [url)]
}
// 如果资源不存在,则返回一个拼接的资源绝对路径
final String classPath = ClassUtil.getClassPath();
if (null == classPath) {
// throw new NullPointerException("ClassPath is null !");
// 在jar运行模式中,ClassPath有可能获取不到,此时返回原始相对路径(此时获取的文件为相对工作目录)
return path;
// depends on control dependency: [if], data = [none]
}
// 资源不存在的情况下使用标准化路径有问题,使用原始路径拼接后标准化路径
return normalize(classPath.concat(path));
} } |
public class class_name {
private void loadLocalizationFromXmlBundle(Locale locale) {
CmsXmlContentValueSequence messages = m_xmlBundle.getValueSequence("Message", locale);
SortedProperties props = new SortedProperties();
if (null != messages) {
for (I_CmsXmlContentValue msg : messages.getValues()) {
String msgpath = msg.getPath();
props.put(
m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", locale),
m_xmlBundle.getStringValue(m_cms, msgpath + "/Value", locale));
}
}
m_localizations.put(locale, props);
} } | public class class_name {
private void loadLocalizationFromXmlBundle(Locale locale) {
CmsXmlContentValueSequence messages = m_xmlBundle.getValueSequence("Message", locale);
SortedProperties props = new SortedProperties();
if (null != messages) {
for (I_CmsXmlContentValue msg : messages.getValues()) {
String msgpath = msg.getPath();
props.put(
m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", locale),
m_xmlBundle.getStringValue(m_cms, msgpath + "/Value", locale)); // depends on control dependency: [for], data = [none]
}
}
m_localizations.put(locale, props);
} } |
public class class_name {
@RequirePOST
public void doStart(StaplerRequest req, StaplerResponse rsp, @QueryParameter String username, @QueryParameter String password) throws ServletException, IOException {
Jenkins hudson = Jenkins.getInstance();
hudson.checkPermission(Jenkins.ADMINISTER);
final String datasetName;
ByteArrayOutputStream log = new ByteArrayOutputStream();
StreamTaskListener listener = new StreamTaskListener(log);
try {
datasetName = createZfsFileSystem(listener,username,password);
} catch (Exception e) {
Functions.printStackTrace(e, listener.error(e.getMessage()));
if (e instanceof ZFSException) {
ZFSException ze = (ZFSException) e;
if(ze.getCode()==ErrorCode.EZFS_PERM) {
// permission problem. ask the user to give us the root password
req.setAttribute("message",log.toString());
rsp.forward(this,"askRootPassword",req);
return;
}
}
// for other kinds of problems, report and bail out
req.setAttribute("pre",true);
sendError(log.toString(),req,rsp);
return;
}
// file system creation successful, so restart
hudson.servletContext.setAttribute("app",new HudsonIsRestarting());
// redirect the user to the manage page
rsp.sendRedirect2(req.getContextPath()+"/manage");
// asynchronously restart, so that we can give a bit of time to the browser to load "restarting..." screen.
new Thread("restart thread") {
@Override
public void run() {
try {
Thread.sleep(5000);
// close all descriptors on exec except stdin,out,err
int sz = LIBC.getdtablesize();
for(int i=3; i<sz; i++) {
int flags = LIBC.fcntl(i, F_GETFD);
if(flags<0) continue;
LIBC.fcntl(i, F_SETFD,flags| FD_CLOEXEC);
}
// re-exec with the system property to indicate where to migrate the data to.
// the 2nd phase is implemented in the migrate method.
JavaVMArguments args = JavaVMArguments.current();
args.setSystemProperty(ZFSInstaller.class.getName()+".migrate",datasetName);
Daemon.selfExec(args);
} catch (InterruptedException | IOException e) {
LOGGER.log(Level.SEVERE, "Restart failed",e);
}
}
}.start();
} } | public class class_name {
@RequirePOST
public void doStart(StaplerRequest req, StaplerResponse rsp, @QueryParameter String username, @QueryParameter String password) throws ServletException, IOException {
Jenkins hudson = Jenkins.getInstance();
hudson.checkPermission(Jenkins.ADMINISTER);
final String datasetName;
ByteArrayOutputStream log = new ByteArrayOutputStream();
StreamTaskListener listener = new StreamTaskListener(log);
try {
datasetName = createZfsFileSystem(listener,username,password);
} catch (Exception e) {
Functions.printStackTrace(e, listener.error(e.getMessage()));
if (e instanceof ZFSException) {
ZFSException ze = (ZFSException) e;
if(ze.getCode()==ErrorCode.EZFS_PERM) {
// permission problem. ask the user to give us the root password
req.setAttribute("message",log.toString()); // depends on control dependency: [if], data = [none]
rsp.forward(this,"askRootPassword",req); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
// for other kinds of problems, report and bail out
req.setAttribute("pre",true);
sendError(log.toString(),req,rsp);
return;
}
// file system creation successful, so restart
hudson.servletContext.setAttribute("app",new HudsonIsRestarting());
// redirect the user to the manage page
rsp.sendRedirect2(req.getContextPath()+"/manage");
// asynchronously restart, so that we can give a bit of time to the browser to load "restarting..." screen.
new Thread("restart thread") {
@Override
public void run() {
try {
Thread.sleep(5000); // depends on control dependency: [try], data = [none]
// close all descriptors on exec except stdin,out,err
int sz = LIBC.getdtablesize();
for(int i=3; i<sz; i++) {
int flags = LIBC.fcntl(i, F_GETFD);
if(flags<0) continue;
LIBC.fcntl(i, F_SETFD,flags| FD_CLOEXEC); // depends on control dependency: [for], data = [i]
}
// re-exec with the system property to indicate where to migrate the data to.
// the 2nd phase is implemented in the migrate method.
JavaVMArguments args = JavaVMArguments.current();
args.setSystemProperty(ZFSInstaller.class.getName()+".migrate",datasetName); // depends on control dependency: [try], data = [none]
Daemon.selfExec(args); // depends on control dependency: [try], data = [none]
} catch (InterruptedException | IOException e) {
LOGGER.log(Level.SEVERE, "Restart failed",e);
} // depends on control dependency: [catch], data = [none]
}
}.start();
} } |
public class class_name {
@Deprecated
public final B uri(String uri) {
final URI parsed = URI.create(requireNonNull(uri, "uri"));
final String host = parsed.getHost();
final int port = parsed.getPort();
checkArgument(host != null, "uri: %s (must contain a host part)", uri);
if (port < 0) {
host(host);
} else {
host(host, port);
}
return self();
} } | public class class_name {
@Deprecated
public final B uri(String uri) {
final URI parsed = URI.create(requireNonNull(uri, "uri"));
final String host = parsed.getHost();
final int port = parsed.getPort();
checkArgument(host != null, "uri: %s (must contain a host part)", uri);
if (port < 0) {
host(host); // depends on control dependency: [if], data = [none]
} else {
host(host, port); // depends on control dependency: [if], data = [none]
}
return self();
} } |
public class class_name {
public void setAZList(java.util.Collection<String> aZList) {
if (aZList == null) {
this.aZList = null;
return;
}
this.aZList = new com.amazonaws.internal.SdkInternalList<String>(aZList);
} } | public class class_name {
public void setAZList(java.util.Collection<String> aZList) {
if (aZList == null) {
this.aZList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.aZList = new com.amazonaws.internal.SdkInternalList<String>(aZList);
} } |
public class class_name {
public void setOfferingPromotions(java.util.Collection<OfferingPromotion> offeringPromotions) {
if (offeringPromotions == null) {
this.offeringPromotions = null;
return;
}
this.offeringPromotions = new java.util.ArrayList<OfferingPromotion>(offeringPromotions);
} } | public class class_name {
public void setOfferingPromotions(java.util.Collection<OfferingPromotion> offeringPromotions) {
if (offeringPromotions == null) {
this.offeringPromotions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.offeringPromotions = new java.util.ArrayList<OfferingPromotion>(offeringPromotions);
} } |
public class class_name {
public SessionAffinityContext analyzeSSLRequest(ServletRequest request, String sslSessionId) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[ANALYZE_SSL_REQUEST]);
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[ANALYZE_SSL_REQUEST], "SSL Id from Request = " + sslSessionId);
}
String sessionId = sslSessionId;
boolean reqFromCookie = false;
boolean reqFromURL = false;
boolean reqFromSSL = false;
SessionAffinityContext sessionAffinityContext = null;
List allSessionIds = null;
IExtendedRequest sessReq = (IExtendedRequest) request;
if (sessionId != null) {
reqFromSSL = true;
String tempDummyId;
String tempCacheId;
if (_smc.isUsingMemory()) {
tempCacheId = "0000";
} else {
tempCacheId = "0001";
}
String tempCloneInfo = "";
// look for cacheid and clone info in the cookie or Rewritten URL
// cmd 213330 start
String extendedId = null;
byte[] byteExtendedId = sessReq.getCookieValueAsBytes(SessionManagerConfig.dcookieName);
if (byteExtendedId != null) {
extendedId = new String(byteExtendedId);
} // cmd 213330 end
if (extendedId == null) {
extendedId = getRequestedSessionIdFromURL(request);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[ANALYZE_SSL_REQUEST], "getRequestedSessionId - encoded URL contains: "
+ extendedId);
}
}
if (extendedId != null) {
tempCacheId = extendedId.substring(0, 4); // cacheid is always first
int index = extendedId.indexOf(SessionManagerConfig.getCloneSeparator());
if (index != -1) {
tempDummyId = extendedId.substring(4, index);
tempCloneInfo = extendedId.substring(index);
}
}
sessionId = tempCacheId + SessionAffinityContext.SSLSessionId + tempCloneInfo;
allSessionIds = new ArrayList(1);
allSessionIds.add(0, sessionId);
sessionAffinityContext = new SessionAffinityContext(allSessionIds, reqFromCookie, reqFromURL, reqFromSSL);
setNextId(sessionAffinityContext);
}
// Use SSL Sessionid NOT dummy id
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[ANALYZE_SSL_REQUEST], "getRequestedSessionId - massaged long SSL id is now: " + sessionId);
}
// returns null if no SSL context
return sessionAffinityContext;
} } | public class class_name {
public SessionAffinityContext analyzeSSLRequest(ServletRequest request, String sslSessionId) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[ANALYZE_SSL_REQUEST]); // depends on control dependency: [if], data = [none]
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[ANALYZE_SSL_REQUEST], "SSL Id from Request = " + sslSessionId); // depends on control dependency: [if], data = [none]
}
String sessionId = sslSessionId;
boolean reqFromCookie = false;
boolean reqFromURL = false;
boolean reqFromSSL = false;
SessionAffinityContext sessionAffinityContext = null;
List allSessionIds = null;
IExtendedRequest sessReq = (IExtendedRequest) request;
if (sessionId != null) {
reqFromSSL = true; // depends on control dependency: [if], data = [none]
String tempDummyId;
String tempCacheId;
if (_smc.isUsingMemory()) {
tempCacheId = "0000"; // depends on control dependency: [if], data = [none]
} else {
tempCacheId = "0001"; // depends on control dependency: [if], data = [none]
}
String tempCloneInfo = "";
// look for cacheid and clone info in the cookie or Rewritten URL
// cmd 213330 start
String extendedId = null;
byte[] byteExtendedId = sessReq.getCookieValueAsBytes(SessionManagerConfig.dcookieName);
if (byteExtendedId != null) {
extendedId = new String(byteExtendedId); // depends on control dependency: [if], data = [(byteExtendedId]
} // cmd 213330 end
if (extendedId == null) {
extendedId = getRequestedSessionIdFromURL(request); // depends on control dependency: [if], data = [none]
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[ANALYZE_SSL_REQUEST], "getRequestedSessionId - encoded URL contains: "
+ extendedId); // depends on control dependency: [if], data = [none]
}
}
if (extendedId != null) {
tempCacheId = extendedId.substring(0, 4); // cacheid is always first // depends on control dependency: [if], data = [none]
int index = extendedId.indexOf(SessionManagerConfig.getCloneSeparator());
if (index != -1) {
tempDummyId = extendedId.substring(4, index); // depends on control dependency: [if], data = [none]
tempCloneInfo = extendedId.substring(index); // depends on control dependency: [if], data = [(index]
}
}
sessionId = tempCacheId + SessionAffinityContext.SSLSessionId + tempCloneInfo; // depends on control dependency: [if], data = [none]
allSessionIds = new ArrayList(1); // depends on control dependency: [if], data = [none]
allSessionIds.add(0, sessionId); // depends on control dependency: [if], data = [none]
sessionAffinityContext = new SessionAffinityContext(allSessionIds, reqFromCookie, reqFromURL, reqFromSSL); // depends on control dependency: [if], data = [none]
setNextId(sessionAffinityContext); // depends on control dependency: [if], data = [none]
}
// Use SSL Sessionid NOT dummy id
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, methodNames[ANALYZE_SSL_REQUEST], "getRequestedSessionId - massaged long SSL id is now: " + sessionId); // depends on control dependency: [if], data = [none]
}
// returns null if no SSL context
return sessionAffinityContext;
} } |
public class class_name {
public Throwable getRootCause() {
Throwable throwable = super.getCause();
if (throwable instanceof IDelegated) {
return ((IDelegated) throwable).getRootCause();
}
if (throwable == null) {
return new Exception("");
} else {
return throwable;
}
} } | public class class_name {
public Throwable getRootCause() {
Throwable throwable = super.getCause();
if (throwable instanceof IDelegated) {
return ((IDelegated) throwable).getRootCause(); // depends on control dependency: [if], data = [none]
}
if (throwable == null) {
return new Exception(""); // depends on control dependency: [if], data = [none]
} else {
return throwable; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void analyze(Response response) {
if (response != null) {
logger.info("NO-OP Response for user <" + response.getUser().getUsername() + "> - should be executing response action " + response.getAction());
}
} } | public class class_name {
@Override
public void analyze(Response response) {
if (response != null) {
logger.info("NO-OP Response for user <" + response.getUser().getUsername() + "> - should be executing response action " + response.getAction()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void createVersion(Node nodeVersioning) throws Exception {
if(!nodeVersioning.isNodeType(NT_FILE)) {
if(log.isDebugEnabled()){
log.debug("Version history is not impact with non-nt:file documents, there'is not any version created.");
}
return;
}
if(!nodeVersioning.isNodeType(MIX_VERSIONABLE)){
if(nodeVersioning.canAddMixin(MIX_VERSIONABLE)) {
nodeVersioning.addMixin(MIX_VERSIONABLE);
nodeVersioning.save();
}
return;
}
if (!nodeVersioning.isCheckedOut())
{
nodeVersioning.checkout();
}
else
{
nodeVersioning.checkin();
nodeVersioning.checkout();
}
if(maxAllowVersion!= DOCUMENT_AUTO_DEFAULT_VERSION_MAX || maxLiveTime != DOCUMENT_AUTO_DEFAULT_VERSION_EXPIRED) {
removeRedundant(nodeVersioning);
}
nodeVersioning.save();
} } | public class class_name {
public static void createVersion(Node nodeVersioning) throws Exception {
if(!nodeVersioning.isNodeType(NT_FILE)) {
if(log.isDebugEnabled()){
log.debug("Version history is not impact with non-nt:file documents, there'is not any version created."); // depends on control dependency: [if], data = [none]
}
return;
}
if(!nodeVersioning.isNodeType(MIX_VERSIONABLE)){
if(nodeVersioning.canAddMixin(MIX_VERSIONABLE)) {
nodeVersioning.addMixin(MIX_VERSIONABLE); // depends on control dependency: [if], data = [none]
nodeVersioning.save(); // depends on control dependency: [if], data = [none]
}
return;
}
if (!nodeVersioning.isCheckedOut())
{
nodeVersioning.checkout();
}
else
{
nodeVersioning.checkin();
nodeVersioning.checkout();
}
if(maxAllowVersion!= DOCUMENT_AUTO_DEFAULT_VERSION_MAX || maxLiveTime != DOCUMENT_AUTO_DEFAULT_VERSION_EXPIRED) {
removeRedundant(nodeVersioning);
}
nodeVersioning.save();
} } |
public class class_name {
private boolean canAccessDeprecatedTypes(NodeTraversal t) {
Node scopeRoot = t.getClosestHoistScopeRoot();
if (NodeUtil.isFunctionBlock(scopeRoot)) {
scopeRoot = scopeRoot.getParent();
}
Node scopeRootParent = scopeRoot.getParent();
return
// Case #1
(deprecationDepth > 0)
// Case #2
|| (getTypeDeprecationInfo(getTypeOfThis(scopeRoot)) != null)
// Case #3
|| (scopeRootParent != null
&& scopeRootParent.isAssign()
&& getTypeDeprecationInfo(bestInstanceTypeForMethodOrCtor(scopeRoot)) != null);
} } | public class class_name {
private boolean canAccessDeprecatedTypes(NodeTraversal t) {
Node scopeRoot = t.getClosestHoistScopeRoot();
if (NodeUtil.isFunctionBlock(scopeRoot)) {
scopeRoot = scopeRoot.getParent(); // depends on control dependency: [if], data = [none]
}
Node scopeRootParent = scopeRoot.getParent();
return
// Case #1
(deprecationDepth > 0)
// Case #2
|| (getTypeDeprecationInfo(getTypeOfThis(scopeRoot)) != null)
// Case #3
|| (scopeRootParent != null
&& scopeRootParent.isAssign()
&& getTypeDeprecationInfo(bestInstanceTypeForMethodOrCtor(scopeRoot)) != null);
} } |
public class class_name {
public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) {
for (MethodDescription.InDefinedShape methodDescription : typeDescription.getDeclaredMethods()
.filter(not(isBridge()).<MethodDescription>and(isAnnotatedWith(Enhance.class)))) {
if (methodDescription.isAbstract()) {
throw new IllegalStateException("Cannot cache the value of an abstract method: " + methodDescription);
} else if (!methodDescription.getParameters().isEmpty()) {
throw new IllegalStateException("Cannot cache the value of a method with parameters: " + methodDescription);
} else if (methodDescription.getReturnType().represents(void.class)) {
throw new IllegalStateException("Cannot cache void result for " + methodDescription);
}
String name = methodDescription.getDeclaredAnnotations().ofType(Enhance.class).loadSilent().value();
if (name.length() == 0) {
name = methodDescription.getName() + NAME_INFIX + randomString.nextString();
}
builder = builder
.defineField(name, methodDescription.getReturnType().asErasure(), methodDescription.isStatic()
? Ownership.STATIC
: Ownership.MEMBER, Visibility.PRIVATE, SyntheticState.SYNTHETIC, FieldPersistence.TRANSIENT)
.visit(Advice.withCustomMapping()
.bind(CacheField.class, new CacheFieldOffsetMapping(name))
.to(adviceByType.get(methodDescription.getReturnType().isPrimitive()
? methodDescription.getReturnType().asErasure()
: TypeDescription.OBJECT), this.classFileLocator)
.on(is(methodDescription)));
}
return builder;
} } | public class class_name {
public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator) {
for (MethodDescription.InDefinedShape methodDescription : typeDescription.getDeclaredMethods()
.filter(not(isBridge()).<MethodDescription>and(isAnnotatedWith(Enhance.class)))) {
if (methodDescription.isAbstract()) {
throw new IllegalStateException("Cannot cache the value of an abstract method: " + methodDescription);
} else if (!methodDescription.getParameters().isEmpty()) {
throw new IllegalStateException("Cannot cache the value of a method with parameters: " + methodDescription);
} else if (methodDescription.getReturnType().represents(void.class)) {
throw new IllegalStateException("Cannot cache void result for " + methodDescription);
}
String name = methodDescription.getDeclaredAnnotations().ofType(Enhance.class).loadSilent().value();
if (name.length() == 0) {
name = methodDescription.getName() + NAME_INFIX + randomString.nextString(); // depends on control dependency: [if], data = [none]
}
builder = builder
.defineField(name, methodDescription.getReturnType().asErasure(), methodDescription.isStatic()
? Ownership.STATIC
: Ownership.MEMBER, Visibility.PRIVATE, SyntheticState.SYNTHETIC, FieldPersistence.TRANSIENT)
.visit(Advice.withCustomMapping()
.bind(CacheField.class, new CacheFieldOffsetMapping(name))
.to(adviceByType.get(methodDescription.getReturnType().isPrimitive()
? methodDescription.getReturnType().asErasure()
: TypeDescription.OBJECT), this.classFileLocator)
.on(is(methodDescription))); // depends on control dependency: [for], data = [none]
}
return builder;
} } |
public class class_name {
private static Properties initProperties() {
InputStream stream = null;
try {
// TODO: limited to known drivers, better find driver later based on JDBC connection URL without "simon" word
Properties properties = new Properties();
stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("org/javasimon/jdbc4/drivers.properties");
if (stream != null) {
properties.load(stream);
}
return properties;
} catch (IOException e) {
throw new IllegalStateException(e);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// Doesn't matter
}
}
}
} } | public class class_name {
private static Properties initProperties() {
InputStream stream = null;
try {
// TODO: limited to known drivers, better find driver later based on JDBC connection URL without "simon" word
Properties properties = new Properties();
stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("org/javasimon/jdbc4/drivers.properties");
if (stream != null) {
properties.load(stream); // depends on control dependency: [try], data = [none]
}
return properties;
} catch (IOException e) {
throw new IllegalStateException(e);
} finally { // depends on control dependency: [catch], data = [none]
if (stream != null) {
try {
stream.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// Doesn't matter
} // depends on control dependency: [catch], data = [none]
}
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.