code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public ValidationReport validateIsotopeExistence(IIsotope isotope) {
ValidationReport report = new ValidationReport();
ValidationTest isotopeExists = new ValidationTest(isotope,
"Isotope with this mass number is not known for this element.");
try {
IsotopeFactory isotopeFac = Isotopes.getInstance();
IIsotope[] isotopes = isotopeFac.getIsotopes(isotope.getSymbol());
if (isotope.getMassNumber() != null &&
isotope.getMassNumber() != 0) {
boolean foundKnownIsotope = false;
for (int i = 0; i < isotopes.length; i++) {
if (Objects.equals(isotopes[i].getMassNumber(), isotope.getMassNumber())) {
foundKnownIsotope = true;
}
}
if (!foundKnownIsotope) {
report.addError(isotopeExists);
} else {
report.addOK(isotopeExists);
}
} else {
// isotopic is unspecified
report.addOK(isotopeExists);
}
} catch (Exception exception) {
// too bad...
}
return report;
} }
|
public class class_name {
public ValidationReport validateIsotopeExistence(IIsotope isotope) {
ValidationReport report = new ValidationReport();
ValidationTest isotopeExists = new ValidationTest(isotope,
"Isotope with this mass number is not known for this element.");
try {
IsotopeFactory isotopeFac = Isotopes.getInstance();
IIsotope[] isotopes = isotopeFac.getIsotopes(isotope.getSymbol());
if (isotope.getMassNumber() != null &&
isotope.getMassNumber() != 0) {
boolean foundKnownIsotope = false;
for (int i = 0; i < isotopes.length; i++) {
if (Objects.equals(isotopes[i].getMassNumber(), isotope.getMassNumber())) {
foundKnownIsotope = true; // depends on control dependency: [if], data = [none]
}
}
if (!foundKnownIsotope) {
report.addError(isotopeExists); // depends on control dependency: [if], data = [none]
} else {
report.addOK(isotopeExists); // depends on control dependency: [if], data = [none]
}
} else {
// isotopic is unspecified
report.addOK(isotopeExists); // depends on control dependency: [if], data = [none]
}
} catch (Exception exception) {
// too bad...
} // depends on control dependency: [catch], data = [none]
return report;
} }
|
public class class_name {
public static float bigram(List<Word> words){
if(words.size() > 1){
float score=0;
for(int i=0; i<words.size()-1; i++){
score += getScore(words.get(i).getText(), words.get(i+1).getText());
}
return score;
}
return 0;
} }
|
public class class_name {
public static float bigram(List<Word> words){
if(words.size() > 1){
float score=0;
for(int i=0; i<words.size()-1; i++){
score += getScore(words.get(i).getText(), words.get(i+1).getText()); // depends on control dependency: [for], data = [i]
}
return score; // depends on control dependency: [if], data = [none]
}
return 0;
} }
|
public class class_name {
@SneakyThrows
public DataSource createDataSource() {
DataSource result = (DataSource) Class.forName(dataSourceClassName).newInstance();
Method[] methods = result.getClass().getMethods();
for (Entry<String, Object> entry : properties.entrySet()) {
if (SKIPPED_PROPERTY_NAMES.contains(entry.getKey())) {
continue;
}
Optional<Method> setterMethod = findSetterMethod(methods, entry.getKey());
if (setterMethod.isPresent()) {
setterMethod.get().invoke(result, entry.getValue());
}
}
return result;
} }
|
public class class_name {
@SneakyThrows
public DataSource createDataSource() {
DataSource result = (DataSource) Class.forName(dataSourceClassName).newInstance();
Method[] methods = result.getClass().getMethods();
for (Entry<String, Object> entry : properties.entrySet()) {
if (SKIPPED_PROPERTY_NAMES.contains(entry.getKey())) {
continue;
}
Optional<Method> setterMethod = findSetterMethod(methods, entry.getKey());
if (setterMethod.isPresent()) {
setterMethod.get().invoke(result, entry.getValue()); // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
@Override
public void load(boolean alpha)
{
ImageBuffer surface = Graphics.getImageBuffer(media);
if (0 != Double.compare(factorH, 1.0) || 0 != Double.compare(factorV, 1.0))
{
final int x = (int) (surface.getWidth() * factorH);
final int y = (int) (surface.getHeight() * factorV);
surface = Graphics.resize(surface, x, y);
}
lineWidth = (int) Math.floor(surface.getWidth() * sx / 100.0);
lineHeight = (int) Math.floor(surface.getHeight() / (double) linesNumber * sy / 100.0);
lines = Graphics.splitImage(surface, 1, linesNumber);
final double factH = sx / 100.0 / AMPLITUDE_FACTOR;
for (int i = 0; i < linesNumber; i++)
{
final int width = (int) Math.ceil(lines[i].getWidth() * (sx + i * 2 * factH) / 100);
final int height = lines[i].getHeight() * sy / 100;
lines[i] = Graphics.resize(lines[i], width, height);
}
} }
|
public class class_name {
@Override
public void load(boolean alpha)
{
ImageBuffer surface = Graphics.getImageBuffer(media);
if (0 != Double.compare(factorH, 1.0) || 0 != Double.compare(factorV, 1.0))
{
final int x = (int) (surface.getWidth() * factorH);
final int y = (int) (surface.getHeight() * factorV);
surface = Graphics.resize(surface, x, y); // depends on control dependency: [if], data = [none]
}
lineWidth = (int) Math.floor(surface.getWidth() * sx / 100.0);
lineHeight = (int) Math.floor(surface.getHeight() / (double) linesNumber * sy / 100.0);
lines = Graphics.splitImage(surface, 1, linesNumber);
final double factH = sx / 100.0 / AMPLITUDE_FACTOR;
for (int i = 0; i < linesNumber; i++)
{
final int width = (int) Math.ceil(lines[i].getWidth() * (sx + i * 2 * factH) / 100);
final int height = lines[i].getHeight() * sy / 100;
lines[i] = Graphics.resize(lines[i], width, height); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public void setMetricDataQueries(java.util.Collection<MetricDataQuery> metricDataQueries) {
if (metricDataQueries == null) {
this.metricDataQueries = null;
return;
}
this.metricDataQueries = new com.amazonaws.internal.SdkInternalList<MetricDataQuery>(metricDataQueries);
} }
|
public class class_name {
public void setMetricDataQueries(java.util.Collection<MetricDataQuery> metricDataQueries) {
if (metricDataQueries == null) {
this.metricDataQueries = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.metricDataQueries = new com.amazonaws.internal.SdkInternalList<MetricDataQuery>(metricDataQueries);
} }
|
public class class_name {
public static String launchProcess(final String command,
final Map<String, String> environment, boolean backend) throws IOException {
String[] cmds = command.split(" ");
ArrayList<String> cmdList = new ArrayList<>();
for (String tok : cmds) {
if (!StringUtils.isBlank(tok)) {
cmdList.add(tok);
}
}
return launchProcess(command, cmdList, environment, backend);
} }
|
public class class_name {
public static String launchProcess(final String command,
final Map<String, String> environment, boolean backend) throws IOException {
String[] cmds = command.split(" ");
ArrayList<String> cmdList = new ArrayList<>();
for (String tok : cmds) {
if (!StringUtils.isBlank(tok)) {
cmdList.add(tok); // depends on control dependency: [if], data = [none]
}
}
return launchProcess(command, cmdList, environment, backend);
} }
|
public class class_name {
public java.util.List<ReservedInstancesOffering> getReservedInstancesOfferings() {
if (reservedInstancesOfferings == null) {
reservedInstancesOfferings = new com.amazonaws.internal.SdkInternalList<ReservedInstancesOffering>();
}
return reservedInstancesOfferings;
} }
|
public class class_name {
public java.util.List<ReservedInstancesOffering> getReservedInstancesOfferings() {
if (reservedInstancesOfferings == null) {
reservedInstancesOfferings = new com.amazonaws.internal.SdkInternalList<ReservedInstancesOffering>(); // depends on control dependency: [if], data = [none]
}
return reservedInstancesOfferings;
} }
|
public class class_name {
public void senSegment(String text, List senList){
senList.clear();
String resultStr = senSegment(text);
StringTokenizer senTknr = new StringTokenizer(resultStr, "\n");
while(senTknr.hasMoreTokens()){
senList.add(senTknr.nextToken());
}
} }
|
public class class_name {
public void senSegment(String text, List senList){
senList.clear();
String resultStr = senSegment(text);
StringTokenizer senTknr = new StringTokenizer(resultStr, "\n");
while(senTknr.hasMoreTokens()){
senList.add(senTknr.nextToken()); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
@Override
public Entity findOne(Query<Entity> query) {
if (transactionInformation.isRepositoryCompletelyClean(getEntityType()) && cacheable) {
// pageSize is irrelevant for findOne, would be a waste to cache them in different entries
// sort may affect which of the results is the first result, so cannot ignore that.
QueryImpl<Entity> cacheKey = new QueryImpl<>(query).setPageSize(1);
List<Object> ids = l3Cache.get(delegate(), cacheKey);
if (ids.isEmpty()) {
return null;
}
return delegate().findOneById(ids.get(0), query.getFetch());
}
return delegate().findOne(query);
} }
|
public class class_name {
@Override
public Entity findOne(Query<Entity> query) {
if (transactionInformation.isRepositoryCompletelyClean(getEntityType()) && cacheable) {
// pageSize is irrelevant for findOne, would be a waste to cache them in different entries
// sort may affect which of the results is the first result, so cannot ignore that.
QueryImpl<Entity> cacheKey = new QueryImpl<>(query).setPageSize(1);
List<Object> ids = l3Cache.get(delegate(), cacheKey);
if (ids.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
return delegate().findOneById(ids.get(0), query.getFetch()); // depends on control dependency: [if], data = [none]
}
return delegate().findOne(query);
} }
|
public class class_name {
private void updateIndentation(float indentLeft, float indentRight, float indentContent) {
if(this.title != null) {
this.title.setIndentLeft((int) (this.title.getIndentLeft() + indentLeft * RtfElement.TWIPS_FACTOR));
this.title.setIndentRight((int) (this.title.getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR));
}
for(int i = 0; i < this.items.size(); i++) {
RtfBasicElement rtfElement = (RtfBasicElement) this.items.get(i);
if(rtfElement instanceof RtfSection) {
((RtfSection) rtfElement).updateIndentation(indentLeft + indentContent, indentRight, 0);
} else if(rtfElement instanceof RtfParagraph) {
((RtfParagraph) rtfElement).setIndentLeft((int) (((RtfParagraph) rtfElement).getIndentLeft() + (indentLeft + indentContent) * RtfElement.TWIPS_FACTOR));
((RtfParagraph) rtfElement).setIndentRight((int) (((RtfParagraph) rtfElement).getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR));
}
}
} }
|
public class class_name {
private void updateIndentation(float indentLeft, float indentRight, float indentContent) {
if(this.title != null) {
this.title.setIndentLeft((int) (this.title.getIndentLeft() + indentLeft * RtfElement.TWIPS_FACTOR)); // depends on control dependency: [if], data = [(this.title]
this.title.setIndentRight((int) (this.title.getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR)); // depends on control dependency: [if], data = [(this.title]
}
for(int i = 0; i < this.items.size(); i++) {
RtfBasicElement rtfElement = (RtfBasicElement) this.items.get(i);
if(rtfElement instanceof RtfSection) {
((RtfSection) rtfElement).updateIndentation(indentLeft + indentContent, indentRight, 0); // depends on control dependency: [if], data = [none]
} else if(rtfElement instanceof RtfParagraph) {
((RtfParagraph) rtfElement).setIndentLeft((int) (((RtfParagraph) rtfElement).getIndentLeft() + (indentLeft + indentContent) * RtfElement.TWIPS_FACTOR)); // depends on control dependency: [if], data = [none]
((RtfParagraph) rtfElement).setIndentRight((int) (((RtfParagraph) rtfElement).getIndentRight() + indentRight * RtfElement.TWIPS_FACTOR)); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public EClass getIfcTorqueMeasure() {
if (ifcTorqueMeasureEClass == null) {
ifcTorqueMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(757);
}
return ifcTorqueMeasureEClass;
} }
|
public class class_name {
public EClass getIfcTorqueMeasure() {
if (ifcTorqueMeasureEClass == null) {
ifcTorqueMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(757);
// depends on control dependency: [if], data = [none]
}
return ifcTorqueMeasureEClass;
} }
|
public class class_name {
public VoidAggregation nextCandidate() {
VoidAggregation result = completedQueue.poll();
// removing aggregation from tracking table
if (result != null) {
completedCounter.decrementAndGet();
unpin(result.getOriginatorId(), result.getTaskId());
}
return result;
} }
|
public class class_name {
public VoidAggregation nextCandidate() {
VoidAggregation result = completedQueue.poll();
// removing aggregation from tracking table
if (result != null) {
completedCounter.decrementAndGet(); // depends on control dependency: [if], data = [none]
unpin(result.getOriginatorId(), result.getTaskId()); // depends on control dependency: [if], data = [(result]
}
return result;
} }
|
public class class_name {
public UpdateHealthCheckRequest withResetElements(ResettableElementName... resetElements) {
com.amazonaws.internal.SdkInternalList<String> resetElementsCopy = new com.amazonaws.internal.SdkInternalList<String>(resetElements.length);
for (ResettableElementName value : resetElements) {
resetElementsCopy.add(value.toString());
}
if (getResetElements() == null) {
setResetElements(resetElementsCopy);
} else {
getResetElements().addAll(resetElementsCopy);
}
return this;
} }
|
public class class_name {
public UpdateHealthCheckRequest withResetElements(ResettableElementName... resetElements) {
com.amazonaws.internal.SdkInternalList<String> resetElementsCopy = new com.amazonaws.internal.SdkInternalList<String>(resetElements.length);
for (ResettableElementName value : resetElements) {
resetElementsCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getResetElements() == null) {
setResetElements(resetElementsCopy); // depends on control dependency: [if], data = [none]
} else {
getResetElements().addAll(resetElementsCopy); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
static @Nullable String[] createKeysFromArray(
@Nullable final String[] array,
@Nullable final String... keys) {
if (isNullOrEmpty(keys)) {
return array;
}
if (isNullOrEmpty(array)) {
return keys;
}
final String[] combined = Arrays.copyOf(keys, array.length + keys.length);
for (int i = 0; i < array.length; ++i) {
combined[keys.length + i] = array[i];
}
return combined;
} }
|
public class class_name {
static @Nullable String[] createKeysFromArray(
@Nullable final String[] array,
@Nullable final String... keys) {
if (isNullOrEmpty(keys)) {
return array; // depends on control dependency: [if], data = [none]
}
if (isNullOrEmpty(array)) {
return keys; // depends on control dependency: [if], data = [none]
}
final String[] combined = Arrays.copyOf(keys, array.length + keys.length);
for (int i = 0; i < array.length; ++i) {
combined[keys.length + i] = array[i]; // depends on control dependency: [for], data = [i]
}
return combined;
} }
|
public class class_name {
public static Date getDateUsingRegExpAndDateFormat( String dateString,
String matchPattern,
String substitutionPattern,
String dateFormatString )
{
// Match the given date string against the regular expression.
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile( matchPattern );
java.util.regex.Matcher matcher = pattern.matcher( dateString );
if ( ! matcher.matches() )
{
return null;
}
// Build date string to use with date format string by
// substituting the capture groups into the substitution pattern.
StringBuffer dateStringFormatted = new StringBuffer();
matcher.appendReplacement( dateStringFormatted, substitutionPattern );
if ( dateStringFormatted.length() == 0 )
{
return null;
}
return getDateUsingCompleteDateFormat( dateStringFormatted.toString(), dateFormatString );
} }
|
public class class_name {
public static Date getDateUsingRegExpAndDateFormat( String dateString,
String matchPattern,
String substitutionPattern,
String dateFormatString )
{
// Match the given date string against the regular expression.
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile( matchPattern );
java.util.regex.Matcher matcher = pattern.matcher( dateString );
if ( ! matcher.matches() )
{
return null; // depends on control dependency: [if], data = [none]
}
// Build date string to use with date format string by
// substituting the capture groups into the substitution pattern.
StringBuffer dateStringFormatted = new StringBuffer();
matcher.appendReplacement( dateStringFormatted, substitutionPattern );
if ( dateStringFormatted.length() == 0 )
{
return null; // depends on control dependency: [if], data = [none]
}
return getDateUsingCompleteDateFormat( dateStringFormatted.toString(), dateFormatString );
} }
|
public class class_name {
public static String toHalfWidthString(CharSequence str) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
sb.append(toHalfWidthCharacter(str.charAt(i)));
}
return sb.toString();
} }
|
public class class_name {
public static String toHalfWidthString(CharSequence str) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
sb.append(toHalfWidthCharacter(str.charAt(i)));
// depends on control dependency: [for], data = [i]
}
return sb.toString();
} }
|
public class class_name {
public Class getSetClass(SetExecutor setExecutor, Class srcRefClass, Class getResultClass) {
if (setExecutor instanceof MapSetExecutor) {
if (getResultClass != null) {
return getResultClass;// 优先设置为getResult的class对象
}
} else if (setExecutor instanceof FastPropertySetExecutor) {
return getTargetClass(((FastPropertySetExecutor) setExecutor).getMethod().getJavaMethod());
} else if (setExecutor instanceof PropertySetExecutor) {
return getTargetClass(((PropertySetExecutor) setExecutor).getMethod());
} else if (setExecutor instanceof FieldSetExecutor) {
return ((FieldSetExecutor) setExecutor).getField().getType();
}
return null;
// throw new BeanMappingException("unknow SetExecutor");
} }
|
public class class_name {
public Class getSetClass(SetExecutor setExecutor, Class srcRefClass, Class getResultClass) {
if (setExecutor instanceof MapSetExecutor) {
if (getResultClass != null) {
return getResultClass;// 优先设置为getResult的class对象 // depends on control dependency: [if], data = [none]
}
} else if (setExecutor instanceof FastPropertySetExecutor) {
return getTargetClass(((FastPropertySetExecutor) setExecutor).getMethod().getJavaMethod());
} else if (setExecutor instanceof PropertySetExecutor) {
return getTargetClass(((PropertySetExecutor) setExecutor).getMethod());
} else if (setExecutor instanceof FieldSetExecutor) {
return ((FieldSetExecutor) setExecutor).getField().getType();
}
return null;
// throw new BeanMappingException("unknow SetExecutor");
} }
|
public class class_name {
public synchronized void reset() {
final String methodName = "reset()";
this.currentDataGB = 1;
if (this.currentDependencyIdGB > 0) {
this.currentDependencyIdGB = 1;
}
if (this.currentTemplateGB > 0) {
this.currentTemplateGB = 1;
}
if (this.diskCacheSizeInGBLimit > 0) {
this.diskCacheSizeInBytesLimit = (diskCacheSizeInGBLimit - this.currentDependencyIdGB - this.currentTemplateGB) * GB_SIZE;
this.diskCacheSizeInBytesHighLimit = (this.diskCacheSizeInBytesLimit * (long)this.highThreshold) / 100l;
this.diskCacheSizeInBytesLowLimit = (this.diskCacheSizeInBytesLimit * (long)this.lowThreshold ) / 100l;
traceDebug(methodName, "cacheName=" + this.cacheName + " diskCacheSizeInBytesLimit=" + this.diskCacheSizeInBytesLimit + " diskCacheSizeInBytesHighLimit=" + this.diskCacheSizeInBytesHighLimit + " diskCacheSizeInBytesLowLimit=" + this.diskCacheSizeInBytesLowLimit + " currentDataGB=" + this.currentDataGB + " currentDependencyIdGB=" + this.currentDependencyIdGB + " currentTemplateGB=" + this.currentTemplateGB);
}
} }
|
public class class_name {
public synchronized void reset() {
final String methodName = "reset()";
this.currentDataGB = 1;
if (this.currentDependencyIdGB > 0) {
this.currentDependencyIdGB = 1; // depends on control dependency: [if], data = [none]
}
if (this.currentTemplateGB > 0) {
this.currentTemplateGB = 1; // depends on control dependency: [if], data = [none]
}
if (this.diskCacheSizeInGBLimit > 0) {
this.diskCacheSizeInBytesLimit = (diskCacheSizeInGBLimit - this.currentDependencyIdGB - this.currentTemplateGB) * GB_SIZE; // depends on control dependency: [if], data = [none]
this.diskCacheSizeInBytesHighLimit = (this.diskCacheSizeInBytesLimit * (long)this.highThreshold) / 100l; // depends on control dependency: [if], data = [none]
this.diskCacheSizeInBytesLowLimit = (this.diskCacheSizeInBytesLimit * (long)this.lowThreshold ) / 100l; // depends on control dependency: [if], data = [none]
traceDebug(methodName, "cacheName=" + this.cacheName + " diskCacheSizeInBytesLimit=" + this.diskCacheSizeInBytesLimit + " diskCacheSizeInBytesHighLimit=" + this.diskCacheSizeInBytesHighLimit + " diskCacheSizeInBytesLowLimit=" + this.diskCacheSizeInBytesLowLimit + " currentDataGB=" + this.currentDataGB + " currentDependencyIdGB=" + this.currentDependencyIdGB + " currentTemplateGB=" + this.currentTemplateGB); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public EClass getObjectCount() {
if (objectCountEClass == null) {
objectCountEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(513);
}
return objectCountEClass;
} }
|
public class class_name {
public EClass getObjectCount() {
if (objectCountEClass == null) {
objectCountEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(513); // depends on control dependency: [if], data = [none]
}
return objectCountEClass;
} }
|
public class class_name {
@Validate
public synchronized void configure() {
// Thymeleaf specifics
String mode = configuration.getWithDefault("application.template.thymeleaf.mode", "HTML5");
int ttl = configuration.getIntegerWithDefault("application.template.thymeleaf.ttl", 60 * 1000);
if (configuration.isDev()) {
// In dev mode, reduce the ttl to the strict minimum so we are sure to have updated template rendering.
ttl = 1;
}
LOGGER.debug("Thymeleaf configuration: mode={}, ttl={}", mode, ttl);
// A TCCL switch is required here as the default Thymeleaf engine initialization triggers a class loading
// from a class that may be present in the class path (org/apache/xerces/xni/parser/XMLParserConfiguration).
// By setting the TCCL, it fails quietly, if not, it may find it but failed to instantiate it (version
// mismatch or whatever). As this class is only used to support the HTML5LEGACY Templates (so not use here),
// we don't really care.
final ClassLoader orig = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
engine = new WisdomTemplateEngine(dialects);
} finally {
Thread.currentThread().setContextClassLoader(orig);
}
// Initiate the template resolver.
TemplateResolver resolver = new TemplateResolver();
resolver.setResourceResolver(new WisdomURLResourceResolver(this));
resolver.setTemplateMode(mode);
resolver.setCacheTTLMs((long) ttl);
engine.setTemplateResolver(resolver);
engine.setMessageResolver(messageResolver);
engine.initialize();
} }
|
public class class_name {
@Validate
public synchronized void configure() {
// Thymeleaf specifics
String mode = configuration.getWithDefault("application.template.thymeleaf.mode", "HTML5");
int ttl = configuration.getIntegerWithDefault("application.template.thymeleaf.ttl", 60 * 1000);
if (configuration.isDev()) {
// In dev mode, reduce the ttl to the strict minimum so we are sure to have updated template rendering.
ttl = 1; // depends on control dependency: [if], data = [none]
}
LOGGER.debug("Thymeleaf configuration: mode={}, ttl={}", mode, ttl);
// A TCCL switch is required here as the default Thymeleaf engine initialization triggers a class loading
// from a class that may be present in the class path (org/apache/xerces/xni/parser/XMLParserConfiguration).
// By setting the TCCL, it fails quietly, if not, it may find it but failed to instantiate it (version
// mismatch or whatever). As this class is only used to support the HTML5LEGACY Templates (so not use here),
// we don't really care.
final ClassLoader orig = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); // depends on control dependency: [try], data = [none]
engine = new WisdomTemplateEngine(dialects); // depends on control dependency: [try], data = [none]
} finally {
Thread.currentThread().setContextClassLoader(orig);
}
// Initiate the template resolver.
TemplateResolver resolver = new TemplateResolver();
resolver.setResourceResolver(new WisdomURLResourceResolver(this));
resolver.setTemplateMode(mode);
resolver.setCacheTTLMs((long) ttl);
engine.setTemplateResolver(resolver);
engine.setMessageResolver(messageResolver);
engine.initialize();
} }
|
public class class_name {
public boolean isFiltered(String path) {
for (int j = 0; j < m_filterRules.size(); j++) {
Pattern pattern = m_filterRules.get(j);
if (isPartialMatch(pattern, path)) {
return m_type.equals(TYPE_EXCLUDE);
}
}
return m_type.equals(TYPE_INCLUDE);
} }
|
public class class_name {
public boolean isFiltered(String path) {
for (int j = 0; j < m_filterRules.size(); j++) {
Pattern pattern = m_filterRules.get(j);
if (isPartialMatch(pattern, path)) {
return m_type.equals(TYPE_EXCLUDE); // depends on control dependency: [if], data = [none]
}
}
return m_type.equals(TYPE_INCLUDE);
} }
|
public class class_name {
V getLiveValue(E entry) {
if (entry.getKey() == null) {
return null;
}
V value = entry.getValue();
if (value == null) {
return null;
}
return value;
} }
|
public class class_name {
V getLiveValue(E entry) {
if (entry.getKey() == null) {
return null; // depends on control dependency: [if], data = [none]
}
V value = entry.getValue();
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
return value;
} }
|
public class class_name {
public static Object copy(Object o)
{
if (o instanceof java.io.Serializable)
{
try
{
ByteArrayOutputStream bs = new ByteArrayOutputStream(128);
ObjectOutputStream dos = new ObjectOutputStream(bs);
dos.writeObject(o);
ByteArrayInputStream is = new ByteArrayInputStream(bs.toByteArray());
ObjectInputStream ios = new ObjectInputStream(is);
Object copy = ios.readObject();
return copy;
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (ClassNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
} }
|
public class class_name {
public static Object copy(Object o)
{
if (o instanceof java.io.Serializable)
{
try
{
ByteArrayOutputStream bs = new ByteArrayOutputStream(128);
ObjectOutputStream dos = new ObjectOutputStream(bs);
dos.writeObject(o);
// depends on control dependency: [try], data = [none]
ByteArrayInputStream is = new ByteArrayInputStream(bs.toByteArray());
ObjectInputStream ios = new ObjectInputStream(is);
Object copy = ios.readObject();
return copy;
// depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
catch (ClassNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
public void update(byte buffer) {
if (skip) return;
for (int i=0; i < digests.size(); i++) {
digests.get(i).update(buffer);
}
} }
|
public class class_name {
public void update(byte buffer) {
if (skip) return;
for (int i=0; i < digests.size(); i++) {
digests.get(i).update(buffer); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public void setResourceAttributeList(java.util.Collection<ResourceAttribute> resourceAttributeList) {
if (resourceAttributeList == null) {
this.resourceAttributeList = null;
return;
}
this.resourceAttributeList = new java.util.ArrayList<ResourceAttribute>(resourceAttributeList);
} }
|
public class class_name {
public void setResourceAttributeList(java.util.Collection<ResourceAttribute> resourceAttributeList) {
if (resourceAttributeList == null) {
this.resourceAttributeList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.resourceAttributeList = new java.util.ArrayList<ResourceAttribute>(resourceAttributeList);
} }
|
public class class_name {
void put(final ByteVector out) {
out.putShort(access).putShort(name).putShort(desc);
int attributeCount = 0;
if (value != 0) {
++attributeCount;
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0
&& (cw.version & 0xffff) < Opcodes.V1_5)
{
++attributeCount;
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
++attributeCount;
}
if (ClassReader.SIGNATURES && signature != 0) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && anns != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && ianns != null) {
++attributeCount;
}
if (attrs != null) {
attributeCount += attrs.getCount();
}
out.putShort(attributeCount);
if (value != 0) {
out.putShort(cw.newUTF8("ConstantValue"));
out.putInt(2).putShort(value);
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0
&& (cw.version & 0xffff) < Opcodes.V1_5)
{
out.putShort(cw.newUTF8("Synthetic")).putInt(0);
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
out.putShort(cw.newUTF8("Deprecated")).putInt(0);
}
if (ClassReader.SIGNATURES && signature != 0) {
out.putShort(cw.newUTF8("Signature"));
out.putInt(2).putShort(signature);
}
if (ClassReader.ANNOTATIONS && anns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleAnnotations"));
anns.put(out);
}
if (ClassReader.ANNOTATIONS && ianns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleAnnotations"));
ianns.put(out);
}
if (attrs != null) {
attrs.put(cw, null, 0, -1, -1, out);
}
} }
|
public class class_name {
void put(final ByteVector out) {
out.putShort(access).putShort(name).putShort(desc);
int attributeCount = 0;
if (value != 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0
&& (cw.version & 0xffff) < Opcodes.V1_5)
{
++attributeCount; // depends on control dependency: [if], data = [none]
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.SIGNATURES && signature != 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && anns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ianns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (attrs != null) {
attributeCount += attrs.getCount(); // depends on control dependency: [if], data = [none]
}
out.putShort(attributeCount);
if (value != 0) {
out.putShort(cw.newUTF8("ConstantValue")); // depends on control dependency: [if], data = [none]
out.putInt(2).putShort(value); // depends on control dependency: [if], data = [(value]
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0
&& (cw.version & 0xffff) < Opcodes.V1_5)
{
out.putShort(cw.newUTF8("Synthetic")).putInt(0); // depends on control dependency: [if], data = [0]
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
out.putShort(cw.newUTF8("Deprecated")).putInt(0); // depends on control dependency: [if], data = [0)]
}
if (ClassReader.SIGNATURES && signature != 0) {
out.putShort(cw.newUTF8("Signature")); // depends on control dependency: [if], data = [none]
out.putInt(2).putShort(signature); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && anns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleAnnotations")); // depends on control dependency: [if], data = [none]
anns.put(out); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ianns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleAnnotations")); // depends on control dependency: [if], data = [none]
ianns.put(out); // depends on control dependency: [if], data = [none]
}
if (attrs != null) {
attrs.put(cw, null, 0, -1, -1, out); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getTypeNameForCast(Class<?> type) {
Integer jdbcType = jdbcTypeMapping.get(type);
if (jdbcType == null) {
jdbcType = javaTypeMapping.getType(type).getSQLTypes()[0];
}
return templates.getCastTypeNameForCode(jdbcType);
} }
|
public class class_name {
public String getTypeNameForCast(Class<?> type) {
Integer jdbcType = jdbcTypeMapping.get(type);
if (jdbcType == null) {
jdbcType = javaTypeMapping.getType(type).getSQLTypes()[0]; // depends on control dependency: [if], data = [none]
}
return templates.getCastTypeNameForCode(jdbcType);
} }
|
public class class_name {
public static String getString(CmsObject cms, I_CmsXmlContentValueLocation location) {
if (location == null) {
return null;
}
return location.asString(cms);
} }
|
public class class_name {
public static String getString(CmsObject cms, I_CmsXmlContentValueLocation location) {
if (location == null) {
return null; // depends on control dependency: [if], data = [none]
}
return location.asString(cms);
} }
|
public class class_name {
public static String getCountry(final String localeString) {
if (localeString.length() >= COUNTRY_END) {
return localeString.substring(COUNTRY_START, COUNTRY_END);
}
return "";
} }
|
public class class_name {
public static String getCountry(final String localeString) {
if (localeString.length() >= COUNTRY_END) {
return localeString.substring(COUNTRY_START, COUNTRY_END); // depends on control dependency: [if], data = [none]
}
return "";
} }
|
public class class_name {
@Override
public final Iterable<SubmissionDocument> findAll(
final RootDocument rootDocument) {
final Iterable<SubmissionDocument> submissionDocuments =
findAll(rootDocument.getFilename());
if (submissionDocuments == null) {
return null;
}
for (final SubmissionDocument submDocument : submissionDocuments) {
final Submission submission = submDocument.getGedObject();
submission.setParent(rootDocument.getGedObject());
}
return submissionDocuments;
} }
|
public class class_name {
@Override
public final Iterable<SubmissionDocument> findAll(
final RootDocument rootDocument) {
final Iterable<SubmissionDocument> submissionDocuments =
findAll(rootDocument.getFilename());
if (submissionDocuments == null) {
return null; // depends on control dependency: [if], data = [none]
}
for (final SubmissionDocument submDocument : submissionDocuments) {
final Submission submission = submDocument.getGedObject();
submission.setParent(rootDocument.getGedObject()); // depends on control dependency: [for], data = [none]
}
return submissionDocuments;
} }
|
public class class_name {
@Nonnull
public static FileIOError copyDirRecursive (@Nonnull final File aSourceDir, @Nonnull final File aTargetDir)
{
ValueEnforcer.notNull (aSourceDir, "SourceDirectory");
ValueEnforcer.notNull (aTargetDir, "TargetDirectory");
// Does the source directory exist?
if (!FileHelper.existsDir (aSourceDir))
return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aSourceDir);
// Are source and target different?
if (EqualsHelper.equals (aSourceDir, aTargetDir))
return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aSourceDir);
// Is the source a parent of target?
if (FileHelper.isParentDirectory (aSourceDir, aTargetDir))
return EFileIOErrorCode.TARGET_IS_CHILD_OF_SOURCE.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE,
aSourceDir,
aTargetDir);
// Does the target directory already exist?
if (aTargetDir.exists ())
return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aTargetDir);
// Is the source directory readable?
if (!aSourceDir.canRead ())
return EFileIOErrorCode.SOURCE_NOT_READABLE.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aSourceDir);
// Is the target parent directory writable?
final File aTargetParentDir = aTargetDir.getParentFile ();
if (aTargetParentDir != null && aTargetParentDir.exists () && !aTargetParentDir.canWrite ())
return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aTargetDir);
FileIOError eCode;
// Ensure the targets parent directory is present
eCode = createDirRecursive (aTargetDir);
if (eCode.isFailure ())
return eCode;
for (final File aChild : FileHelper.getDirectoryContent (aSourceDir))
{
if (aChild.isDirectory ())
{
// Skip "." and ".."
if (FilenameHelper.isSystemInternalDirectory (aChild.getName ()))
continue;
// Copy directory
eCode = copyDirRecursive (aChild, new File (aTargetDir, aChild.getName ()));
if (eCode.isFailure ())
return eCode;
}
else
if (aChild.isFile ())
{
// Copy a file
eCode = copyFile (aChild, new File (aTargetDir, aChild.getName ()));
if (eCode.isFailure ())
return eCode;
}
else
{
// Neither directory not file - don't know how to handle
return EFileIOErrorCode.OBJECT_CANNOT_BE_HANDLED.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aChild);
}
}
// Done
return EFileIOErrorCode.NO_ERROR.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aSourceDir, aTargetDir);
} }
|
public class class_name {
@Nonnull
public static FileIOError copyDirRecursive (@Nonnull final File aSourceDir, @Nonnull final File aTargetDir)
{
ValueEnforcer.notNull (aSourceDir, "SourceDirectory");
ValueEnforcer.notNull (aTargetDir, "TargetDirectory");
// Does the source directory exist?
if (!FileHelper.existsDir (aSourceDir))
return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aSourceDir);
// Are source and target different?
if (EqualsHelper.equals (aSourceDir, aTargetDir))
return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aSourceDir);
// Is the source a parent of target?
if (FileHelper.isParentDirectory (aSourceDir, aTargetDir))
return EFileIOErrorCode.TARGET_IS_CHILD_OF_SOURCE.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE,
aSourceDir,
aTargetDir);
// Does the target directory already exist?
if (aTargetDir.exists ())
return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aTargetDir);
// Is the source directory readable?
if (!aSourceDir.canRead ())
return EFileIOErrorCode.SOURCE_NOT_READABLE.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aSourceDir);
// Is the target parent directory writable?
final File aTargetParentDir = aTargetDir.getParentFile ();
if (aTargetParentDir != null && aTargetParentDir.exists () && !aTargetParentDir.canWrite ())
return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aTargetDir);
FileIOError eCode;
// Ensure the targets parent directory is present
eCode = createDirRecursive (aTargetDir);
if (eCode.isFailure ())
return eCode;
for (final File aChild : FileHelper.getDirectoryContent (aSourceDir))
{
if (aChild.isDirectory ())
{
// Skip "." and ".."
if (FilenameHelper.isSystemInternalDirectory (aChild.getName ()))
continue;
// Copy directory
eCode = copyDirRecursive (aChild, new File (aTargetDir, aChild.getName ())); // depends on control dependency: [if], data = [none]
if (eCode.isFailure ())
return eCode;
}
else
if (aChild.isFile ())
{
// Copy a file
eCode = copyFile (aChild, new File (aTargetDir, aChild.getName ())); // depends on control dependency: [if], data = [none]
if (eCode.isFailure ())
return eCode;
}
else
{
// Neither directory not file - don't know how to handle
return EFileIOErrorCode.OBJECT_CANNOT_BE_HANDLED.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aChild); // depends on control dependency: [if], data = [none]
}
}
// Done
return EFileIOErrorCode.NO_ERROR.getAsIOError (EFileIOOperation.COPY_DIR_RECURSIVE, aSourceDir, aTargetDir);
} }
|
public class class_name {
@Override
public void channelRead0(ChannelHandlerContext context, I request)
throws Exception {
if (!accept(request)) {
context.fireChannelRead(request);
return;
}
Envelope envelope = null;
try {
envelope = convertRequest(request);
} catch (RequestConversionException rce) {
serverLogger.logClientError(rce);
throw rce;
}
if (envelope.hasControl() && envelope.getControl().getCancel()) {
ListenableFuture<?> pending = pendingRequests.remove(envelope.getRequestId());
if (pending != null) {
boolean cancelled = pending.cancel(true);
context.channel().writeAndFlush(Envelope.newBuilder()
.setRequestId(envelope.getRequestId())
.setControl(Control.newBuilder().setCancel(cancelled)).build());
}
return;
}
Service service = services.lookupByName(envelope.getService());
if (service == null) {
serverLogger.logUnknownService(service);
logger.warning(String.format(
"Received request for unknown service %s", envelope.getService()));
context.channel().writeAndFlush(Envelope.newBuilder()
.setRequestId(envelope.getRequestId())
.setControl(Control.newBuilder()
.setError(String.format("Unknown service %s", envelope.getService())))
.build());
return;
}
ServerMethod<? extends Message, ? extends Message> method =
service.lookup(envelope.getMethod());
if (method == null) {
serverLogger.logUnknownMethod(service, envelope.getMethod());
logger.warning(String.format(
"Received request for unknown method %s/%s", envelope.getService(),
envelope.getMethod()));
context.channel().writeAndFlush(Envelope.newBuilder()
.setRequestId(envelope.getRequestId())
.setControl(Control.newBuilder()
.setError(
String.format("Unknown method %s/%s", envelope.getService(),
envelope.getMethod())))
.build());
return;
}
serverLogger.logMethodCall(service, method);
invoke(method, envelope.getPayload(), envelope.getRequestId(), context.channel());
} }
|
public class class_name {
@Override
public void channelRead0(ChannelHandlerContext context, I request)
throws Exception {
if (!accept(request)) {
context.fireChannelRead(request);
return;
}
Envelope envelope = null;
try {
envelope = convertRequest(request);
} catch (RequestConversionException rce) {
serverLogger.logClientError(rce);
throw rce;
}
if (envelope.hasControl() && envelope.getControl().getCancel()) {
ListenableFuture<?> pending = pendingRequests.remove(envelope.getRequestId());
if (pending != null) {
boolean cancelled = pending.cancel(true);
context.channel().writeAndFlush(Envelope.newBuilder()
.setRequestId(envelope.getRequestId())
.setControl(Control.newBuilder().setCancel(cancelled)).build()); // depends on control dependency: [if], data = [none]
}
return;
}
Service service = services.lookupByName(envelope.getService());
if (service == null) {
serverLogger.logUnknownService(service);
logger.warning(String.format(
"Received request for unknown service %s", envelope.getService()));
context.channel().writeAndFlush(Envelope.newBuilder()
.setRequestId(envelope.getRequestId())
.setControl(Control.newBuilder()
.setError(String.format("Unknown service %s", envelope.getService())))
.build());
return;
}
ServerMethod<? extends Message, ? extends Message> method =
service.lookup(envelope.getMethod());
if (method == null) {
serverLogger.logUnknownMethod(service, envelope.getMethod());
logger.warning(String.format(
"Received request for unknown method %s/%s", envelope.getService(),
envelope.getMethod()));
context.channel().writeAndFlush(Envelope.newBuilder()
.setRequestId(envelope.getRequestId())
.setControl(Control.newBuilder()
.setError(
String.format("Unknown method %s/%s", envelope.getService(),
envelope.getMethod())))
.build());
return;
}
serverLogger.logMethodCall(service, method);
invoke(method, envelope.getPayload(), envelope.getRequestId(), context.channel());
} }
|
public class class_name {
public void marshall(GetServiceRoleForAccountRequest getServiceRoleForAccountRequest, ProtocolMarshaller protocolMarshaller) {
if (getServiceRoleForAccountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GetServiceRoleForAccountRequest getServiceRoleForAccountRequest, ProtocolMarshaller protocolMarshaller) {
if (getServiceRoleForAccountRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void onSubscribe(@Nullable Subscription s) {
if(s != null) {
try {
setSubscription(s);
} catch(IllegalStateException e) {
subscriber.onError(new IllegalArgumentException("already subscribed"));
cancel();
return;
}
subscriber.onSubscribe(this);
}
} }
|
public class class_name {
@Override
public void onSubscribe(@Nullable Subscription s) {
if(s != null) {
try {
setSubscription(s); // depends on control dependency: [try], data = [none]
} catch(IllegalStateException e) {
subscriber.onError(new IllegalArgumentException("already subscribed"));
cancel();
return;
} // depends on control dependency: [catch], data = [none]
subscriber.onSubscribe(this); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static base_responses add(nitro_service client, dnsaaaarec resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsaaaarec addresources[] = new dnsaaaarec[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new dnsaaaarec();
addresources[i].hostname = resources[i].hostname;
addresources[i].ipv6address = resources[i].ipv6address;
addresources[i].ttl = resources[i].ttl;
}
result = add_bulk_request(client, addresources);
}
return result;
} }
|
public class class_name {
public static base_responses add(nitro_service client, dnsaaaarec resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsaaaarec addresources[] = new dnsaaaarec[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new dnsaaaarec(); // depends on control dependency: [for], data = [i]
addresources[i].hostname = resources[i].hostname; // depends on control dependency: [for], data = [i]
addresources[i].ipv6address = resources[i].ipv6address; // depends on control dependency: [for], data = [i]
addresources[i].ttl = resources[i].ttl; // depends on control dependency: [for], data = [i]
}
result = add_bulk_request(client, addresources);
}
return result;
} }
|
public class class_name {
protected void addDescription(Element member, Content dlTree, SearchIndexItem si) {
si.setContainingPackage(utils.getPackageName(utils.containingPackage(member)));
si.setContainingClass(utils.getSimpleName(utils.getEnclosingTypeElement(member)));
String name = utils.getSimpleName(member);
if (utils.isExecutableElement(member)) {
ExecutableElement ee = (ExecutableElement)member;
name = name + utils.flatSignature(ee);
si.setLabel(name);
if (!((utils.signature(ee)).equals(utils.flatSignature(ee)))) {
si.setUrl(getName(getAnchor(ee)));
}
} else {
si.setLabel(name);
}
si.setCategory(resources.getText("doclet.Members"));
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
Content dt = HtmlTree.DT(span);
dt.addContent(" - ");
addMemberDesc(member, dt);
dlTree.addContent(dt);
Content dd = new HtmlTree(HtmlTag.DD);
addComment(member, dd);
dlTree.addContent(dd);
} }
|
public class class_name {
protected void addDescription(Element member, Content dlTree, SearchIndexItem si) {
si.setContainingPackage(utils.getPackageName(utils.containingPackage(member)));
si.setContainingClass(utils.getSimpleName(utils.getEnclosingTypeElement(member)));
String name = utils.getSimpleName(member);
if (utils.isExecutableElement(member)) {
ExecutableElement ee = (ExecutableElement)member;
name = name + utils.flatSignature(ee); // depends on control dependency: [if], data = [none]
si.setLabel(name); // depends on control dependency: [if], data = [none]
if (!((utils.signature(ee)).equals(utils.flatSignature(ee)))) {
si.setUrl(getName(getAnchor(ee))); // depends on control dependency: [if], data = [none]
}
} else {
si.setLabel(name); // depends on control dependency: [if], data = [none]
}
si.setCategory(resources.getText("doclet.Members"));
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
Content dt = HtmlTree.DT(span);
dt.addContent(" - ");
addMemberDesc(member, dt);
dlTree.addContent(dt);
Content dd = new HtmlTree(HtmlTag.DD);
addComment(member, dd);
dlTree.addContent(dd);
} }
|
public class class_name {
public static RmiServiceInvocation create(Object remoteTarget, Method method, Object[] args) {
RmiServiceInvocation serviceInvocation = new RmiServiceInvocation();
if (Proxy.isProxyClass(remoteTarget.getClass())) {
serviceInvocation.setRemote(method.getDeclaringClass().getName());
} else {
serviceInvocation.setRemote(remoteTarget.getClass().getName());
}
serviceInvocation.setMethod(method.getName());
if (args != null) {
serviceInvocation.setArgs(new RmiServiceInvocation.Args());
for (Object arg : args) {
MethodArg methodArg = new MethodArg();
methodArg.setValueObject(arg);
if (Map.class.isAssignableFrom(arg.getClass())) {
methodArg.setType(Map.class.getName());
} else if (List.class.isAssignableFrom(arg.getClass())) {
methodArg.setType(List.class.getName());
} else {
methodArg.setType(arg.getClass().getName());
}
serviceInvocation.getArgs().getArgs().add(methodArg);
}
}
return serviceInvocation;
} }
|
public class class_name {
public static RmiServiceInvocation create(Object remoteTarget, Method method, Object[] args) {
RmiServiceInvocation serviceInvocation = new RmiServiceInvocation();
if (Proxy.isProxyClass(remoteTarget.getClass())) {
serviceInvocation.setRemote(method.getDeclaringClass().getName()); // depends on control dependency: [if], data = [none]
} else {
serviceInvocation.setRemote(remoteTarget.getClass().getName()); // depends on control dependency: [if], data = [none]
}
serviceInvocation.setMethod(method.getName());
if (args != null) {
serviceInvocation.setArgs(new RmiServiceInvocation.Args()); // depends on control dependency: [if], data = [none]
for (Object arg : args) {
MethodArg methodArg = new MethodArg();
methodArg.setValueObject(arg); // depends on control dependency: [for], data = [arg]
if (Map.class.isAssignableFrom(arg.getClass())) {
methodArg.setType(Map.class.getName()); // depends on control dependency: [if], data = [none]
} else if (List.class.isAssignableFrom(arg.getClass())) {
methodArg.setType(List.class.getName()); // depends on control dependency: [if], data = [none]
} else {
methodArg.setType(arg.getClass().getName()); // depends on control dependency: [if], data = [none]
}
serviceInvocation.getArgs().getArgs().add(methodArg); // depends on control dependency: [for], data = [none]
}
}
return serviceInvocation;
} }
|
public class class_name {
public final void whereClause(QueryMeta qMeta) throws RecognitionException {
List<Interval> intls =null;
Filter f =null;
try {
// druidG.g:300:2: (intls= intervalClause ( WS AND WS f= grandFilter )? )
// druidG.g:300:3: intls= intervalClause ( WS AND WS f= grandFilter )?
{
pushFollow(FOLLOW_intervalClause_in_whereClause2008);
intls=intervalClause();
state._fsp--;
qMeta.intervals.addAll(intls);
// druidG.g:300:57: ( WS AND WS f= grandFilter )?
int alt131=2;
int LA131_0 = input.LA(1);
if ( (LA131_0==WS) ) {
int LA131_1 = input.LA(2);
if ( (LA131_1==AND) ) {
alt131=1;
}
}
switch (alt131) {
case 1 :
// druidG.g:300:58: WS AND WS f= grandFilter
{
match(input,WS,FOLLOW_WS_in_whereClause2013);
match(input,AND,FOLLOW_AND_in_whereClause2015);
match(input,WS,FOLLOW_WS_in_whereClause2017);
pushFollow(FOLLOW_grandFilter_in_whereClause2021);
f=grandFilter();
state._fsp--;
qMeta.filter = f;
}
break;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
public final void whereClause(QueryMeta qMeta) throws RecognitionException {
List<Interval> intls =null;
Filter f =null;
try {
// druidG.g:300:2: (intls= intervalClause ( WS AND WS f= grandFilter )? )
// druidG.g:300:3: intls= intervalClause ( WS AND WS f= grandFilter )?
{
pushFollow(FOLLOW_intervalClause_in_whereClause2008);
intls=intervalClause();
state._fsp--;
qMeta.intervals.addAll(intls);
// druidG.g:300:57: ( WS AND WS f= grandFilter )?
int alt131=2;
int LA131_0 = input.LA(1);
if ( (LA131_0==WS) ) {
int LA131_1 = input.LA(2);
if ( (LA131_1==AND) ) {
alt131=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt131) {
case 1 :
// druidG.g:300:58: WS AND WS f= grandFilter
{
match(input,WS,FOLLOW_WS_in_whereClause2013);
match(input,AND,FOLLOW_AND_in_whereClause2015);
match(input,WS,FOLLOW_WS_in_whereClause2017);
pushFollow(FOLLOW_grandFilter_in_whereClause2021);
f=grandFilter();
state._fsp--;
qMeta.filter = f;
}
break;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
byte[] GetZlibedNexr( byte[] buf, int buflen, int hoff ) throws IOException
{
//byte[] uncompr = new byte[ZLIB_BUF_LEN ]; /* decompression buffer */
//long uncomprLen = ZLIB_BUF_LEN; /* length of decompress space */
int doff ; /* # bytes offset to image */
int numin; /* # input bytes processed */
numin = buflen - hoff ;
if( numin <= 0 )
{
log.warn(" No compressed data to inflate "+raf.getLocation());
return null;
}
//byte[] compr = new byte[numin-4]; /* compressed portion */
/*
** Uncompress first portion of the image. This should include:
**
** SHO\r\r\n <--+
** SEQ#\r\r\n | hoff bytes long
** WMO header\r\r\n |
** PIL\r\r\n <--+
**
** -> CCB
** WMO header
** PIL
** portion of the image
**
*/
/* a new copy of buff with only compressed bytes */
System.arraycopy( buf, hoff, buf, hoff, numin - 4);
// decompress the bytes
int resultLength;
int result = 0;
// byte[] inflateData = null;
byte[] tmp;
int uncompLen = 24500; /* length of decompress space */
byte[] uncomp = new byte[uncompLen];
Inflater inflater = new Inflater( false);
inflater.setInput(buf, hoff, numin-4);
int offset = 0;
int limit = 20000;
while ( inflater.getRemaining() > 0 )
{
try {
resultLength = inflater.inflate(uncomp, offset, 4000);
}
catch (DataFormatException ex) {
//System.out.println("ERROR on inflation "+ex.getMessage());
//ex.printStackTrace();
log.error("nids Inflater", ex);
throw new IOException( ex.getMessage(), ex);
}
offset = offset + resultLength;
result = result + resultLength;
if( result > limit ) {
// when uncomp data larger then limit, the uncomp need to increase size
tmp = new byte[ result];
System.arraycopy(uncomp, 0, tmp, 0, result);
uncompLen = uncompLen + 10000;
uncomp = new byte[uncompLen];
System.arraycopy(tmp, 0, uncomp, 0, result);
}
if( resultLength == 0 ) {
int tt = inflater.getRemaining();
byte [] b2 = new byte[2];
System.arraycopy(buf,hoff+numin-4-tt, b2, 0, 2);
if(result+tt > uncompLen){
tmp = new byte[ result];
System.arraycopy(uncomp, 0, tmp, 0, result);
uncompLen = uncompLen + 10000;
uncomp = new byte[uncompLen];
System.arraycopy(tmp, 0, uncomp, 0, result);
}
if( isZlibHed( b2 ) == 0 ) {
System.arraycopy(buf, hoff+numin-4-tt, uncomp, result, tt);
result = result + tt;
break;
}
inflater.reset();
inflater.setInput(buf, hoff+numin-4-tt, tt);
}
}
inflater.end();
/*
** Find out how long CCB is. This is done by using the lower order
** 6 bits from the first uncompressed byte and all 8 bits of the
** second uncompressed byte.
*/
doff = 2 * (((uncomp[0] & 0x3f) << 8) | (uncomp[1] & 0xFF));
for ( int i = 0; i < 2; i++ ) { /* eat WMO and PIL */
while ( (doff < result ) && (uncomp[doff] != '\n') ) doff++;
doff++;
}
byte[] data = new byte[ result - doff];
System.arraycopy(uncomp, doff, data, 0, result - doff);
//
/*
** Copy header bytes to decompression buffer. The objective is to
** create an output buffer that looks like an uncompressed NOAAPORT
** NEXRAD product:
**
** Section Product Example End
** +--------------------------------+
** | |
** 1 | start of product | CTRL-A \r\r\n
** | |
** +--------------------------------+
** | |
** 2 | sequence number | 237 \r\r\n
** | |
** +--------------------------------+
** | |
** 3 | WMO header | SDUS53 KARX 062213 \r\r\n
** | |
** +--------------------------------+
** | |
** 4 | PIL | N0RARX \r\r\n
** | |
** +--------------------------------+
** | |
** 5 | | AAO130006R2 CH-1
** | | Interface Control
** | CCB | Document (ICD)
** | | for the NWS NWSTG
** | | Figure 7-1 p 38
** | |
** +--------------------------------+
** | |
** 6 | WMO header | SDUS53 KARX 062213 \r\r\n
** | |
** +--------------------------------+
** | |
** 7 | PIL | N0RARX \r\r\n
** | |
** +--------------------------------+
** | |
** | |
** | |
** | |
** 8 | image |
** | |
** | |
** | |
** | |
** +--------------------------------+
** | |
** 9 | trailer | \r\r\nETX
** | |
** +--------------------------------+
** | |
** 10 | Unidata floater trailer | \0\0
** | |
** +--------------------------------+
**
** Sections 5-8 are zlib compressed. They must be uncompressed and
** read to find out where the image begins. When this is done, sections
** 5-7 are thrown away and 8 is returned immediately following 4.
** Section 9 and, if it is there, section 10 are also thrown away.
**
*/
return data;
} }
|
public class class_name {
byte[] GetZlibedNexr( byte[] buf, int buflen, int hoff ) throws IOException
{
//byte[] uncompr = new byte[ZLIB_BUF_LEN ]; /* decompression buffer */
//long uncomprLen = ZLIB_BUF_LEN; /* length of decompress space */
int doff ; /* # bytes offset to image */
int numin; /* # input bytes processed */
numin = buflen - hoff ;
if( numin <= 0 )
{
log.warn(" No compressed data to inflate "+raf.getLocation());
return null;
}
//byte[] compr = new byte[numin-4]; /* compressed portion */
/*
** Uncompress first portion of the image. This should include:
**
** SHO\r\r\n <--+
** SEQ#\r\r\n | hoff bytes long
** WMO header\r\r\n |
** PIL\r\r\n <--+
**
** -> CCB
** WMO header
** PIL
** portion of the image
**
*/
/* a new copy of buff with only compressed bytes */
System.arraycopy( buf, hoff, buf, hoff, numin - 4);
// decompress the bytes
int resultLength;
int result = 0;
// byte[] inflateData = null;
byte[] tmp;
int uncompLen = 24500; /* length of decompress space */
byte[] uncomp = new byte[uncompLen];
Inflater inflater = new Inflater( false);
inflater.setInput(buf, hoff, numin-4);
int offset = 0;
int limit = 20000;
while ( inflater.getRemaining() > 0 )
{
try {
resultLength = inflater.inflate(uncomp, offset, 4000);
// depends on control dependency: [try], data = [none]
}
catch (DataFormatException ex) {
//System.out.println("ERROR on inflation "+ex.getMessage());
//ex.printStackTrace();
log.error("nids Inflater", ex);
throw new IOException( ex.getMessage(), ex);
}
// depends on control dependency: [catch], data = [none]
offset = offset + resultLength;
result = result + resultLength;
if( result > limit ) {
// when uncomp data larger then limit, the uncomp need to increase size
tmp = new byte[ result];
// depends on control dependency: [if], data = [none]
System.arraycopy(uncomp, 0, tmp, 0, result);
// depends on control dependency: [if], data = [none]
uncompLen = uncompLen + 10000;
// depends on control dependency: [if], data = [none]
uncomp = new byte[uncompLen];
// depends on control dependency: [if], data = [none]
System.arraycopy(tmp, 0, uncomp, 0, result);
// depends on control dependency: [if], data = [none]
}
if( resultLength == 0 ) {
int tt = inflater.getRemaining();
byte [] b2 = new byte[2];
System.arraycopy(buf,hoff+numin-4-tt, b2, 0, 2);
// depends on control dependency: [if], data = [none]
if(result+tt > uncompLen){
tmp = new byte[ result];
// depends on control dependency: [if], data = [none]
System.arraycopy(uncomp, 0, tmp, 0, result);
// depends on control dependency: [if], data = [none]
uncompLen = uncompLen + 10000;
// depends on control dependency: [if], data = [none]
uncomp = new byte[uncompLen];
// depends on control dependency: [if], data = [none]
System.arraycopy(tmp, 0, uncomp, 0, result);
// depends on control dependency: [if], data = [none]
}
if( isZlibHed( b2 ) == 0 ) {
System.arraycopy(buf, hoff+numin-4-tt, uncomp, result, tt);
// depends on control dependency: [if], data = [none]
result = result + tt;
// depends on control dependency: [if], data = [none]
break;
}
inflater.reset();
// depends on control dependency: [if], data = [none]
inflater.setInput(buf, hoff+numin-4-tt, tt);
// depends on control dependency: [if], data = [none]
}
}
inflater.end();
/*
** Find out how long CCB is. This is done by using the lower order
** 6 bits from the first uncompressed byte and all 8 bits of the
** second uncompressed byte.
*/
doff = 2 * (((uncomp[0] & 0x3f) << 8) | (uncomp[1] & 0xFF));
for ( int i = 0; i < 2; i++ ) { /* eat WMO and PIL */
while ( (doff < result ) && (uncomp[doff] != '\n') ) doff++;
doff++;
}
byte[] data = new byte[ result - doff];
System.arraycopy(uncomp, doff, data, 0, result - doff);
//
/*
** Copy header bytes to decompression buffer. The objective is to
** create an output buffer that looks like an uncompressed NOAAPORT
** NEXRAD product:
**
** Section Product Example End
** +--------------------------------+
** | |
** 1 | start of product | CTRL-A \r\r\n
** | |
** +--------------------------------+
** | |
** 2 | sequence number | 237 \r\r\n
** | |
** +--------------------------------+
** | |
** 3 | WMO header | SDUS53 KARX 062213 \r\r\n
** | |
** +--------------------------------+
** | |
** 4 | PIL | N0RARX \r\r\n
** | |
** +--------------------------------+
** | |
** 5 | | AAO130006R2 CH-1
** | | Interface Control
** | CCB | Document (ICD)
** | | for the NWS NWSTG
** | | Figure 7-1 p 38
** | |
** +--------------------------------+
** | |
** 6 | WMO header | SDUS53 KARX 062213 \r\r\n
** | |
** +--------------------------------+
** | |
** 7 | PIL | N0RARX \r\r\n
** | |
** +--------------------------------+
** | |
** | |
** | |
** | |
** 8 | image |
** | |
** | |
** | |
** | |
** +--------------------------------+
** | |
** 9 | trailer | \r\r\nETX
** | |
** +--------------------------------+
** | |
** 10 | Unidata floater trailer | \0\0
** | |
** +--------------------------------+
**
** Sections 5-8 are zlib compressed. They must be uncompressed and
** read to find out where the image begins. When this is done, sections
** 5-7 are thrown away and 8 is returned immediately following 4.
** Section 9 and, if it is there, section 10 are also thrown away.
**
*/
return data;
} }
|
public class class_name {
private boolean ping() {
try {
URL alfrescoTomcatUrl = buildFinalUrl("");
TelnetClient telnetClient = new TelnetClient();
telnetClient.setDefaultTimeout(500);
telnetClient.connect(alfrescoTomcatUrl.getHost(), alfrescoTomcatUrl.getPort());
return true;
} catch (Exception ex) {
return false;
}
} }
|
public class class_name {
private boolean ping() {
try {
URL alfrescoTomcatUrl = buildFinalUrl("");
TelnetClient telnetClient = new TelnetClient();
telnetClient.setDefaultTimeout(500); // depends on control dependency: [try], data = [none]
telnetClient.connect(alfrescoTomcatUrl.getHost(), alfrescoTomcatUrl.getPort()); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(CommentsForPullRequest commentsForPullRequest, ProtocolMarshaller protocolMarshaller) {
if (commentsForPullRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(commentsForPullRequest.getPullRequestId(), PULLREQUESTID_BINDING);
protocolMarshaller.marshall(commentsForPullRequest.getRepositoryName(), REPOSITORYNAME_BINDING);
protocolMarshaller.marshall(commentsForPullRequest.getBeforeCommitId(), BEFORECOMMITID_BINDING);
protocolMarshaller.marshall(commentsForPullRequest.getAfterCommitId(), AFTERCOMMITID_BINDING);
protocolMarshaller.marshall(commentsForPullRequest.getBeforeBlobId(), BEFOREBLOBID_BINDING);
protocolMarshaller.marshall(commentsForPullRequest.getAfterBlobId(), AFTERBLOBID_BINDING);
protocolMarshaller.marshall(commentsForPullRequest.getLocation(), LOCATION_BINDING);
protocolMarshaller.marshall(commentsForPullRequest.getComments(), COMMENTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CommentsForPullRequest commentsForPullRequest, ProtocolMarshaller protocolMarshaller) {
if (commentsForPullRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(commentsForPullRequest.getPullRequestId(), PULLREQUESTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(commentsForPullRequest.getRepositoryName(), REPOSITORYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(commentsForPullRequest.getBeforeCommitId(), BEFORECOMMITID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(commentsForPullRequest.getAfterCommitId(), AFTERCOMMITID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(commentsForPullRequest.getBeforeBlobId(), BEFOREBLOBID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(commentsForPullRequest.getAfterBlobId(), AFTERBLOBID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(commentsForPullRequest.getLocation(), LOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(commentsForPullRequest.getComments(), COMMENTS_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 String toLog4jMessage(LogRecord record)
{
String message = record.getMessage();
// Format message
Object[] parameters = record.getParameters();
if ((parameters != null) && (parameters.length != 0))
{
// Check for the first few parameters ?
if ((message.indexOf("{0}") >= 0) || (message.indexOf("{1}") >= 0) || (message.indexOf("{2}") >= 0) ||
(message.indexOf("{3}") >= 0))
{
message = MessageFormat.format(message, parameters);
}
}
return message;
} }
|
public class class_name {
private String toLog4jMessage(LogRecord record)
{
String message = record.getMessage();
// Format message
Object[] parameters = record.getParameters();
if ((parameters != null) && (parameters.length != 0))
{
// Check for the first few parameters ?
if ((message.indexOf("{0}") >= 0) || (message.indexOf("{1}") >= 0) || (message.indexOf("{2}") >= 0) ||
(message.indexOf("{3}") >= 0))
{
message = MessageFormat.format(message, parameters); // depends on control dependency: [if], data = [none]
}
}
return message;
} }
|
public class class_name {
@Override
public void configure(Map<String, String> config, File logLocation, TextFileOutputStreamFactory factory) {
// Use HPEL as a TrService provider if it was not explicitly set.
if (!config.containsKey(config.get(LoggingConstants.PROP_TRACE_DELEGATE))) {
config.put(LoggingConstants.PROP_TRACE_DELEGATE, HpelBaseTraceService.class.getName());
}
// Set boolean to enable HPEL, for the WsLogManager
WsLogManager.setBinaryLoggingEnabled(true);
HpelTraceServiceConfig loggingConfig = new HpelTraceServiceConfig(config, logLocation, factory);
TrConfigurator.init(loggingConfig);
FFDCConfigurator.init(loggingConfig);
HpelConfigurator.init(loggingConfig);
} }
|
public class class_name {
@Override
public void configure(Map<String, String> config, File logLocation, TextFileOutputStreamFactory factory) {
// Use HPEL as a TrService provider if it was not explicitly set.
if (!config.containsKey(config.get(LoggingConstants.PROP_TRACE_DELEGATE))) {
config.put(LoggingConstants.PROP_TRACE_DELEGATE, HpelBaseTraceService.class.getName()); // depends on control dependency: [if], data = [none]
}
// Set boolean to enable HPEL, for the WsLogManager
WsLogManager.setBinaryLoggingEnabled(true);
HpelTraceServiceConfig loggingConfig = new HpelTraceServiceConfig(config, logLocation, factory);
TrConfigurator.init(loggingConfig);
FFDCConfigurator.init(loggingConfig);
HpelConfigurator.init(loggingConfig);
} }
|
public class class_name {
@SuppressWarnings({"Since15"})
public static List<AttachProvider> providers() {
synchronized (lock) {
if (providers == null) {
providers = new ArrayList<AttachProvider>();
ServiceLoader<AttachProvider> providerLoader =
ServiceLoader.load(AttachProvider.class, AttachProvider.class.getClassLoader());
for (AttachProvider aProviderLoader : providerLoader) {
try {
providers.add(aProviderLoader);
} catch (ThreadDeath td) {
throw td;
} catch (Throwable t) {
// Ignore errors and exceptions.
System.err.println(t);
}
}
}
return Collections.unmodifiableList(providers);
}
} }
|
public class class_name {
@SuppressWarnings({"Since15"})
public static List<AttachProvider> providers() {
synchronized (lock) {
if (providers == null) {
providers = new ArrayList<AttachProvider>(); // depends on control dependency: [if], data = [none]
ServiceLoader<AttachProvider> providerLoader =
ServiceLoader.load(AttachProvider.class, AttachProvider.class.getClassLoader());
for (AttachProvider aProviderLoader : providerLoader) {
try {
providers.add(aProviderLoader); // depends on control dependency: [try], data = [none]
} catch (ThreadDeath td) {
throw td;
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
// Ignore errors and exceptions.
System.err.println(t);
} // depends on control dependency: [catch], data = [none]
}
}
return Collections.unmodifiableList(providers);
}
} }
|
public class class_name {
public static void publishDataToFile(String fileName, int numMessages, int delayInMillis)
throws IOException {
PrintWriter out = new PrintWriter(new OutputStreamWriter(
new BufferedOutputStream(new FileOutputStream(fileName, true)), "UTF-8"));
try {
for (int i = 0; i < Math.max(1, numMessages); i++) {
Long currTime = System.currentTimeMillis();
String message = generateEvent(currTime, delayInMillis);
out.println(message);
}
} catch (Exception e) {
System.err.print("Error in writing generated events to file");
e.printStackTrace();
} finally {
out.flush();
out.close();
}
} }
|
public class class_name {
public static void publishDataToFile(String fileName, int numMessages, int delayInMillis)
throws IOException {
PrintWriter out = new PrintWriter(new OutputStreamWriter(
new BufferedOutputStream(new FileOutputStream(fileName, true)), "UTF-8"));
try {
for (int i = 0; i < Math.max(1, numMessages); i++) {
Long currTime = System.currentTimeMillis();
String message = generateEvent(currTime, delayInMillis);
out.println(message); // depends on control dependency: [for], data = [none]
}
} catch (Exception e) {
System.err.print("Error in writing generated events to file");
e.printStackTrace();
} finally {
out.flush();
out.close();
}
} }
|
public class class_name {
@Override
public EClass getIfcUnitAssignment() {
if (ifcUnitAssignmentEClass == null) {
ifcUnitAssignmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(742);
}
return ifcUnitAssignmentEClass;
} }
|
public class class_name {
@Override
public EClass getIfcUnitAssignment() {
if (ifcUnitAssignmentEClass == null) {
ifcUnitAssignmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(742);
// depends on control dependency: [if], data = [none]
}
return ifcUnitAssignmentEClass;
} }
|
public class class_name {
private int transitionsBetween(ResultPoint from, ResultPoint to) {
// See QR Code Detector, sizeOfBlackWhiteBlackRun()
int fromX = (int) from.getX();
int fromY = (int) from.getY();
int toX = (int) to.getX();
int toY = (int) to.getY();
boolean steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);
if (steep) {
int temp = fromX;
fromX = fromY;
fromY = temp;
temp = toX;
toX = toY;
toY = temp;
}
int dx = Math.abs(toX - fromX);
int dy = Math.abs(toY - fromY);
int error = -dx / 2;
int ystep = fromY < toY ? 1 : -1;
int xstep = fromX < toX ? 1 : -1;
int transitions = 0;
boolean inBlack = image.get(steep ? fromY : fromX, steep ? fromX : fromY);
for (int x = fromX, y = fromY; x != toX; x += xstep) {
boolean isBlack = image.get(steep ? y : x, steep ? x : y);
if (isBlack != inBlack) {
transitions++;
inBlack = isBlack;
}
error += dy;
if (error > 0) {
if (y == toY) {
break;
}
y += ystep;
error -= dx;
}
}
return transitions;
} }
|
public class class_name {
private int transitionsBetween(ResultPoint from, ResultPoint to) {
// See QR Code Detector, sizeOfBlackWhiteBlackRun()
int fromX = (int) from.getX();
int fromY = (int) from.getY();
int toX = (int) to.getX();
int toY = (int) to.getY();
boolean steep = Math.abs(toY - fromY) > Math.abs(toX - fromX);
if (steep) {
int temp = fromX;
fromX = fromY; // depends on control dependency: [if], data = [none]
fromY = temp; // depends on control dependency: [if], data = [none]
temp = toX; // depends on control dependency: [if], data = [none]
toX = toY; // depends on control dependency: [if], data = [none]
toY = temp; // depends on control dependency: [if], data = [none]
}
int dx = Math.abs(toX - fromX);
int dy = Math.abs(toY - fromY);
int error = -dx / 2;
int ystep = fromY < toY ? 1 : -1;
int xstep = fromX < toX ? 1 : -1;
int transitions = 0;
boolean inBlack = image.get(steep ? fromY : fromX, steep ? fromX : fromY);
for (int x = fromX, y = fromY; x != toX; x += xstep) {
boolean isBlack = image.get(steep ? y : x, steep ? x : y);
if (isBlack != inBlack) {
transitions++; // depends on control dependency: [if], data = [none]
inBlack = isBlack; // depends on control dependency: [if], data = [none]
}
error += dy; // depends on control dependency: [for], data = [none]
if (error > 0) {
if (y == toY) {
break;
}
y += ystep; // depends on control dependency: [if], data = [none]
error -= dx; // depends on control dependency: [if], data = [none]
}
}
return transitions;
} }
|
public class class_name {
@Override
public WSStatistic getStatistic(int dataId) {
ArrayList members = copyStatistics();
if (members == null || members.size() <= 0)
return null;
int sz = members.size();
for (int i = 0; i < sz; i++) {
StatisticImpl data = (StatisticImpl) members.get(i);
if (data != null && data.getId() == dataId) {
return data;
}
}
return null;
} }
|
public class class_name {
@Override
public WSStatistic getStatistic(int dataId) {
ArrayList members = copyStatistics();
if (members == null || members.size() <= 0)
return null;
int sz = members.size();
for (int i = 0; i < sz; i++) {
StatisticImpl data = (StatisticImpl) members.get(i);
if (data != null && data.getId() == dataId) {
return data; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
private static synchronized Iterator providers(Class cls,ClassLoader cl) {
String serviceFile = "META-INF/services/"+cls.getName();
// System.out.println("File: " + serviceFile);
Vector v = (Vector)providerMap.get(serviceFile);
if (v != null)
return v.iterator();
v = new Vector();
providerMap.put(serviceFile, v);
Enumeration e;
try {
e = cl.getResources(serviceFile);
} catch (IOException ioe) {
return v.iterator();
}
while (e.hasMoreElements()) {
try {
URL u = (URL)e.nextElement();
// System.out.println("URL: " + u);
InputStream is = u.openStream();
Reader r = new InputStreamReader(is, "UTF-8");
BufferedReader br = new BufferedReader(r);
String line = br.readLine();
while (line != null) {
try {
// First strip any comment...
int idx = line.indexOf('#');
if (idx != -1)
line = line.substring(0, idx);
// Trim whitespace.
line = line.trim();
// If nothing left then loop around...
if (line.length() == 0) {
line = br.readLine();
continue;
}
// System.out.println("Line: " + line);
// Try and load the class
Object obj = cl.loadClass(line).newInstance();
// stick it into our vector...
v.add(obj);
} catch (Exception ex) {
// Just try the next line
// ex.printStackTrace();
}
line = br.readLine();
}
} catch (Exception ex) {
// Just try the next file...
}
}
return v.iterator();
} }
|
public class class_name {
private static synchronized Iterator providers(Class cls,ClassLoader cl) {
String serviceFile = "META-INF/services/"+cls.getName();
// System.out.println("File: " + serviceFile);
Vector v = (Vector)providerMap.get(serviceFile);
if (v != null)
return v.iterator();
v = new Vector();
providerMap.put(serviceFile, v);
Enumeration e;
try {
e = cl.getResources(serviceFile);
// depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
return v.iterator();
}
// depends on control dependency: [catch], data = [none]
while (e.hasMoreElements()) {
try {
URL u = (URL)e.nextElement();
// System.out.println("URL: " + u);
InputStream is = u.openStream();
Reader r = new InputStreamReader(is, "UTF-8");
BufferedReader br = new BufferedReader(r);
String line = br.readLine();
while (line != null) {
try {
// First strip any comment...
int idx = line.indexOf('#');
if (idx != -1)
line = line.substring(0, idx);
// Trim whitespace.
line = line.trim();
// depends on control dependency: [try], data = [none]
// If nothing left then loop around...
if (line.length() == 0) {
line = br.readLine();
// depends on control dependency: [if], data = [none]
continue;
}
// System.out.println("Line: " + line);
// Try and load the class
Object obj = cl.loadClass(line).newInstance();
// stick it into our vector...
v.add(obj);
// depends on control dependency: [try], data = [none]
} catch (Exception ex) {
// Just try the next line
// ex.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
line = br.readLine();
// depends on control dependency: [while], data = [none]
}
} catch (Exception ex) {
// Just try the next file...
}
// depends on control dependency: [catch], data = [none]
}
return v.iterator();
} }
|
public class class_name {
public static void symmetric(DMatrixRMaj A, double min, double max, Random rand) {
if( A.numRows != A.numCols )
throw new IllegalArgumentException("A must be a square matrix");
double range = max-min;
int length = A.numRows;
for( int i = 0; i < length; i++ ) {
for( int j = i; j < length; j++ ) {
double val = rand.nextDouble()*range + min;
A.set(i,j,val);
A.set(j,i,val);
}
}
} }
|
public class class_name {
public static void symmetric(DMatrixRMaj A, double min, double max, Random rand) {
if( A.numRows != A.numCols )
throw new IllegalArgumentException("A must be a square matrix");
double range = max-min;
int length = A.numRows;
for( int i = 0; i < length; i++ ) {
for( int j = i; j < length; j++ ) {
double val = rand.nextDouble()*range + min;
A.set(i,j,val); // depends on control dependency: [for], data = [j]
A.set(j,i,val); // depends on control dependency: [for], data = [j]
}
}
} }
|
public class class_name {
public synchronized short getListenerFlag() {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[GET_LISTENER_FLAG], "" + listenerFlag);
}
return listenerFlag;
} }
|
public class class_name {
public synchronized short getListenerFlag() {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[GET_LISTENER_FLAG], "" + listenerFlag); // depends on control dependency: [if], data = [none]
}
return listenerFlag;
} }
|
public class class_name {
@Override
public int compareTo(final ColumnMapping o) {
if(this.number == o.number) {
return this.field.getName().compareTo(o.field.getName());
} else {
return Integer.compare(number, o.number);
}
} }
|
public class class_name {
@Override
public int compareTo(final ColumnMapping o) {
if(this.number == o.number) {
return this.field.getName().compareTo(o.field.getName());
// depends on control dependency: [if], data = [none]
} else {
return Integer.compare(number, o.number);
// depends on control dependency: [if], data = [o.number)]
}
} }
|
public class class_name {
public List<Entity> sortEntities(List<Entity> entities) {
if (entities != null && entities.size() > 0) {
Entity[] ents = (Entity[]) entities.toArray(new Entity[entities.size()]);
WIMSortCompare<Entity> wimSortComparator = new WIMSortCompare<Entity>(sortControl);
Arrays.sort(ents, wimSortComparator);
entities.clear();
for (int i = 0; i < ents.length; i++) {
entities.add(ents[i]);
}
}
return entities;
} }
|
public class class_name {
public List<Entity> sortEntities(List<Entity> entities) {
if (entities != null && entities.size() > 0) {
Entity[] ents = (Entity[]) entities.toArray(new Entity[entities.size()]);
WIMSortCompare<Entity> wimSortComparator = new WIMSortCompare<Entity>(sortControl);
Arrays.sort(ents, wimSortComparator); // depends on control dependency: [if], data = [none]
entities.clear(); // depends on control dependency: [if], data = [none]
for (int i = 0; i < ents.length; i++) {
entities.add(ents[i]); // depends on control dependency: [for], data = [i]
}
}
return entities;
} }
|
public class class_name {
@SuppressFBWarnings(value = "DP_DO_INSIDE_DO_PRIVILEGED", justification = "EV is run only from within unit tests")
public <T> T instantiate(Class<?>[] paramTypes, Object[] paramValues) {
try {
Class<T> type = resolve();
if (type == null) {
return null;
}
Constructor<T> c = type.getConstructor(paramTypes);
c.setAccessible(true);
return c.newInstance(paramValues);
}
catch (Exception e) {
return handleException(e);
}
} }
|
public class class_name {
@SuppressFBWarnings(value = "DP_DO_INSIDE_DO_PRIVILEGED", justification = "EV is run only from within unit tests")
public <T> T instantiate(Class<?>[] paramTypes, Object[] paramValues) {
try {
Class<T> type = resolve();
if (type == null) {
return null; // depends on control dependency: [if], data = [none]
}
Constructor<T> c = type.getConstructor(paramTypes);
c.setAccessible(true); // depends on control dependency: [try], data = [none]
return c.newInstance(paramValues); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
return handleException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Singleton
protected @Nonnull TypeConverter<CharSequence, Readable> readableTypeConverter(ResourceResolver resourceResolver) {
return (object, targetType, context) -> {
String pathStr = object.toString();
Optional<ResourceLoader> supportingLoader = resourceResolver.getSupportingLoader(pathStr);
if (!supportingLoader.isPresent()) {
context.reject(pathStr, new ConfigurationException(
"No supported resource loader for path [" + pathStr + "]. Prefix the path with a supported prefix such as 'classpath:' or 'file:'"
));
return Optional.empty();
} else {
final Optional<URL> resource = resourceResolver.getResource(pathStr);
if (resource.isPresent()) {
return Optional.of(Readable.of(resource.get()));
} else {
context.reject(object, new ConfigurationException("No resource exists for value: " + object));
return Optional.empty();
}
}
};
} }
|
public class class_name {
@Singleton
protected @Nonnull TypeConverter<CharSequence, Readable> readableTypeConverter(ResourceResolver resourceResolver) {
return (object, targetType, context) -> {
String pathStr = object.toString();
Optional<ResourceLoader> supportingLoader = resourceResolver.getSupportingLoader(pathStr);
if (!supportingLoader.isPresent()) {
context.reject(pathStr, new ConfigurationException(
"No supported resource loader for path [" + pathStr + "]. Prefix the path with a supported prefix such as 'classpath:' or 'file:'"
)); // depends on control dependency: [if], data = [none]
return Optional.empty(); // depends on control dependency: [if], data = [none]
} else {
final Optional<URL> resource = resourceResolver.getResource(pathStr);
if (resource.isPresent()) {
return Optional.of(Readable.of(resource.get())); // depends on control dependency: [if], data = [none]
} else {
context.reject(object, new ConfigurationException("No resource exists for value: " + object)); // depends on control dependency: [if], data = [none]
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
}
};
} }
|
public class class_name {
public static String toUnicode(String str, boolean isSkipAscii) {
if (StrUtil.isEmpty(str)) {
return str;
}
final int len = str.length();
final StrBuilder unicode = StrBuilder.create(str.length() * 6);
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
if(isSkipAscii && CharUtil.isAsciiPrintable(c) ) {
unicode.append(c);
}else {
unicode.append(HexUtil.toUnicodeHex(c));
}
}
return unicode.toString();
} }
|
public class class_name {
public static String toUnicode(String str, boolean isSkipAscii) {
if (StrUtil.isEmpty(str)) {
return str;
// depends on control dependency: [if], data = [none]
}
final int len = str.length();
final StrBuilder unicode = StrBuilder.create(str.length() * 6);
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
// depends on control dependency: [for], data = [i]
if(isSkipAscii && CharUtil.isAsciiPrintable(c) ) {
unicode.append(c);
// depends on control dependency: [if], data = [none]
}else {
unicode.append(HexUtil.toUnicodeHex(c));
// depends on control dependency: [if], data = [none]
}
}
return unicode.toString();
} }
|
public class class_name {
private double selectDivisor( double v[] , double param[] ) {
double maxValue = 0;
int maxIndex = 0;
for( int i = 0; i < v.length; i++ ) {
if( Math.abs(v[i]) > maxValue ) {
maxValue = Math.abs(v[i]);
maxIndex = i;
}
}
double divisor = v[maxIndex];
int index = 0;
for( int i = 0; i < v.length; i++ ) {
v[i] /= divisor;
if( i != maxIndex ) {
// save first 5 parameters
param[index] = v[i];
// save indexes in the matrix
int col = i < 3 ? col0 : col1;
indexes[index++] = 3*(i%3)+ col;
}
}
// index of 1
int col = maxIndex >= 3 ? col1 : col0;
indexes[5] = 3*(maxIndex % 3) + col;
return divisor;
} }
|
public class class_name {
private double selectDivisor( double v[] , double param[] ) {
double maxValue = 0;
int maxIndex = 0;
for( int i = 0; i < v.length; i++ ) {
if( Math.abs(v[i]) > maxValue ) {
maxValue = Math.abs(v[i]); // depends on control dependency: [if], data = [none]
maxIndex = i; // depends on control dependency: [if], data = [none]
}
}
double divisor = v[maxIndex];
int index = 0;
for( int i = 0; i < v.length; i++ ) {
v[i] /= divisor; // depends on control dependency: [for], data = [i]
if( i != maxIndex ) {
// save first 5 parameters
param[index] = v[i]; // depends on control dependency: [if], data = [none]
// save indexes in the matrix
int col = i < 3 ? col0 : col1;
indexes[index++] = 3*(i%3)+ col; // depends on control dependency: [if], data = [none]
}
}
// index of 1
int col = maxIndex >= 3 ? col1 : col0;
indexes[5] = 3*(maxIndex % 3) + col;
return divisor;
} }
|
public class class_name {
public boolean contains(final double k) {
long longKey = Double.doubleToLongBits(k);
if (longKey == 0L) {
return this.containsZero;
} else {
double[] key = this.key;
long curr;
int pos;
if ((curr = Double.doubleToLongBits(key[pos = (int) MurmurHashUtil.fmix(longKey) & this.mask])) == 0L) {
return false;
} else if (longKey == curr) {
return true;
} else {
while ((curr = Double.doubleToLongBits(key[pos = pos + 1 & this.mask])) != 0L) {
if (longKey == curr) {
return true;
}
}
return false;
}
}
} }
|
public class class_name {
public boolean contains(final double k) {
long longKey = Double.doubleToLongBits(k);
if (longKey == 0L) {
return this.containsZero; // depends on control dependency: [if], data = [none]
} else {
double[] key = this.key;
long curr;
int pos;
if ((curr = Double.doubleToLongBits(key[pos = (int) MurmurHashUtil.fmix(longKey) & this.mask])) == 0L) {
return false; // depends on control dependency: [if], data = [none]
} else if (longKey == curr) {
return true; // depends on control dependency: [if], data = [none]
} else {
while ((curr = Double.doubleToLongBits(key[pos = pos + 1 & this.mask])) != 0L) {
if (longKey == curr) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private void beginStopping(boolean application, J2EEName j2eeName, Collection<EJBModuleMetaDataImpl> modules) { // F743-26072
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "beginStopping: application=" + application + ", " + j2eeName);
synchronized (this) {
if (application) { // F743-26072
ivStopping = true;
}
// F743-15941 - If the application or fine-grained module start
// failed, then we never transitioned to "fully started". Unblock
// any threads that are waiting in checkIfEJBWorkAllowed.
//
// This call is within the synchronized block only to reduce
// monitor acquisition/release.
unblockThreadsWaitingForStart();
}
if (j2eeName != null) {
// d589357 - Cancel non-persistent timers. We do not allow new
// non-persistent timers to be created after the application or
// module has begun stopping (e.g., during PreDestroy), so we also
// remove all existing timers before calling PreDestroy.
ivContainer.getEJBRuntime().removeTimers(j2eeName); // F743-26072
}
if (ivSingletonInitializations != null) {
List<EJSHome> reverse = new ArrayList<EJSHome>(ivSingletonInitializations);
for (int i = reverse.size(); --i >= 0;) {
EJSHome home = reverse.get(i);
J2EEName homeJ2EEName = home.getJ2EEName();
if (application || (j2eeName.getModule().equals(homeJ2EEName.getModule()))) {
home.destroy();
ivSingletonInitializations.remove(home);
}
}
}
try {
notifyApplicationEventListeners(modules, false); // F743-26072
} catch (RuntimeWarning rw) {
FFDCFilter.processException(rw, CLASS_NAME + ".stopping", "977", this);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "beginStopping");
} }
|
public class class_name {
private void beginStopping(boolean application, J2EEName j2eeName, Collection<EJBModuleMetaDataImpl> modules) { // F743-26072
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "beginStopping: application=" + application + ", " + j2eeName);
synchronized (this) {
if (application) { // F743-26072
ivStopping = true; // depends on control dependency: [if], data = [none]
}
// F743-15941 - If the application or fine-grained module start
// failed, then we never transitioned to "fully started". Unblock
// any threads that are waiting in checkIfEJBWorkAllowed.
//
// This call is within the synchronized block only to reduce
// monitor acquisition/release.
unblockThreadsWaitingForStart();
}
if (j2eeName != null) {
// d589357 - Cancel non-persistent timers. We do not allow new
// non-persistent timers to be created after the application or
// module has begun stopping (e.g., during PreDestroy), so we also
// remove all existing timers before calling PreDestroy.
ivContainer.getEJBRuntime().removeTimers(j2eeName); // F743-26072 // depends on control dependency: [if], data = [(j2eeName]
}
if (ivSingletonInitializations != null) {
List<EJSHome> reverse = new ArrayList<EJSHome>(ivSingletonInitializations);
for (int i = reverse.size(); --i >= 0;) {
EJSHome home = reverse.get(i);
J2EEName homeJ2EEName = home.getJ2EEName();
if (application || (j2eeName.getModule().equals(homeJ2EEName.getModule()))) {
home.destroy(); // depends on control dependency: [if], data = [none]
ivSingletonInitializations.remove(home); // depends on control dependency: [if], data = [none]
}
}
}
try {
notifyApplicationEventListeners(modules, false); // F743-26072 // depends on control dependency: [try], data = [none]
} catch (RuntimeWarning rw) {
FFDCFilter.processException(rw, CLASS_NAME + ".stopping", "977", this);
} // depends on control dependency: [catch], data = [none]
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "beginStopping");
} }
|
public class class_name {
private Set<String> getResourceNamesFromJar(String path, URL resourceURL) {
URLConnection con = null;
try {
if (resourceURL.toString().startsWith(JawrConstant.JAR_URL_PREFIX)) {
con = resourceURL.openConnection();
}
} catch (IOException e) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Unable to find resources name for path '" + path + "'", e);
}
return Collections.emptySet();
}
JarFile jarFile;
String jarFileUrl;
String rootEntryPath;
boolean newJarFile = false;
try {
if (con instanceof JarURLConnection) {
// Should usually be the case for traditional JAR files.
JarURLConnection jarCon = (JarURLConnection) con;
jarCon.setUseCaches(true);
jarFile = jarCon.getJarFile();
JarEntry jarEntry = jarCon.getJarEntry();
rootEntryPath = (jarEntry != null ? jarEntry.getName() : "");
} else {
// No JarURLConnection -> need to resort to URL file parsing.
// We'll assume URLs of the format "jar:path!/entry", with the
// protocol
// being arbitrary as long as following the entry format.
// We'll also handle paths with and without leading "file:"
// prefix.
String urlFile = resourceURL.getFile();
int separatorIndex = urlFile.indexOf(JAR_URL_SEPARATOR);
if (separatorIndex != -1) {
jarFileUrl = urlFile.substring(0, separatorIndex);
rootEntryPath = urlFile.substring(separatorIndex + JAR_URL_SEPARATOR.length());
jarFile = getJarFile(jarFileUrl);
} else {
jarFile = new JarFile(urlFile);
rootEntryPath = "";
}
newJarFile = true;
}
} catch (IOException e) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Unable to find resources name for path '" + path + "'", e);
}
return Collections.emptySet();
}
try {
if (!"".equals(rootEntryPath) && !rootEntryPath.endsWith("/")) {
// Root entry path must end with slash to allow for proper
// matching.
// The Sun JRE does not return a slash here, but BEA JRockit
// does.
rootEntryPath = rootEntryPath + "/";
}
Set<String> result = new LinkedHashSet<>(8);
for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
JarEntry entry = entries.nextElement();
String entryPath = entry.getName();
if (isDirectChildPath(rootEntryPath, entryPath)) {
String relativePath = entryPath.substring(rootEntryPath.length());
result.add(relativePath);
}
}
return result;
} finally {
// Close jar file, but only if freshly obtained -
// not from JarURLConnection, which might cache the file reference.
if (newJarFile) {
try {
jarFile.close();
} catch (IOException e) {
// Nothing to do
}
}
}
} }
|
public class class_name {
private Set<String> getResourceNamesFromJar(String path, URL resourceURL) {
URLConnection con = null;
try {
if (resourceURL.toString().startsWith(JawrConstant.JAR_URL_PREFIX)) {
con = resourceURL.openConnection(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Unable to find resources name for path '" + path + "'", e); // depends on control dependency: [if], data = [none]
}
return Collections.emptySet();
} // depends on control dependency: [catch], data = [none]
JarFile jarFile;
String jarFileUrl;
String rootEntryPath;
boolean newJarFile = false;
try {
if (con instanceof JarURLConnection) {
// Should usually be the case for traditional JAR files.
JarURLConnection jarCon = (JarURLConnection) con;
jarCon.setUseCaches(true); // depends on control dependency: [if], data = [none]
jarFile = jarCon.getJarFile(); // depends on control dependency: [if], data = [none]
JarEntry jarEntry = jarCon.getJarEntry();
rootEntryPath = (jarEntry != null ? jarEntry.getName() : ""); // depends on control dependency: [if], data = [none]
} else {
// No JarURLConnection -> need to resort to URL file parsing.
// We'll assume URLs of the format "jar:path!/entry", with the
// protocol
// being arbitrary as long as following the entry format.
// We'll also handle paths with and without leading "file:"
// prefix.
String urlFile = resourceURL.getFile();
int separatorIndex = urlFile.indexOf(JAR_URL_SEPARATOR);
if (separatorIndex != -1) {
jarFileUrl = urlFile.substring(0, separatorIndex); // depends on control dependency: [if], data = [none]
rootEntryPath = urlFile.substring(separatorIndex + JAR_URL_SEPARATOR.length()); // depends on control dependency: [if], data = [(separatorIndex]
jarFile = getJarFile(jarFileUrl); // depends on control dependency: [if], data = [none]
} else {
jarFile = new JarFile(urlFile); // depends on control dependency: [if], data = [none]
rootEntryPath = ""; // depends on control dependency: [if], data = [none]
}
newJarFile = true; // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Unable to find resources name for path '" + path + "'", e); // depends on control dependency: [if], data = [none]
}
return Collections.emptySet();
} // depends on control dependency: [catch], data = [none]
try {
if (!"".equals(rootEntryPath) && !rootEntryPath.endsWith("/")) {
// Root entry path must end with slash to allow for proper
// matching.
// The Sun JRE does not return a slash here, but BEA JRockit
// does.
rootEntryPath = rootEntryPath + "/"; // depends on control dependency: [if], data = [none]
}
Set<String> result = new LinkedHashSet<>(8);
for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
JarEntry entry = entries.nextElement();
String entryPath = entry.getName();
if (isDirectChildPath(rootEntryPath, entryPath)) {
String relativePath = entryPath.substring(rootEntryPath.length());
result.add(relativePath); // depends on control dependency: [if], data = [none]
}
}
return result; // depends on control dependency: [try], data = [none]
} finally {
// Close jar file, but only if freshly obtained -
// not from JarURLConnection, which might cache the file reference.
if (newJarFile) {
try {
jarFile.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// Nothing to do
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
public static Session getSession(String wrapper, Object... parameters) {
// This will be the session loaded depending the selected wrapper
org.riverframework.wrapper.Session<?> _session = null;
// Trying to retrieve the session from the map
Session session = map.get(wrapper);
if (session != null && session.isOpen()) {
// There is an open session
if (parameters.length > 0) {
// and the user is trying to open a new one
throw new RiverException("There is already an open session for the wrapper " + wrapper +
". You must close the current before opening a new one.");
}
// If there are no parameters, we just return the current opened session
} else {
// If not exists or is closed, we create it using the factory
Class<?> clazzFactory = null;
try {
clazzFactory = Class.forName(wrapper + ".DefaultFactory");
} catch (ClassNotFoundException e) {
throw new RiverException("The wrapper '" + wrapper + "' can not be loaded. If you are using an non-official wrapper, " +
"check the wrapper name and its design. Check the CLASSPATH.");
}
try {
Method method = clazzFactory.getDeclaredMethod("getInstance");
method.setAccessible(true);
org.riverframework.wrapper.Factory<?> _factory = (org.riverframework.wrapper.Factory<?>) method.invoke(null);
if (_factory == null)
throw new RiverException("The factory could not be loaded.");
if (parameters.length > 0) {
// There are parameters. So, we try to create a new one.
_session = (org.riverframework.wrapper.Session<?>) _factory.getSession(parameters);
} else {
// There are no parameters. We create a closed session.
_session = null;
}
Constructor<?> constructor = DefaultSession.class.getDeclaredConstructor(org.riverframework.wrapper.Session.class);
constructor.setAccessible(true);
session = (DefaultSession) constructor.newInstance(_session);
} catch (Exception e) {
throw new RiverException("There's a problem opening the session. Maybe, you will need to check the parameters.", e);
}
map.put(wrapper, session);
}
return session;
} }
|
public class class_name {
public static Session getSession(String wrapper, Object... parameters) {
// This will be the session loaded depending the selected wrapper
org.riverframework.wrapper.Session<?> _session = null;
// Trying to retrieve the session from the map
Session session = map.get(wrapper);
if (session != null && session.isOpen()) {
// There is an open session
if (parameters.length > 0) {
// and the user is trying to open a new one
throw new RiverException("There is already an open session for the wrapper " + wrapper +
". You must close the current before opening a new one.");
}
// If there are no parameters, we just return the current opened session
} else {
// If not exists or is closed, we create it using the factory
Class<?> clazzFactory = null; // depends on control dependency: [if], data = [none]
try {
clazzFactory = Class.forName(wrapper + ".DefaultFactory"); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new RiverException("The wrapper '" + wrapper + "' can not be loaded. If you are using an non-official wrapper, " +
"check the wrapper name and its design. Check the CLASSPATH.");
} // depends on control dependency: [catch], data = [none]
try {
Method method = clazzFactory.getDeclaredMethod("getInstance");
method.setAccessible(true); // depends on control dependency: [try], data = [none]
org.riverframework.wrapper.Factory<?> _factory = (org.riverframework.wrapper.Factory<?>) method.invoke(null);
if (_factory == null)
throw new RiverException("The factory could not be loaded.");
if (parameters.length > 0) {
// There are parameters. So, we try to create a new one.
_session = (org.riverframework.wrapper.Session<?>) _factory.getSession(parameters); // depends on control dependency: [if], data = [none]
} else {
// There are no parameters. We create a closed session.
_session = null; // depends on control dependency: [if], data = [none]
}
Constructor<?> constructor = DefaultSession.class.getDeclaredConstructor(org.riverframework.wrapper.Session.class);
constructor.setAccessible(true); // depends on control dependency: [try], data = [none]
session = (DefaultSession) constructor.newInstance(_session); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RiverException("There's a problem opening the session. Maybe, you will need to check the parameters.", e);
} // depends on control dependency: [catch], data = [none]
map.put(wrapper, session); // depends on control dependency: [if], data = [none]
}
return session;
} }
|
public class class_name {
private void sendInitialMessage(final ChannelHandlerContext ctx) throws Exception {
final long connectTimeoutMillis = this.connectTimeoutMillis;
if (connectTimeoutMillis > 0) {
connectTimeoutFuture = ctx.executor().schedule(new Runnable() {
@Override
public void run() {
if (!connectPromise.isDone()) {
setConnectFailure(new ProxyConnectException(exceptionMessage("timeout")));
}
}
}, connectTimeoutMillis, TimeUnit.MILLISECONDS);
}
final Object initialMessage = newInitialMessage(ctx);
if (initialMessage != null) {
sendToProxyServer(initialMessage);
}
readIfNeeded(ctx);
} }
|
public class class_name {
private void sendInitialMessage(final ChannelHandlerContext ctx) throws Exception {
final long connectTimeoutMillis = this.connectTimeoutMillis;
if (connectTimeoutMillis > 0) {
connectTimeoutFuture = ctx.executor().schedule(new Runnable() {
@Override
public void run() {
if (!connectPromise.isDone()) {
setConnectFailure(new ProxyConnectException(exceptionMessage("timeout"))); // depends on control dependency: [if], data = [none]
}
}
}, connectTimeoutMillis, TimeUnit.MILLISECONDS);
}
final Object initialMessage = newInitialMessage(ctx);
if (initialMessage != null) {
sendToProxyServer(initialMessage);
}
readIfNeeded(ctx);
} }
|
public class class_name {
@InterfaceAudience.Public
public List<Attachment> getAttachments() {
Map<String, Object> attachmentMetadata = getAttachmentMetadata();
if (attachmentMetadata == null) {
return new ArrayList<Attachment>();
}
List<Attachment> result = new ArrayList<Attachment>(attachmentMetadata.size());
for (Map.Entry<String, Object> entry : attachmentMetadata.entrySet()) {
Attachment attachment = toAttachment(entry.getKey(), entry.getValue());
if (attachment != null) {
result.add(attachment);
}
}
return result;
} }
|
public class class_name {
@InterfaceAudience.Public
public List<Attachment> getAttachments() {
Map<String, Object> attachmentMetadata = getAttachmentMetadata();
if (attachmentMetadata == null) {
return new ArrayList<Attachment>(); // depends on control dependency: [if], data = [none]
}
List<Attachment> result = new ArrayList<Attachment>(attachmentMetadata.size());
for (Map.Entry<String, Object> entry : attachmentMetadata.entrySet()) {
Attachment attachment = toAttachment(entry.getKey(), entry.getValue());
if (attachment != null) {
result.add(attachment); // depends on control dependency: [if], data = [(attachment]
}
}
return result;
} }
|
public class class_name {
public static <T extends GenericEvent> GenericEventType getTypeOf(Class<T> clazz) {
GenericEventType eventType = TYPE_MAP.get(clazz);
if (eventType == null) {
eventType = new GenericEventType();
TYPE_MAP.put(clazz, eventType);
}
return eventType;
} }
|
public class class_name {
public static <T extends GenericEvent> GenericEventType getTypeOf(Class<T> clazz) {
GenericEventType eventType = TYPE_MAP.get(clazz);
if (eventType == null) {
eventType = new GenericEventType(); // depends on control dependency: [if], data = [none]
TYPE_MAP.put(clazz, eventType); // depends on control dependency: [if], data = [none]
}
return eventType;
} }
|
public class class_name {
static void setHttpOnlyReflect(net.javapla.jawn.core.http.Cookie awCookie, javax.servlet.http.Cookie servletCookie){
try {
servletCookie.getClass().getMethod("setHttpOnly", boolean.class).invoke(servletCookie, awCookie.isHttpOnly());
} catch (Exception e) {
// Cookie.logger.warn("You are trying to set HttpOnly on a cookie, but it appears you are running on Servlet version before 3.0.");
}
} }
|
public class class_name {
static void setHttpOnlyReflect(net.javapla.jawn.core.http.Cookie awCookie, javax.servlet.http.Cookie servletCookie){
try {
servletCookie.getClass().getMethod("setHttpOnly", boolean.class).invoke(servletCookie, awCookie.isHttpOnly()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// Cookie.logger.warn("You are trying to set HttpOnly on a cookie, but it appears you are running on Servlet version before 3.0.");
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public java.util.List<ValidationError> getValidationErrors() {
if (validationErrors == null) {
validationErrors = new com.amazonaws.internal.SdkInternalList<ValidationError>();
}
return validationErrors;
} }
|
public class class_name {
public java.util.List<ValidationError> getValidationErrors() {
if (validationErrors == null) {
validationErrors = new com.amazonaws.internal.SdkInternalList<ValidationError>(); // depends on control dependency: [if], data = [none]
}
return validationErrors;
} }
|
public class class_name {
private ProcessorConfig extractWatcherConfig() {
try {
return ProfileUtil.blendProfileWithConfiguration(ProfileUtil.WATCHER_CONFIG, profile, ResourceDirCreator.getFinalResourceDir(resourceDir, environment), watcher);
} catch (IOException e) {
throw new IllegalArgumentException("Cannot extract watcher config: " + e, e);
}
} }
|
public class class_name {
private ProcessorConfig extractWatcherConfig() {
try {
return ProfileUtil.blendProfileWithConfiguration(ProfileUtil.WATCHER_CONFIG, profile, ResourceDirCreator.getFinalResourceDir(resourceDir, environment), watcher); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalArgumentException("Cannot extract watcher config: " + e, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected Element loadDocument(String ctx_str, String loc_str, EntityResolver resolver) {
try {
final URL ctx = new URL(ctx_str);
final URL doc = new URL(ctx, loc_str);
// Use an EntityResolver if provided...
final SAXReader rdr = new SAXReader();
if (resolver != null) {
rdr.setEntityResolver(resolver);
}
// Read by passing a URL -- don't manage the URLConnection yourself...
final Element rslt = rdr.read(doc).getRootElement();
rslt.normalize();
return rslt;
} catch (Throwable t) {
String msg = "Unable to read the specified document:"
+ "\n\tCONTEXT=" + ctx_str
+ "\n\tLOCATION=" + loc_str;
throw new RuntimeException(msg, t);
}
} }
|
public class class_name {
protected Element loadDocument(String ctx_str, String loc_str, EntityResolver resolver) {
try {
final URL ctx = new URL(ctx_str);
final URL doc = new URL(ctx, loc_str);
// Use an EntityResolver if provided...
final SAXReader rdr = new SAXReader();
if (resolver != null) {
rdr.setEntityResolver(resolver); // depends on control dependency: [if], data = [(resolver]
}
// Read by passing a URL -- don't manage the URLConnection yourself...
final Element rslt = rdr.read(doc).getRootElement();
rslt.normalize(); // depends on control dependency: [try], data = [none]
return rslt; // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
String msg = "Unable to read the specified document:"
+ "\n\tCONTEXT=" + ctx_str
+ "\n\tLOCATION=" + loc_str;
throw new RuntimeException(msg, t);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private Connection newConnection() throws Exception
{
final long start = currentTime();
Connection connection = null;
try {
String username = config.getUsername();
String password = config.getPassword();
connection = (username == null) ? dataSource.getConnection() : dataSource.getConnection(username, password);
setupConnection(connection);
lastConnectionFailure.set(null);
return connection;
}
catch (Exception e) {
if (connection != null) {
quietlyCloseConnection(connection, "(Failed to create/setup connection)");
}
else if (getLastConnectionFailure() == null) {
logger.debug("{} - Failed to create/setup connection: {}", poolName, e.getMessage());
}
lastConnectionFailure.set(e);
throw e;
}
finally {
// tracker will be null during failFast check
if (metricsTracker != null) {
metricsTracker.recordConnectionCreated(elapsedMillis(start));
}
}
} }
|
public class class_name {
private Connection newConnection() throws Exception
{
final long start = currentTime();
Connection connection = null;
try {
String username = config.getUsername();
String password = config.getPassword();
connection = (username == null) ? dataSource.getConnection() : dataSource.getConnection(username, password);
setupConnection(connection);
lastConnectionFailure.set(null);
return connection;
}
catch (Exception e) {
if (connection != null) {
quietlyCloseConnection(connection, "(Failed to create/setup connection)"); // depends on control dependency: [if], data = [(connection]
}
else if (getLastConnectionFailure() == null) {
logger.debug("{} - Failed to create/setup connection: {}", poolName, e.getMessage()); // depends on control dependency: [if], data = [none]
}
lastConnectionFailure.set(e);
throw e;
}
finally {
// tracker will be null during failFast check
if (metricsTracker != null) {
metricsTracker.recordConnectionCreated(elapsedMillis(start)); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
ArgumentsBuilder param(String param, String value) {
if (value != null) {
args.add(param);
args.add(value);
}
return this;
} }
|
public class class_name {
ArgumentsBuilder param(String param, String value) {
if (value != null) {
args.add(param); // depends on control dependency: [if], data = [none]
args.add(value); // depends on control dependency: [if], data = [(value]
}
return this;
} }
|
public class class_name {
public void load(File authorizationFile) throws AuthorizationFileException {
FileInputStream fis = null;
try {
fis = new FileInputStream(authorizationFile);
ANTLRInputStream stream = new ANTLRInputStream(fis);
SAFPLexer lexer = new SAFPLexer(stream);
CommonTokenStream tokens = new CommonTokenStream(lexer);
SAFPParser parser = new SAFPParser(tokens);
parser.prog();
setAccessRules(parser.getAccessRules());
setGroups(parser.getGroups());
setAliases(parser.getAliases());
} catch (FileNotFoundException e) {
throw new AuthorizationFileException("FileNotFoundException: ", e);
} catch (IOException e) {
throw new AuthorizationFileException("IOException: ", e);
} catch (RecognitionException e) {
throw new AuthorizationFileException("Parser problem: ", e);
} finally {
try {
fis.close();
} catch (IOException e) {
throw new AuthorizationFileException("IOExcetion during close: ", e);
}
}
} }
|
public class class_name {
public void load(File authorizationFile) throws AuthorizationFileException {
FileInputStream fis = null;
try {
fis = new FileInputStream(authorizationFile);
ANTLRInputStream stream = new ANTLRInputStream(fis);
SAFPLexer lexer = new SAFPLexer(stream);
CommonTokenStream tokens = new CommonTokenStream(lexer);
SAFPParser parser = new SAFPParser(tokens);
parser.prog();
setAccessRules(parser.getAccessRules());
setGroups(parser.getGroups());
setAliases(parser.getAliases());
} catch (FileNotFoundException e) {
throw new AuthorizationFileException("FileNotFoundException: ", e);
} catch (IOException e) {
throw new AuthorizationFileException("IOException: ", e);
} catch (RecognitionException e) {
throw new AuthorizationFileException("Parser problem: ", e);
} finally {
try {
fis.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new AuthorizationFileException("IOExcetion during close: ", e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static JobOperator getJobOperator() {
JobOperator operator = AccessController.doPrivileged(new PrivilegedAction<JobOperator> () {
public JobOperator run() {
ServiceLoader<JobOperator> loader = ServiceLoader.load(JobOperator.class);
JobOperator returnVal = null;
for (JobOperator provider : loader) {
if (provider != null) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Loaded BatchContainerServiceProvider with className = " + provider.getClass().getCanonicalName());
}
// Use first one
returnVal = provider;
break;
}
}
return returnVal;
}
});
if (operator == null) {
if (logger.isLoggable(Level.WARNING)) {
logger.warning("The ServiceLoader was unable to find an implementation for JobOperator. Check classpath for META-INF/services/javax.batch.operations.JobOperator file.");
}
}
return operator;
} }
|
public class class_name {
public static JobOperator getJobOperator() {
JobOperator operator = AccessController.doPrivileged(new PrivilegedAction<JobOperator> () {
public JobOperator run() {
ServiceLoader<JobOperator> loader = ServiceLoader.load(JobOperator.class);
JobOperator returnVal = null;
for (JobOperator provider : loader) {
if (provider != null) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Loaded BatchContainerServiceProvider with className = " + provider.getClass().getCanonicalName());
// depends on control dependency: [if], data = [none]
}
// Use first one
returnVal = provider;
// depends on control dependency: [if], data = [none]
break;
}
}
return returnVal;
}
});
if (operator == null) {
if (logger.isLoggable(Level.WARNING)) {
logger.warning("The ServiceLoader was unable to find an implementation for JobOperator. Check classpath for META-INF/services/javax.batch.operations.JobOperator file.");
// depends on control dependency: [if], data = [none]
}
}
return operator;
} }
|
public class class_name {
public long getIdInternal()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getIdInternal");
SibTr.exit(tc, "getIdInternal", new Long(_consumerId));
}
return _consumerId;
} }
|
public class class_name {
public long getIdInternal()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "getIdInternal"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "getIdInternal", new Long(_consumerId)); // depends on control dependency: [if], data = [none]
}
return _consumerId;
} }
|
public class class_name {
@SuppressWarnings("squid:S2083")
@PostMapping("/importByUrl")
@ResponseBody
public ResponseEntity<String> importFileByUrl(
HttpServletRequest request,
@RequestParam("url") String url,
@RequestParam(value = "entityTypeId", required = false) String entityTypeId,
@RequestParam(value = "packageId", required = false) String packageId,
@RequestParam(value = "metadataAction", required = false) String metadataAction,
@RequestParam(value = "action", required = false) String action,
@RequestParam(value = "notify", required = false) Boolean notify)
throws URISyntaxException {
ImportRun importRun;
try {
File tmpFile = fileLocationToStoredRenamedFile(url, entityTypeId);
if (packageId != null && !dataService.getMeta().getPackage(packageId).isPresent()) {
return ResponseEntity.badRequest()
.contentType(TEXT_PLAIN)
.body(MessageFormat.format("Package [{0}] does not exist.", packageId));
}
importRun = importFile(request, tmpFile, metadataAction, action, notify, packageId);
} catch (Exception e) {
LOG.error(e.getMessage());
return ResponseEntity.badRequest().contentType(TEXT_PLAIN).body(e.getMessage());
}
return createCreatedResponseEntity(importRun);
} }
|
public class class_name {
@SuppressWarnings("squid:S2083")
@PostMapping("/importByUrl")
@ResponseBody
public ResponseEntity<String> importFileByUrl(
HttpServletRequest request,
@RequestParam("url") String url,
@RequestParam(value = "entityTypeId", required = false) String entityTypeId,
@RequestParam(value = "packageId", required = false) String packageId,
@RequestParam(value = "metadataAction", required = false) String metadataAction,
@RequestParam(value = "action", required = false) String action,
@RequestParam(value = "notify", required = false) Boolean notify)
throws URISyntaxException {
ImportRun importRun;
try {
File tmpFile = fileLocationToStoredRenamedFile(url, entityTypeId);
if (packageId != null && !dataService.getMeta().getPackage(packageId).isPresent()) {
return ResponseEntity.badRequest()
.contentType(TEXT_PLAIN)
.body(MessageFormat.format("Package [{0}] does not exist.", packageId)); // depends on control dependency: [if], data = [none]
}
importRun = importFile(request, tmpFile, metadataAction, action, notify, packageId);
} catch (Exception e) {
LOG.error(e.getMessage());
return ResponseEntity.badRequest().contentType(TEXT_PLAIN).body(e.getMessage());
}
return createCreatedResponseEntity(importRun);
} }
|
public class class_name {
public void seekTo(long seekToSamples) throws IOException
{
// Seek with SeekTable if any provided
if (seekTable!=null)
{
for (int s=0; s < seekTable.numberOfPoints(); s++)
{
SeekPoint p = seekTable.getSeekPoint(s);
samplesDecoded = p.getSampleNumber();
if (samplesDecoded >= seekToSamples)
{
if (s>0) p = seekTable.getSeekPoint(s-1);
samplesDecoded = p.getSampleNumber();
bitStream.skip(p.getStreamOffset());
break;
}
}
}
while (samplesDecoded < seekToSamples)
{
try
{
findFrameSync();
readFrame();
if (frame!=null && frame.header!=null)
{
samplesDecoded = frame.header.sampleNumber;
if (samplesDecoded + frame.header.blockSize >= seekToSamples) break;
}
}
catch (Throwable ex)
{
// We will recieve DecoderExceptions if we did seek
// I would expect that seeking will reach a sync point
}
}
} }
|
public class class_name {
public void seekTo(long seekToSamples) throws IOException
{
// Seek with SeekTable if any provided
if (seekTable!=null)
{
for (int s=0; s < seekTable.numberOfPoints(); s++)
{
SeekPoint p = seekTable.getSeekPoint(s);
samplesDecoded = p.getSampleNumber();
if (samplesDecoded >= seekToSamples)
{
if (s>0) p = seekTable.getSeekPoint(s-1);
samplesDecoded = p.getSampleNumber(); // depends on control dependency: [if], data = [none]
bitStream.skip(p.getStreamOffset()); // depends on control dependency: [if], data = [none]
break;
}
}
}
while (samplesDecoded < seekToSamples)
{
try
{
findFrameSync();
readFrame();
if (frame!=null && frame.header!=null)
{
samplesDecoded = frame.header.sampleNumber;
if (samplesDecoded + frame.header.blockSize >= seekToSamples) break;
}
}
catch (Throwable ex)
{
// We will recieve DecoderExceptions if we did seek
// I would expect that seeking will reach a sync point
}
}
} }
|
public class class_name {
synchronized void updateRegistration(BundleContext ctx) {
if (registration == null) {
registration = ctx.registerService(KeystoreConfig.class, this, properties);
} else {
registration.setProperties(properties);
}
} }
|
public class class_name {
synchronized void updateRegistration(BundleContext ctx) {
if (registration == null) {
registration = ctx.registerService(KeystoreConfig.class, this, properties); // depends on control dependency: [if], data = [none]
} else {
registration.setProperties(properties); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Object[] removeAt(Object[] array, int index) {
if (array == null) {
return null;
}
if (index < 0 || index >= array.length) {
return array;
}
Object[] retVal = (Object[]) Array.newInstance(array[0].getClass(), array.length - 1);
for (int i = 0; i < array.length; i++) {
if (i < index) {
retVal[i] = array[i];
} else if (i > index) {
retVal[i - 1] = array[i];
}
}
return retVal;
} }
|
public class class_name {
public static Object[] removeAt(Object[] array, int index) {
if (array == null) {
return null;
// depends on control dependency: [if], data = [none]
}
if (index < 0 || index >= array.length) {
return array;
// depends on control dependency: [if], data = [none]
}
Object[] retVal = (Object[]) Array.newInstance(array[0].getClass(), array.length - 1);
for (int i = 0; i < array.length; i++) {
if (i < index) {
retVal[i] = array[i];
// depends on control dependency: [if], data = [none]
} else if (i > index) {
retVal[i - 1] = array[i];
// depends on control dependency: [if], data = [none]
}
}
return retVal;
} }
|
public class class_name {
public ConstructorDeclaration getConstructor(String signature) {
for (EntityDeclaration node : type.getMembers()) {
if (node.getEntityType() == EntityType.CONSTRUCTOR) {
ConstructorDeclaration cons = (ConstructorDeclaration) node;
if (signature.equals(signature(cons))) {
return cons;
}
}
}
return null;
} }
|
public class class_name {
public ConstructorDeclaration getConstructor(String signature) {
for (EntityDeclaration node : type.getMembers()) {
if (node.getEntityType() == EntityType.CONSTRUCTOR) {
ConstructorDeclaration cons = (ConstructorDeclaration) node;
if (signature.equals(signature(cons))) {
return cons; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
private void refreshViewHolders() {
if (mAdapter != null) {
for (ViewHolder holder : mViewHolders.getAll()) {
if (holder != null) {
// cell item
refreshItemViewHolder(holder, mState.isRowDragging(), mState.isColumnDragging());
}
}
if (mState.isColumnDragging()) {
refreshAllColumnHeadersHolders();
refreshAllRowHeadersHolders();
} else {
refreshAllRowHeadersHolders();
refreshAllColumnHeadersHolders();
}
if (mLeftTopViewHolder != null) {
refreshLeftTopHeaderViewHolder(mLeftTopViewHolder);
mLeftTopViewHolder.getItemView().bringToFront();
}
}
} }
|
public class class_name {
private void refreshViewHolders() {
if (mAdapter != null) {
for (ViewHolder holder : mViewHolders.getAll()) {
if (holder != null) {
// cell item
refreshItemViewHolder(holder, mState.isRowDragging(), mState.isColumnDragging()); // depends on control dependency: [if], data = [(holder]
}
}
if (mState.isColumnDragging()) {
refreshAllColumnHeadersHolders(); // depends on control dependency: [if], data = [none]
refreshAllRowHeadersHolders(); // depends on control dependency: [if], data = [none]
} else {
refreshAllRowHeadersHolders(); // depends on control dependency: [if], data = [none]
refreshAllColumnHeadersHolders(); // depends on control dependency: [if], data = [none]
}
if (mLeftTopViewHolder != null) {
refreshLeftTopHeaderViewHolder(mLeftTopViewHolder); // depends on control dependency: [if], data = [(mLeftTopViewHolder]
mLeftTopViewHolder.getItemView().bringToFront(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private static void fireDefaultSREChanged(ISREInstall previous, ISREInstall current) {
for (final Object listener : SRE_LISTENERS.getListeners()) {
((ISREInstallChangedListener) listener).defaultSREInstallChanged(previous, current);
}
} }
|
public class class_name {
private static void fireDefaultSREChanged(ISREInstall previous, ISREInstall current) {
for (final Object listener : SRE_LISTENERS.getListeners()) {
((ISREInstallChangedListener) listener).defaultSREInstallChanged(previous, current); // depends on control dependency: [for], data = [listener]
}
} }
|
public class class_name {
public void saveContainerpage(final Runnable... afterSaveActions) {
if (hasPageChanged()) {
final CmsRpcAction<Long> action = new CmsRpcAction<Long>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(500, true);
if (getData().getDetailContainerPage() != null) {
getContainerpageService().saveDetailContainers(
getData().getDetailId(),
getData().getDetailContainerPage(),
getPageContent(),
this);
} else {
getContainerpageService().saveContainerpage(
CmsCoreProvider.get().getStructureId(),
getPageContent(),
this);
}
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(Long result) {
setLoadTime(result);
stop(false);
setPageChanged(false, false);
CmsContainerpageController.get().fireEvent(new CmsContainerpageEvent(EventType.pageSaved));
for (Runnable afterSaveAction : afterSaveActions) {
afterSaveAction.run();
}
}
};
if (getData().getDetailContainerPage() != null) {
action.execute();
} else {
lockContainerpage(new I_CmsSimpleCallback<Boolean>() {
public void execute(Boolean arg) {
if (arg.booleanValue()) {
action.execute();
}
}
});
}
}
} }
|
public class class_name {
public void saveContainerpage(final Runnable... afterSaveActions) {
if (hasPageChanged()) {
final CmsRpcAction<Long> action = new CmsRpcAction<Long>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(500, true);
if (getData().getDetailContainerPage() != null) {
getContainerpageService().saveDetailContainers(
getData().getDetailId(),
getData().getDetailContainerPage(),
getPageContent(),
this); // depends on control dependency: [if], data = [none]
} else {
getContainerpageService().saveContainerpage(
CmsCoreProvider.get().getStructureId(),
getPageContent(),
this); // depends on control dependency: [if], data = [none]
}
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(Long result) {
setLoadTime(result);
stop(false);
setPageChanged(false, false);
CmsContainerpageController.get().fireEvent(new CmsContainerpageEvent(EventType.pageSaved));
for (Runnable afterSaveAction : afterSaveActions) {
afterSaveAction.run(); // depends on control dependency: [for], data = [afterSaveAction]
}
}
};
if (getData().getDetailContainerPage() != null) {
action.execute(); // depends on control dependency: [if], data = [none]
} else {
lockContainerpage(new I_CmsSimpleCallback<Boolean>() {
public void execute(Boolean arg) {
if (arg.booleanValue()) {
action.execute(); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void marshall(DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (decisionTaskScheduledEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(decisionTaskScheduledEventAttributes.getTaskList(), TASKLIST_BINDING);
protocolMarshaller.marshall(decisionTaskScheduledEventAttributes.getTaskPriority(), TASKPRIORITY_BINDING);
protocolMarshaller.marshall(decisionTaskScheduledEventAttributes.getStartToCloseTimeout(), STARTTOCLOSETIMEOUT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (decisionTaskScheduledEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(decisionTaskScheduledEventAttributes.getTaskList(), TASKLIST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(decisionTaskScheduledEventAttributes.getTaskPriority(), TASKPRIORITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(decisionTaskScheduledEventAttributes.getStartToCloseTimeout(), STARTTOCLOSETIMEOUT_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 Field[] getAllDeclaredFields(Class<?> clazz) {
Field[] declaredFields = clazz.getDeclaredFields();
Class<?> superClass = clazz.getSuperclass();
if (superClass != null && superClass != Object.class) {
declaredFields = ArrayUtil.concat(declaredFields, getAllDeclaredFields(superClass));
}
return declaredFields;
} }
|
public class class_name {
public static Field[] getAllDeclaredFields(Class<?> clazz) {
Field[] declaredFields = clazz.getDeclaredFields();
Class<?> superClass = clazz.getSuperclass();
if (superClass != null && superClass != Object.class) {
declaredFields = ArrayUtil.concat(declaredFields, getAllDeclaredFields(superClass)); // depends on control dependency: [if], data = [(superClass]
}
return declaredFields;
} }
|
public class class_name {
protected void aggregateReports() {
clusterUtil.clear();
for (String jobId : allJobUtil.keySet()) {
JobUtilization jobUtil = allJobUtil.get(jobId);
jobUtil.clear();
jobUtil.setIsRunning(false);
}
for (UtilizationReport report : taskTrackerReports.values()) {
if (report.isExpired()) {
continue; // ignore the report if it is older than the timeLimit
}
LocalJobUtilization[] localJobUtils = report.getJobUtilization();
TaskTrackerUtilization ttUtil = report.getTaskTrackerUtilization();
// Aggregate cluster information
double cpuUsageGHz = clusterUtil.getCpuUsageGHz();
double cpuTotalGHz = clusterUtil.getCpuTotalGHz();
double memUsageGB = clusterUtil.getMemUsageGB();
double memTotalGB = clusterUtil.getMemTotalGB();
int numCpu = clusterUtil.getNumCpu();
int numTaskTrackers = clusterUtil.getNumTaskTrackers();
cpuUsageGHz += ttUtil.getCpuUsageGHz();
cpuTotalGHz += ttUtil.getCpuTotalGHz();
memUsageGB += ttUtil.getMemUsageGB();
memTotalGB += ttUtil.getMemTotalGB();
numCpu += ttUtil.getNumCpu();
numTaskTrackers += 1;
clusterUtil.setCpuUsageGHz(cpuUsageGHz);
clusterUtil.setCpuTotalGHz(cpuTotalGHz);
clusterUtil.setMemUsageGB(memUsageGB);
clusterUtil.setMemTotalGB(memTotalGB);
clusterUtil.setNumCpu(numCpu);
clusterUtil.setNumTaskTrackers(numTaskTrackers);
// Aggregate Job based information
if ( localJobUtils == null) {
continue;
}
for (LocalJobUtilization localJobUtil : localJobUtils) {
String jobId = localJobUtil.getJobId();
if (jobId == null) {
continue;
}
if (!allJobUtil.containsKey(jobId)) {
JobUtilization jobUtil = new JobUtilization();
jobUtil.setJobId(jobId);
allJobUtil.put(jobId, jobUtil);
}
JobUtilization jobUtil = allJobUtil.get(jobId);
jobUtil.setIsRunning(true);
double maxCpu = jobUtil.getCpuMaxPercentageOnBox();
double cpu = jobUtil.getCpuPercentageOnCluster();
double cpuGigaCycles = jobUtil.getCpuGigaCycles();
double maxMem = jobUtil.getMemMaxPercentageOnBox();
double mem = jobUtil.getMemPercentageOnCluster();
cpu += localJobUtil.getCpuUsageGHz(); // will be normalized later
mem += localJobUtil.getMemUsageGB(); // will be normalized later
cpuGigaCycles += localJobUtil.getCpuUsageGHz() *
(double)aggregatePeriod * 1e6D / 1e9D;
// GHz * ms = 1e6. To convert to Giga, divide by 1e9
double localCpuPercentage =
localJobUtil.getCpuUsageGHz() / ttUtil.getCpuTotalGHz() * 100;
double localMemPercentage =
localJobUtil.getMemUsageGB() / ttUtil.getMemTotalGB() * 100;
if (maxCpu < localCpuPercentage) {
maxCpu = localCpuPercentage;
}
if (maxMem < localMemPercentage) {
maxMem = localMemPercentage;
}
jobUtil.setCpuMaxPercentageOnBox(maxCpu);
jobUtil.setCpuGigaCycles(cpuGigaCycles);
jobUtil.setCpuPercentageOnCluster(cpu); // will be normalized later
jobUtil.setMemMaxPercentageOnBox(maxMem); // will be normalized later
jobUtil.setMemPercentageOnCluster(mem);
if (maxMem > jobUtil.getMemMaxPercentageOnBoxAllTime()) {
jobUtil.setMemMaxPercentageOnBoxAllTime(maxMem);
}
}
}
// Normalization and clean up finished jobs
for (Iterator<String>
it = allJobUtil.keySet().iterator(); it.hasNext();) {
String jobId = it.next();
JobUtilization jobUtil = allJobUtil.get(jobId);
if (!jobUtil.getIsRunning()) {
long stoppedTime = jobUtil.getStoppedTime();
stoppedTime += aggregatePeriod;
jobUtil.setStoppedTime(stoppedTime);
jobUtil.setIsRunning(false);
if (stoppedTime > stopTimeLimit) {
// These are finished jobs
// We may store the information of finished jobs to some place
double cpuTime = jobUtil.getCpuCumulatedUsageTime() / 1000D;
double memTime = jobUtil.getMemCumulatedUsageTime() / 1000D;
double peakMem = jobUtil.getMemMaxPercentageOnBoxAllTime();
double cpuGigaCycles = jobUtil.getCpuGigaCycles();
it.remove();
LOG.info(String.format(
"Job done: [JobID,CPU(sec),Mem(sec),Peak Mem(%%),CPU gigacycles]" +
" = [%s,%f,%f,%f,%f]",
jobId, cpuTime, memTime, peakMem, cpuGigaCycles));
}
continue;
}
long runningTime = jobUtil.getRunningTime();
runningTime += aggregatePeriod; // millisecond to second
jobUtil.setRunningTime(runningTime);
jobUtil.setStoppedTime(0);
jobUtil.setIsRunning(true);
int numJobs = clusterUtil.getNumRunningJobs();
numJobs += 1;
clusterUtil.setNumRunningJobs(numJobs);
double cpu = jobUtil.getCpuPercentageOnCluster();
double mem = jobUtil.getMemPercentageOnCluster();
double cpuTime = jobUtil.getCpuCumulatedUsageTime();
double memTime = jobUtil.getMemCumulatedUsageTime();
cpu = cpu / clusterUtil.getCpuTotalGHz() * 100;
mem = mem / clusterUtil.getMemTotalGB() * 100;
cpuTime += cpu / 100 * aggregatePeriod; // in milliseconds
memTime += mem / 100 * aggregatePeriod; // in milliseconds
jobUtil.setCpuPercentageOnCluster(cpu);
jobUtil.setMemPercentageOnCluster(mem);
jobUtil.setCpuCumulatedUsageTime(cpuTime);
jobUtil.setMemCumulatedUsageTime(memTime);
}
} }
|
public class class_name {
protected void aggregateReports() {
clusterUtil.clear();
for (String jobId : allJobUtil.keySet()) {
JobUtilization jobUtil = allJobUtil.get(jobId);
jobUtil.clear(); // depends on control dependency: [for], data = [none]
jobUtil.setIsRunning(false); // depends on control dependency: [for], data = [none]
}
for (UtilizationReport report : taskTrackerReports.values()) {
if (report.isExpired()) {
continue; // ignore the report if it is older than the timeLimit
}
LocalJobUtilization[] localJobUtils = report.getJobUtilization();
TaskTrackerUtilization ttUtil = report.getTaskTrackerUtilization();
// Aggregate cluster information
double cpuUsageGHz = clusterUtil.getCpuUsageGHz();
double cpuTotalGHz = clusterUtil.getCpuTotalGHz();
double memUsageGB = clusterUtil.getMemUsageGB();
double memTotalGB = clusterUtil.getMemTotalGB();
int numCpu = clusterUtil.getNumCpu();
int numTaskTrackers = clusterUtil.getNumTaskTrackers();
cpuUsageGHz += ttUtil.getCpuUsageGHz(); // depends on control dependency: [for], data = [none]
cpuTotalGHz += ttUtil.getCpuTotalGHz(); // depends on control dependency: [for], data = [none]
memUsageGB += ttUtil.getMemUsageGB(); // depends on control dependency: [for], data = [none]
memTotalGB += ttUtil.getMemTotalGB(); // depends on control dependency: [for], data = [none]
numCpu += ttUtil.getNumCpu(); // depends on control dependency: [for], data = [none]
numTaskTrackers += 1; // depends on control dependency: [for], data = [none]
clusterUtil.setCpuUsageGHz(cpuUsageGHz); // depends on control dependency: [for], data = [none]
clusterUtil.setCpuTotalGHz(cpuTotalGHz); // depends on control dependency: [for], data = [none]
clusterUtil.setMemUsageGB(memUsageGB); // depends on control dependency: [for], data = [none]
clusterUtil.setMemTotalGB(memTotalGB); // depends on control dependency: [for], data = [none]
clusterUtil.setNumCpu(numCpu); // depends on control dependency: [for], data = [none]
clusterUtil.setNumTaskTrackers(numTaskTrackers); // depends on control dependency: [for], data = [none]
// Aggregate Job based information
if ( localJobUtils == null) {
continue;
}
for (LocalJobUtilization localJobUtil : localJobUtils) {
String jobId = localJobUtil.getJobId();
if (jobId == null) {
continue;
}
if (!allJobUtil.containsKey(jobId)) {
JobUtilization jobUtil = new JobUtilization();
jobUtil.setJobId(jobId); // depends on control dependency: [if], data = [none]
allJobUtil.put(jobId, jobUtil); // depends on control dependency: [if], data = [none]
}
JobUtilization jobUtil = allJobUtil.get(jobId);
jobUtil.setIsRunning(true); // depends on control dependency: [for], data = [none]
double maxCpu = jobUtil.getCpuMaxPercentageOnBox();
double cpu = jobUtil.getCpuPercentageOnCluster();
double cpuGigaCycles = jobUtil.getCpuGigaCycles();
double maxMem = jobUtil.getMemMaxPercentageOnBox();
double mem = jobUtil.getMemPercentageOnCluster();
cpu += localJobUtil.getCpuUsageGHz(); // will be normalized later // depends on control dependency: [for], data = [localJobUtil]
mem += localJobUtil.getMemUsageGB(); // will be normalized later // depends on control dependency: [for], data = [localJobUtil]
cpuGigaCycles += localJobUtil.getCpuUsageGHz() *
(double)aggregatePeriod * 1e6D / 1e9D; // depends on control dependency: [for], data = [localJobUtil]
// GHz * ms = 1e6. To convert to Giga, divide by 1e9
double localCpuPercentage =
localJobUtil.getCpuUsageGHz() / ttUtil.getCpuTotalGHz() * 100;
double localMemPercentage =
localJobUtil.getMemUsageGB() / ttUtil.getMemTotalGB() * 100;
if (maxCpu < localCpuPercentage) {
maxCpu = localCpuPercentage; // depends on control dependency: [if], data = [none]
}
if (maxMem < localMemPercentage) {
maxMem = localMemPercentage; // depends on control dependency: [if], data = [none]
}
jobUtil.setCpuMaxPercentageOnBox(maxCpu); // depends on control dependency: [for], data = [none]
jobUtil.setCpuGigaCycles(cpuGigaCycles); // depends on control dependency: [for], data = [none]
jobUtil.setCpuPercentageOnCluster(cpu); // will be normalized later // depends on control dependency: [for], data = [none]
jobUtil.setMemMaxPercentageOnBox(maxMem); // will be normalized later // depends on control dependency: [for], data = [none]
jobUtil.setMemPercentageOnCluster(mem); // depends on control dependency: [for], data = [none]
if (maxMem > jobUtil.getMemMaxPercentageOnBoxAllTime()) {
jobUtil.setMemMaxPercentageOnBoxAllTime(maxMem); // depends on control dependency: [if], data = [(maxMem]
}
}
}
// Normalization and clean up finished jobs
for (Iterator<String>
it = allJobUtil.keySet().iterator(); it.hasNext();) {
String jobId = it.next();
JobUtilization jobUtil = allJobUtil.get(jobId);
if (!jobUtil.getIsRunning()) {
long stoppedTime = jobUtil.getStoppedTime();
stoppedTime += aggregatePeriod; // depends on control dependency: [if], data = [none]
jobUtil.setStoppedTime(stoppedTime); // depends on control dependency: [if], data = [none]
jobUtil.setIsRunning(false); // depends on control dependency: [if], data = [none]
if (stoppedTime > stopTimeLimit) {
// These are finished jobs
// We may store the information of finished jobs to some place
double cpuTime = jobUtil.getCpuCumulatedUsageTime() / 1000D;
double memTime = jobUtil.getMemCumulatedUsageTime() / 1000D;
double peakMem = jobUtil.getMemMaxPercentageOnBoxAllTime();
double cpuGigaCycles = jobUtil.getCpuGigaCycles();
it.remove(); // depends on control dependency: [if], data = [none]
LOG.info(String.format(
"Job done: [JobID,CPU(sec),Mem(sec),Peak Mem(%%),CPU gigacycles]" +
" = [%s,%f,%f,%f,%f]",
jobId, cpuTime, memTime, peakMem, cpuGigaCycles)); // depends on control dependency: [if], data = [none]
}
continue;
}
long runningTime = jobUtil.getRunningTime();
runningTime += aggregatePeriod; // millisecond to second // depends on control dependency: [for], data = [none]
jobUtil.setRunningTime(runningTime); // depends on control dependency: [for], data = [none]
jobUtil.setStoppedTime(0); // depends on control dependency: [for], data = [none]
jobUtil.setIsRunning(true); // depends on control dependency: [for], data = [none]
int numJobs = clusterUtil.getNumRunningJobs();
numJobs += 1; // depends on control dependency: [for], data = [none]
clusterUtil.setNumRunningJobs(numJobs); // depends on control dependency: [for], data = [none]
double cpu = jobUtil.getCpuPercentageOnCluster();
double mem = jobUtil.getMemPercentageOnCluster();
double cpuTime = jobUtil.getCpuCumulatedUsageTime();
double memTime = jobUtil.getMemCumulatedUsageTime();
cpu = cpu / clusterUtil.getCpuTotalGHz() * 100; // depends on control dependency: [for], data = [none]
mem = mem / clusterUtil.getMemTotalGB() * 100; // depends on control dependency: [for], data = [none]
cpuTime += cpu / 100 * aggregatePeriod; // in milliseconds // depends on control dependency: [for], data = [none]
memTime += mem / 100 * aggregatePeriod; // in milliseconds // depends on control dependency: [for], data = [none]
jobUtil.setCpuPercentageOnCluster(cpu); // depends on control dependency: [for], data = [none]
jobUtil.setMemPercentageOnCluster(mem); // depends on control dependency: [for], data = [none]
jobUtil.setCpuCumulatedUsageTime(cpuTime); // depends on control dependency: [for], data = [none]
jobUtil.setMemCumulatedUsageTime(memTime); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
private void initMetaMappings() {
if (m_metaMappings == null) {
m_metaMappings = new HashMap<String, MetaMapping>();
try {
initPage();
CmsMacroResolver resolver = new CmsMacroResolver();
resolver.setKeepEmptyMacros(true);
resolver.setCmsObject(m_cms);
resolver.setMessages(OpenCms.getWorkplaceManager().getMessages(getLocale()));
CmsResourceFilter filter = getIsEditMode()
? CmsResourceFilter.IGNORE_EXPIRATION
: CmsResourceFilter.DEFAULT;
for (CmsContainerBean container : m_page.getContainers().values()) {
for (CmsContainerElementBean element : container.getElements()) {
String settingsKey = CmsFormatterConfig.getSettingsKeyForContainer(container.getName());
String formatterConfigId = element.getSettings() != null
? element.getSettings().get(settingsKey)
: null;
I_CmsFormatterBean formatterBean = null;
if (CmsUUID.isValidUUID(formatterConfigId)) {
formatterBean = OpenCms.getADEManager().getCachedFormatters(
m_cms.getRequestContext().getCurrentProject().isOnlineProject()).getFormatters().get(
new CmsUUID(formatterConfigId));
}
if ((formatterBean != null)
&& formatterBean.useMetaMappingsForNormalElements()
&& m_cms.existsResource(element.getId(), filter)) {
addMappingsForFormatter(formatterBean, element.getId(), resolver, false);
}
}
}
if (getDetailContentId() != null) {
try {
CmsResource detailContent = m_cms.readResource(
getDetailContentId(),
CmsResourceFilter.ignoreExpirationOffline(m_cms));
CmsFormatterConfiguration config = OpenCms.getADEManager().lookupConfiguration(
m_cms,
m_cms.getRequestContext().getRootUri()).getFormatters(m_cms, detailContent);
for (I_CmsFormatterBean formatter : config.getDetailFormatters()) {
addMappingsForFormatter(formatter, getDetailContentId(), resolver, true);
}
} catch (CmsException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_READING_REQUIRED_RESOURCE_1,
getDetailContentId()),
e);
}
}
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
} }
|
public class class_name {
private void initMetaMappings() {
if (m_metaMappings == null) {
m_metaMappings = new HashMap<String, MetaMapping>(); // depends on control dependency: [if], data = [none]
try {
initPage(); // depends on control dependency: [try], data = [none]
CmsMacroResolver resolver = new CmsMacroResolver();
resolver.setKeepEmptyMacros(true); // depends on control dependency: [try], data = [none]
resolver.setCmsObject(m_cms); // depends on control dependency: [try], data = [none]
resolver.setMessages(OpenCms.getWorkplaceManager().getMessages(getLocale())); // depends on control dependency: [try], data = [none]
CmsResourceFilter filter = getIsEditMode()
? CmsResourceFilter.IGNORE_EXPIRATION
: CmsResourceFilter.DEFAULT;
for (CmsContainerBean container : m_page.getContainers().values()) {
for (CmsContainerElementBean element : container.getElements()) {
String settingsKey = CmsFormatterConfig.getSettingsKeyForContainer(container.getName());
String formatterConfigId = element.getSettings() != null
? element.getSettings().get(settingsKey)
: null;
I_CmsFormatterBean formatterBean = null;
if (CmsUUID.isValidUUID(formatterConfigId)) {
formatterBean = OpenCms.getADEManager().getCachedFormatters(
m_cms.getRequestContext().getCurrentProject().isOnlineProject()).getFormatters().get(
new CmsUUID(formatterConfigId)); // depends on control dependency: [if], data = [none]
}
if ((formatterBean != null)
&& formatterBean.useMetaMappingsForNormalElements()
&& m_cms.existsResource(element.getId(), filter)) {
addMappingsForFormatter(formatterBean, element.getId(), resolver, false); // depends on control dependency: [if], data = [none]
}
}
}
if (getDetailContentId() != null) {
try {
CmsResource detailContent = m_cms.readResource(
getDetailContentId(),
CmsResourceFilter.ignoreExpirationOffline(m_cms));
CmsFormatterConfiguration config = OpenCms.getADEManager().lookupConfiguration(
m_cms,
m_cms.getRequestContext().getRootUri()).getFormatters(m_cms, detailContent);
for (I_CmsFormatterBean formatter : config.getDetailFormatters()) {
addMappingsForFormatter(formatter, getDetailContentId(), resolver, true); // depends on control dependency: [for], data = [formatter]
}
} catch (CmsException e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_READING_REQUIRED_RESOURCE_1,
getDetailContentId()),
e);
} // depends on control dependency: [catch], data = [none]
}
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public Map<String, ClientStats> getStatsByProc() {
Map<Long, Map<String, ClientStats>> complete = getCompleteStats();
Map<String, ClientStats> retval = new TreeMap<String, ClientStats>();
for (Entry<Long, Map<String, ClientStats>> e : complete.entrySet()) {
for (Entry<String, ClientStats> e2 : e.getValue().entrySet()) {
ClientStats current = e2.getValue();
ClientStats aggregate = retval.get(current.getProcedureName());
if (aggregate == null) {
retval.put(current.getProcedureName(), (ClientStats) current.clone());
}
else {
aggregate.add(current);
}
}
}
return retval;
} }
|
public class class_name {
public Map<String, ClientStats> getStatsByProc() {
Map<Long, Map<String, ClientStats>> complete = getCompleteStats();
Map<String, ClientStats> retval = new TreeMap<String, ClientStats>();
for (Entry<Long, Map<String, ClientStats>> e : complete.entrySet()) {
for (Entry<String, ClientStats> e2 : e.getValue().entrySet()) {
ClientStats current = e2.getValue();
ClientStats aggregate = retval.get(current.getProcedureName());
if (aggregate == null) {
retval.put(current.getProcedureName(), (ClientStats) current.clone()); // depends on control dependency: [if], data = [none]
}
else {
aggregate.add(current); // depends on control dependency: [if], data = [none]
}
}
}
return retval;
} }
|
public class class_name {
public static int precedenceOf(Object o) {
if (o instanceof PrecedencedSelfDescribing) {
return ((PrecedencedSelfDescribing) o).getDescriptionPrecedence();
} else {
return PrecedencedSelfDescribing.P_ATOMIC;
}
} }
|
public class class_name {
public static int precedenceOf(Object o) {
if (o instanceof PrecedencedSelfDescribing) {
return ((PrecedencedSelfDescribing) o).getDescriptionPrecedence();
// depends on control dependency: [if], data = [none]
} else {
return PrecedencedSelfDescribing.P_ATOMIC;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static boolean intersectPlaneSweptSphere(
float a, float b, float c, float d,
float cX, float cY, float cZ, float radius,
float vX, float vY, float vZ,
Vector4f pointAndTime) {
// Compute distance of sphere center to plane
float dist = a * cX + b * cY + c * cZ - d;
if (Math.abs(dist) <= radius) {
// The sphere is already overlapping the plane. Set time of
// intersection to zero and q to sphere center
pointAndTime.set(cX, cY, cZ, 0.0f);
return true;
}
float denom = a * vX + b * vY + c * vZ;
if (denom * dist >= 0.0f) {
// No intersection as sphere moving parallel to or away from plane
return false;
}
// Sphere is moving towards the plane
// Use +r in computations if sphere in front of plane, else -r
float r = dist > 0.0f ? radius : -radius;
float t = (r - dist) / denom;
pointAndTime.set(
cX + t * vX - r * a,
cY + t * vY - r * b,
cZ + t * vZ - r * c,
t);
return true;
} }
|
public class class_name {
public static boolean intersectPlaneSweptSphere(
float a, float b, float c, float d,
float cX, float cY, float cZ, float radius,
float vX, float vY, float vZ,
Vector4f pointAndTime) {
// Compute distance of sphere center to plane
float dist = a * cX + b * cY + c * cZ - d;
if (Math.abs(dist) <= radius) {
// The sphere is already overlapping the plane. Set time of
// intersection to zero and q to sphere center
pointAndTime.set(cX, cY, cZ, 0.0f); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
float denom = a * vX + b * vY + c * vZ;
if (denom * dist >= 0.0f) {
// No intersection as sphere moving parallel to or away from plane
return false; // depends on control dependency: [if], data = [none]
}
// Sphere is moving towards the plane
// Use +r in computations if sphere in front of plane, else -r
float r = dist > 0.0f ? radius : -radius;
float t = (r - dist) / denom;
pointAndTime.set(
cX + t * vX - r * a,
cY + t * vY - r * b,
cZ + t * vZ - r * c,
t);
return true;
} }
|
public class class_name {
public void switchToParentFrame() {
if (!currentIFramePath.isEmpty()) {
// copy path since substring creates a view, not a deep copy
List<T> newPath = currentIFramePath.subList(0, currentIFramePath.size() - 1);
newPath = new ArrayList<T>(newPath);
// Safari and PhantomJs don't support switchTo.parentFrame, so we do this
// it works for Phantom, but is VERY slow there (other browsers are slow but ok)
switchToDefaultContent();
for (T iframe : newPath) {
switchToFrame(iframe);
}
}
} }
|
public class class_name {
public void switchToParentFrame() {
if (!currentIFramePath.isEmpty()) {
// copy path since substring creates a view, not a deep copy
List<T> newPath = currentIFramePath.subList(0, currentIFramePath.size() - 1);
newPath = new ArrayList<T>(newPath); // depends on control dependency: [if], data = [none]
// Safari and PhantomJs don't support switchTo.parentFrame, so we do this
// it works for Phantom, but is VERY slow there (other browsers are slow but ok)
switchToDefaultContent(); // depends on control dependency: [if], data = [none]
for (T iframe : newPath) {
switchToFrame(iframe); // depends on control dependency: [for], data = [iframe]
}
}
} }
|
public class class_name {
@Override
public int find(int x) {
int curr = x;
int currp = p[curr];
while (curr != currp) {
curr = currp;
currp = p[curr];
}
return curr;
// TODO: use path compression/halving/...?
} }
|
public class class_name {
@Override
public int find(int x) {
int curr = x;
int currp = p[curr];
while (curr != currp) {
curr = currp; // depends on control dependency: [while], data = [none]
currp = p[curr]; // depends on control dependency: [while], data = [none]
}
return curr;
// TODO: use path compression/halving/...?
} }
|
public class class_name {
static final void internalHll4Update(final AbstractHllArray host, final int slotNo, final int newValue) {
assert ((0 <= slotNo) && (slotNo < (1 << host.getLgConfigK())));
assert (newValue > 0);
final int curMin = host.getCurMin();
AuxHashMap auxHashMap = host.getAuxHashMap(); //may be null
final int rawStoredOldValue = host.getSlot(slotNo); //could be 0
//This is provably a LB:
final int lbOnOldValue = rawStoredOldValue + curMin; //lower bound, could be 0
if (newValue > lbOnOldValue) { //842:
//Note: if an AUX_TOKEN exists, then auxHashMap must already exist
final int actualOldValue = (rawStoredOldValue < AUX_TOKEN)
? lbOnOldValue
//846 rawStoredOldValue == AUX_TOKEN
: auxHashMap.mustFindValueFor(slotNo); //lgtm [java/dereferenced-value-may-be-null]
if (newValue > actualOldValue) { //848: actualOldValue could still be 0; newValue > 0
//We know that the array will be changed, but we haven't actually updated yet.
AbstractHllArray.hipAndKxQIncrementalUpdate(host, actualOldValue, newValue);
assert (newValue >= curMin)
: "New value " + newValue + " is less than current minimum " + curMin;
//newValue >= curMin
final int shiftedNewValue = newValue - curMin; //874
assert (shiftedNewValue >= 0);
if (rawStoredOldValue == AUX_TOKEN) { //879
//Given that we have an AUX_TOKEN, there are four cases for how to
// actually modify the data structure
if (shiftedNewValue >= AUX_TOKEN) { //CASE 1: //881
//the byte array already contains aux token
//This is the case where old and new values are both exceptions.
//Therefore, the 4-bit array already is AUX_TOKEN. Only need to update auxMap
auxHashMap.mustReplace(slotNo, newValue); //lgtm [java/dereferenced-value-may-be-null]
}
else { //CASE 2: //885
//This is the (hypothetical) case where old value is an exception and the new one is not.
// which is impossible given that curMin has not changed here and the newValue > oldValue.
throw new SketchesStateException("Impossible case");
}
}
else { //rawStoredOldValue != AUX_TOKEN
if (shiftedNewValue >= AUX_TOKEN) { //CASE 3: //892
//This is the case where the old value is not an exception and the new value is.
//Therefore the AUX_TOKEN must be stored in the 4-bit array and the new value
// added to the exception table.
host.putSlot(slotNo, AUX_TOKEN);
if (auxHashMap == null) {
auxHashMap = host.getNewAuxHashMap();
host.putAuxHashMap(auxHashMap, false);
}
auxHashMap.mustAdd(slotNo, newValue);
}
else { // CASE 4: //897
//This is the case where neither the old value nor the new value is an exception.
//Therefore we just overwrite the 4-bit array with the shifted new value.
host.putSlot(slotNo, shiftedNewValue);
}
}
// we just increased a pair value, so it might be time to change curMin
if (actualOldValue == curMin) { //908
assert (host.getNumAtCurMin() >= 1);
host.decNumAtCurMin();
while (host.getNumAtCurMin() == 0) {
shiftToBiggerCurMin(host); //increases curMin by 1, and builds a new aux table,
//shifts values in 4-bit table, and recounts curMin
}
}
} //end newValue <= actualOldValue
} //end newValue <= lbOnOldValue -> return, no need to update array
} }
|
public class class_name {
static final void internalHll4Update(final AbstractHllArray host, final int slotNo, final int newValue) {
assert ((0 <= slotNo) && (slotNo < (1 << host.getLgConfigK())));
assert (newValue > 0);
final int curMin = host.getCurMin();
AuxHashMap auxHashMap = host.getAuxHashMap(); //may be null
final int rawStoredOldValue = host.getSlot(slotNo); //could be 0
//This is provably a LB:
final int lbOnOldValue = rawStoredOldValue + curMin; //lower bound, could be 0
if (newValue > lbOnOldValue) { //842:
//Note: if an AUX_TOKEN exists, then auxHashMap must already exist
final int actualOldValue = (rawStoredOldValue < AUX_TOKEN)
? lbOnOldValue
//846 rawStoredOldValue == AUX_TOKEN
: auxHashMap.mustFindValueFor(slotNo); //lgtm [java/dereferenced-value-may-be-null]
if (newValue > actualOldValue) { //848: actualOldValue could still be 0; newValue > 0
//We know that the array will be changed, but we haven't actually updated yet.
AbstractHllArray.hipAndKxQIncrementalUpdate(host, actualOldValue, newValue); // depends on control dependency: [if], data = [none]
assert (newValue >= curMin)
: "New value " + newValue + " is less than current minimum " + curMin; // depends on control dependency: [if], data = [none]
//newValue >= curMin
final int shiftedNewValue = newValue - curMin; //874
assert (shiftedNewValue >= 0); // depends on control dependency: [if], data = [none]
if (rawStoredOldValue == AUX_TOKEN) { //879
//Given that we have an AUX_TOKEN, there are four cases for how to
// actually modify the data structure
if (shiftedNewValue >= AUX_TOKEN) { //CASE 1: //881
//the byte array already contains aux token
//This is the case where old and new values are both exceptions.
//Therefore, the 4-bit array already is AUX_TOKEN. Only need to update auxMap
auxHashMap.mustReplace(slotNo, newValue); //lgtm [java/dereferenced-value-may-be-null] // depends on control dependency: [if], data = [none]
}
else { //CASE 2: //885
//This is the (hypothetical) case where old value is an exception and the new one is not.
// which is impossible given that curMin has not changed here and the newValue > oldValue.
throw new SketchesStateException("Impossible case");
}
}
else { //rawStoredOldValue != AUX_TOKEN
if (shiftedNewValue >= AUX_TOKEN) { //CASE 3: //892
//This is the case where the old value is not an exception and the new value is.
//Therefore the AUX_TOKEN must be stored in the 4-bit array and the new value
// added to the exception table.
host.putSlot(slotNo, AUX_TOKEN); // depends on control dependency: [if], data = [none]
if (auxHashMap == null) {
auxHashMap = host.getNewAuxHashMap(); // depends on control dependency: [if], data = [none]
host.putAuxHashMap(auxHashMap, false); // depends on control dependency: [if], data = [(auxHashMap]
}
auxHashMap.mustAdd(slotNo, newValue); // depends on control dependency: [if], data = [none]
}
else { // CASE 4: //897
//This is the case where neither the old value nor the new value is an exception.
//Therefore we just overwrite the 4-bit array with the shifted new value.
host.putSlot(slotNo, shiftedNewValue); // depends on control dependency: [if], data = [none]
}
}
// we just increased a pair value, so it might be time to change curMin
if (actualOldValue == curMin) { //908
assert (host.getNumAtCurMin() >= 1); // depends on control dependency: [if], data = [none]
host.decNumAtCurMin(); // depends on control dependency: [if], data = [none]
while (host.getNumAtCurMin() == 0) {
shiftToBiggerCurMin(host); //increases curMin by 1, and builds a new aux table, // depends on control dependency: [while], data = [none]
//shifts values in 4-bit table, and recounts curMin
}
}
} //end newValue <= actualOldValue
} //end newValue <= lbOnOldValue -> return, no need to update array
} }
|
public class class_name {
public List<CorrelationIdentifier> findCorrelationIds(Scope... scope) {
List<CorrelationIdentifier> ret = null;
for (int i=0; i < correlationIds.size(); i++) {
CorrelationIdentifier cid = correlationIds.get(i);
for (int j=0; j < scope.length; j++) {
if (cid.getScope() == scope[j]) {
if (ret == null) {
ret = new ArrayList<CorrelationIdentifier>();
}
if (!ret.contains(cid)) {
ret.add(cid);
}
}
}
}
return ret == null ? Collections.emptyList() : ret;
} }
|
public class class_name {
public List<CorrelationIdentifier> findCorrelationIds(Scope... scope) {
List<CorrelationIdentifier> ret = null;
for (int i=0; i < correlationIds.size(); i++) {
CorrelationIdentifier cid = correlationIds.get(i);
for (int j=0; j < scope.length; j++) {
if (cid.getScope() == scope[j]) {
if (ret == null) {
ret = new ArrayList<CorrelationIdentifier>(); // depends on control dependency: [if], data = [none]
}
if (!ret.contains(cid)) {
ret.add(cid); // depends on control dependency: [if], data = [none]
}
}
}
}
return ret == null ? Collections.emptyList() : ret;
} }
|
public class class_name {
@Override
protected UserProfile extractUserProfile(final String body) {
GlobusProfile profile = new GlobusProfile();
JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
String username = JsonHelper.get(json, GlobusAttributesDefinition.USERNAME).toString();
if (LEGACY_USERNAMES) {
username = username.split("@")[0];
}
profile.setId(username);
profile.addAttribute(EurekaAttributesDefinition.USERNAME, username);
profile.addAttribute(EurekaAttributesDefinition.FULLNAME, JsonHelper.get(json, GlobusAttributesDefinition.FULLNAME));
profile.addAttribute(EurekaAttributesDefinition.EMAIL, JsonHelper.get(json, GlobusAttributesDefinition.EMAIL));
}
return profile;
} }
|
public class class_name {
@Override
protected UserProfile extractUserProfile(final String body) {
GlobusProfile profile = new GlobusProfile();
JsonNode json = JsonHelper.getFirstNode(body);
if (json != null) {
String username = JsonHelper.get(json, GlobusAttributesDefinition.USERNAME).toString();
if (LEGACY_USERNAMES) {
username = username.split("@")[0]; // depends on control dependency: [if], data = [none]
}
profile.setId(username); // depends on control dependency: [if], data = [none]
profile.addAttribute(EurekaAttributesDefinition.USERNAME, username); // depends on control dependency: [if], data = [none]
profile.addAttribute(EurekaAttributesDefinition.FULLNAME, JsonHelper.get(json, GlobusAttributesDefinition.FULLNAME)); // depends on control dependency: [if], data = [(json]
profile.addAttribute(EurekaAttributesDefinition.EMAIL, JsonHelper.get(json, GlobusAttributesDefinition.EMAIL)); // depends on control dependency: [if], data = [(json]
}
return profile;
} }
|
public class class_name {
@Override
protected int state1(Channel ctx) {
ctx.log("receiving response");
final BufRanges head = ctx.helper().ranges1.reset();
final BufRanges body = ctx.helper().ranges2.reset();
Buf in = ctx.input();
in.scanLnLn(head);
Map<String, String> headers = head.toMap(in.bytes(), 1, head.count - 1, "\\s*\\:\\s*");
Map<String, String> headersLow = Msc.lowercase(headers);
if ("chunked".equals(headersLow.get("transfer-encoding"))) {
ctx.log("got chunked encoding");
parseChunkedBody(in, body);
callback.onResult(in, head, body);
} else if (headersLow.containsKey("content-length")) {
ctx.log("got content length");
int clength = Integer.parseInt(headersLow.get("content-length"));
parseBodyByContentLength(in, body, clength);
callback.onResult(in, head, body);
} else {
// no content length is provided, read until connection is closed
ctx.log("read until closed");
readBodyUntilClosed(ctx, body);
callback.onResult(in, head, body);
}
ctx.log("done");
ctx.close(); // improve: keep-alive
return STOP;
} }
|
public class class_name {
@Override
protected int state1(Channel ctx) {
ctx.log("receiving response");
final BufRanges head = ctx.helper().ranges1.reset();
final BufRanges body = ctx.helper().ranges2.reset();
Buf in = ctx.input();
in.scanLnLn(head);
Map<String, String> headers = head.toMap(in.bytes(), 1, head.count - 1, "\\s*\\:\\s*");
Map<String, String> headersLow = Msc.lowercase(headers);
if ("chunked".equals(headersLow.get("transfer-encoding"))) {
ctx.log("got chunked encoding"); // depends on control dependency: [if], data = [none]
parseChunkedBody(in, body); // depends on control dependency: [if], data = [none]
callback.onResult(in, head, body); // depends on control dependency: [if], data = [none]
} else if (headersLow.containsKey("content-length")) {
ctx.log("got content length"); // depends on control dependency: [if], data = [none]
int clength = Integer.parseInt(headersLow.get("content-length"));
parseBodyByContentLength(in, body, clength); // depends on control dependency: [if], data = [none]
callback.onResult(in, head, body); // depends on control dependency: [if], data = [none]
} else {
// no content length is provided, read until connection is closed
ctx.log("read until closed"); // depends on control dependency: [if], data = [none]
readBodyUntilClosed(ctx, body); // depends on control dependency: [if], data = [none]
callback.onResult(in, head, body); // depends on control dependency: [if], data = [none]
}
ctx.log("done");
ctx.close(); // improve: keep-alive
return STOP;
} }
|
public class class_name {
private void copyDocFiles() {
PackageDoc containingPackage = annotationTypeDoc.containingPackage();
if((configuration.packages == null ||
Arrays.binarySearch(configuration.packages,
containingPackage) < 0) &&
! containingPackagesSeen.contains(containingPackage.name())){
//Only copy doc files dir if the containing package is not
//documented AND if we have not documented a class from the same
//package already. Otherwise, we are making duplicate copies.
Util.copyDocFiles(configuration, containingPackage);
containingPackagesSeen.add(containingPackage.name());
}
} }
|
public class class_name {
private void copyDocFiles() {
PackageDoc containingPackage = annotationTypeDoc.containingPackage();
if((configuration.packages == null ||
Arrays.binarySearch(configuration.packages,
containingPackage) < 0) &&
! containingPackagesSeen.contains(containingPackage.name())){
//Only copy doc files dir if the containing package is not
//documented AND if we have not documented a class from the same
//package already. Otherwise, we are making duplicate copies.
Util.copyDocFiles(configuration, containingPackage); // depends on control dependency: [if], data = [none]
containingPackagesSeen.add(containingPackage.name()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public final boolean changeUserPasswd(final String pUserName,
final String pPassw, final String pPasswOld) throws Exception {
String query = "select USERTOMCAT.ITSUSER from USERTOMCAT where ITSUSER='"
+ pUserName + "' and ITSPASSWORD='" + pPasswOld + "';";
IRecordSet<RS> recordSet = null;
try {
this.srvDatabase.setIsAutocommit(false);
this.srvDatabase.
setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
this.srvDatabase.beginTransaction();
recordSet = getSrvDatabase().retrieveRecords(query);
if (!recordSet.moveToFirst()) {
return false;
}
String changeUserP =
"update USERTOMCAT set ITSPASSWORD='" + pPassw + "' where ITSUSER='"
+ pUserName + "';";
this.srvDatabase.executeQuery(changeUserP);
this.srvDatabase.commitTransaction();
return true;
} catch (Exception ex) {
this.srvDatabase.rollBackTransaction();
throw ex;
} finally {
this.srvDatabase.releaseResources();
if (recordSet != null) {
recordSet.close();
}
}
} }
|
public class class_name {
@Override
public final boolean changeUserPasswd(final String pUserName,
final String pPassw, final String pPasswOld) throws Exception {
String query = "select USERTOMCAT.ITSUSER from USERTOMCAT where ITSUSER='"
+ pUserName + "' and ITSPASSWORD='" + pPasswOld + "';";
IRecordSet<RS> recordSet = null;
try {
this.srvDatabase.setIsAutocommit(false);
this.srvDatabase.
setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
this.srvDatabase.beginTransaction();
recordSet = getSrvDatabase().retrieveRecords(query);
if (!recordSet.moveToFirst()) {
return false; // depends on control dependency: [if], data = [none]
}
String changeUserP =
"update USERTOMCAT set ITSPASSWORD='" + pPassw + "' where ITSUSER='"
+ pUserName + "';";
this.srvDatabase.executeQuery(changeUserP);
this.srvDatabase.commitTransaction();
return true;
} catch (Exception ex) {
this.srvDatabase.rollBackTransaction();
throw ex;
} finally {
this.srvDatabase.releaseResources();
if (recordSet != null) {
recordSet.close(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected final List<Proposition> createResults(
List<Proposition> propositions) {
List<Proposition> result;
if (propositions != null) {
if (this.constraints.length > 0) {
result = new ArrayList<>();
for (Proposition prop : propositions) {
applyPropertyConstraints(prop, result);
}
} else {
result = propositions;
}
result = applyComparatorAndIndices(result);
} else {
result = Collections.emptyList();
}
return result;
} }
|
public class class_name {
protected final List<Proposition> createResults(
List<Proposition> propositions) {
List<Proposition> result;
if (propositions != null) {
if (this.constraints.length > 0) {
result = new ArrayList<>(); // depends on control dependency: [if], data = [none]
for (Proposition prop : propositions) {
applyPropertyConstraints(prop, result); // depends on control dependency: [for], data = [prop]
}
} else {
result = propositions; // depends on control dependency: [if], data = [none]
}
result = applyComparatorAndIndices(result); // depends on control dependency: [if], data = [none]
} else {
result = Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public StackTraceElement[] asStackTrace() {
int i = 1;
StackTraceElement[] list = new StackTraceElement[this.size()];
for (Eventable e : this) {
list[this.size() - i] =
new StackTraceElement(e.getEventType().toString(), e.getIdentification()
.toString(), e.getElement().toString(), i);
i++;
}
return list;
} }
|
public class class_name {
public StackTraceElement[] asStackTrace() {
int i = 1;
StackTraceElement[] list = new StackTraceElement[this.size()];
for (Eventable e : this) {
list[this.size() - i] =
new StackTraceElement(e.getEventType().toString(), e.getIdentification()
.toString(), e.getElement().toString(), i); // depends on control dependency: [for], data = [e]
i++; // depends on control dependency: [for], data = [none]
}
return list;
} }
|
public class class_name {
public static <T> HashSet<T> dfs(T root, Set<T> visited, Deps<T> deps) {
// The set of leaves (excluding any which were already marked as visited).
HashSet<T> leaves = new HashSet<T>();
// The stack for DFS.
Stack<T> stack = new Stack<T>();
stack.push(root);
while (stack.size() > 0) {
T p = stack.pop();
if (visited.add(p)) {
// Unseen.
if (deps.getDeps(p).size() == 0) {
// Is leaf.
leaves.add(p);
} else {
// Not a leaf.
stack.addAll(deps.getDeps(p));
}
} else {
// Seen.
continue;
}
}
return leaves;
} }
|
public class class_name {
public static <T> HashSet<T> dfs(T root, Set<T> visited, Deps<T> deps) {
// The set of leaves (excluding any which were already marked as visited).
HashSet<T> leaves = new HashSet<T>();
// The stack for DFS.
Stack<T> stack = new Stack<T>();
stack.push(root);
while (stack.size() > 0) {
T p = stack.pop();
if (visited.add(p)) {
// Unseen.
if (deps.getDeps(p).size() == 0) {
// Is leaf.
leaves.add(p); // depends on control dependency: [if], data = [none]
} else {
// Not a leaf.
stack.addAll(deps.getDeps(p)); // depends on control dependency: [if], data = [none]
}
} else {
// Seen.
continue;
}
}
return leaves;
} }
|
public class class_name {
public static URI setPath(final URI orig, final String path) {
try {
return new URI(orig.getScheme(), orig.getUserInfo(), orig.getHost(), orig.getPort(), path, orig.getQuery(), orig.getFragment());
} catch (final URISyntaxException e) {
throw new RuntimeException(e.getMessage(), e);
}
} }
|
public class class_name {
public static URI setPath(final URI orig, final String path) {
try {
return new URI(orig.getScheme(), orig.getUserInfo(), orig.getHost(), orig.getPort(), path, orig.getQuery(), orig.getFragment()); // depends on control dependency: [try], data = [none]
} catch (final URISyntaxException e) {
throw new RuntimeException(e.getMessage(), e);
} // 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.