code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public Object getAndRemove(String... keys) {
Object value = null;
for (String key : keys) {
value = remove(key);
if (null != value) {
break;
}
}
return value;
} }
|
public class class_name {
public Object getAndRemove(String... keys) {
Object value = null;
for (String key : keys) {
value = remove(key);
// depends on control dependency: [for], data = [key]
if (null != value) {
break;
}
}
return value;
} }
|
public class class_name {
private void trackingStopMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_trackingStopMenuItemActionPerformed
if (trackingWorker != null) {
trackingWorker.cancel();
} else {
assert(false);
}
} }
|
public class class_name {
private void trackingStopMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_trackingStopMenuItemActionPerformed
if (trackingWorker != null) {
trackingWorker.cancel(); // depends on control dependency: [if], data = [none]
} else {
assert(false); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
String prevLink() {
if (currentOffset == 0 || currentLimit == 0) {
return null;
}
return urlWithUpdatedPagination(Math.max(0, currentOffset - currentLimit), currentLimit);
} }
|
public class class_name {
String prevLink() {
if (currentOffset == 0 || currentLimit == 0) {
return null; // depends on control dependency: [if], data = [none]
}
return urlWithUpdatedPagination(Math.max(0, currentOffset - currentLimit), currentLimit);
} }
|
public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
private static Set<Class<? extends Enum<?>>> listupEnumClasses(final String packageName) {
String resourceName = packageName.replace('.', '/');
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
List<URL> roots;
try {
roots = Collections.list(classLoader.getResources(resourceName));
} catch (IOException e) {
LOG.error(e.getMessage(), e);
return Collections.emptySet();
}
Set<Class<?>> classes = new HashSet<>();
for (URL root : roots) {
if ("file".equalsIgnoreCase(root.getProtocol())) {
try {
classes.addAll(findEnumClassesWithFile(packageName, Paths.get(root.toURI())));
} catch (URISyntaxException e) {
LOG.error(e.getMessage(), e);
}
}
if ("jar".equalsIgnoreCase(root.getProtocol())) {
try (JarFile jarFile = ((JarURLConnection) root.openConnection()).getJarFile()) {
classes.addAll(findEnumClassesWithJar(packageName, jarFile));
} catch (IOException e) {
LOG.error(e.getMessage(), e);
}
}
}
return (Set) classes;
} }
|
public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
private static Set<Class<? extends Enum<?>>> listupEnumClasses(final String packageName) {
String resourceName = packageName.replace('.', '/');
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
List<URL> roots;
try {
roots = Collections.list(classLoader.getResources(resourceName)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOG.error(e.getMessage(), e);
return Collections.emptySet();
} // depends on control dependency: [catch], data = [none]
Set<Class<?>> classes = new HashSet<>();
for (URL root : roots) {
if ("file".equalsIgnoreCase(root.getProtocol())) {
try {
classes.addAll(findEnumClassesWithFile(packageName, Paths.get(root.toURI()))); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
LOG.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
if ("jar".equalsIgnoreCase(root.getProtocol())) {
try (JarFile jarFile = ((JarURLConnection) root.openConnection()).getJarFile()) {
classes.addAll(findEnumClassesWithJar(packageName, jarFile));
} catch (IOException e) { // depends on control dependency: [for], data = [none]
LOG.error(e.getMessage(), e);
}
}
}
return (Set) classes;
} }
|
public class class_name {
protected Object available() throws ClassNotFoundException {
Object result = null;
if (getVar() != null) {
Object value = pageContext.getAttribute(getVar(), getVarScope());
if (value instanceof SlingBean) {
Class<?> type = getComponentType();
if (type != null && type.isAssignableFrom(value.getClass())) {
result = value;
}
}
}
return result;
} }
|
public class class_name {
protected Object available() throws ClassNotFoundException {
Object result = null;
if (getVar() != null) {
Object value = pageContext.getAttribute(getVar(), getVarScope());
if (value instanceof SlingBean) {
Class<?> type = getComponentType();
if (type != null && type.isAssignableFrom(value.getClass())) {
result = value;
// depends on control dependency: [if], data = [none]
}
}
}
return result;
} }
|
public class class_name {
@Override
public void loadFromProperties(Properties props) {
String strValue = props.getProperty(container.getSimpleName() + "." + name);
if (strValue == null)
return;
try {
float value = Float.parseFloat(strValue);
set(value);
} catch (NumberFormatException nfe) {
}
} }
|
public class class_name {
@Override
public void loadFromProperties(Properties props) {
String strValue = props.getProperty(container.getSimpleName() + "." + name);
if (strValue == null)
return;
try {
float value = Float.parseFloat(strValue);
set(value); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Map<String, List<String>> getHeaders() {
if (headers == null) {
return null;
}
return headers.toMultimap();
} }
|
public class class_name {
public Map<String, List<String>> getHeaders() {
if (headers == null) {
return null; // depends on control dependency: [if], data = [none]
}
return headers.toMultimap();
} }
|
public class class_name {
public Factor getFactorByName(String name) {
int index = getFactorIndexByName(name);
if (index == -1) {
return null;
}
return factors[index];
} }
|
public class class_name {
public Factor getFactorByName(String name) {
int index = getFactorIndexByName(name);
if (index == -1) {
return null; // depends on control dependency: [if], data = [none]
}
return factors[index];
} }
|
public class class_name {
public static String removeNullPadding(String str) {
int idx = str.indexOf(0);
if (idx == -1) {
return str;
}
return str.substring(0, idx);
} }
|
public class class_name {
public static String removeNullPadding(String str) {
int idx = str.indexOf(0);
if (idx == -1) {
return str; // depends on control dependency: [if], data = [none]
}
return str.substring(0, idx);
} }
|
public class class_name {
@Override
public void run() {
if (!context.getTopologyMetricContexts().containsKey(topologyId)) {
LOG.warn("topology {} has been killed or has not started, skip update.", topologyId);
return;
}
// double check and reset stream metrics if disabled
if (!JStormMetrics.enableStreamMetrics) {
topologyMetrics.set_streamMetric(new MetricInfo());
}
if (!JStormMetrics.CLUSTER_METRIC_KEY.equals(topologyId)) {
updateClusterMetrics(topologyId, topologyMetrics);
}
// overwrite nimbus-local metrics data
context.getMetricCache().putMetricData(topologyId, topologyMetrics);
// below process is kind of a transaction, first we lock an empty slot, mark it as PRE_SET
// by this time the slot is not yet ready for uploading as the upload thread looks for SET slots only
// after all metrics data has been saved, we mark it as SET, then it's ready for uploading.
int idx = context.getAndPresetFirstEmptyIndex();
if (idx < 0) {
LOG.error("Exceeding maxPendingUploadMetrics(too much metrics in local rocksdb), " +
"skip caching metrics data for topology:{}", topologyId);
return;
}
try {
TopologyMetricDataInfo summary = new TopologyMetricDataInfo();
int total = 0;
summary.topologyId = topologyId;
summary.timestamp = timestamp;
if (topologyId.equals(JStormMetrics.NIMBUS_METRIC_KEY) || topologyId.equals(JStormMetrics.CLUSTER_METRIC_KEY)) {
summary.type = MetricUploader.METRIC_TYPE_TOPLOGY;
} else {
total += topologyMetrics.get_topologyMetric().get_metrics_size()
+ topologyMetrics.get_componentMetric().get_metrics_size();
int compStream = 0;
if (topologyMetrics.is_set_compStreamMetric()) {
compStream = topologyMetrics.get_compStreamMetric().get_metrics_size();
total += compStream;
}
if (total > 0) {
int sub = topologyMetrics.get_taskMetric().get_metrics_size()
+ topologyMetrics.get_workerMetric().get_metrics_size()
+ topologyMetrics.get_nettyMetric().get_metrics_size()
+ topologyMetrics.get_streamMetric().get_metrics_size();
if (sub > 0) {
total += sub;
summary.type = MetricUploader.METRIC_TYPE_ALL;
} else {
summary.type = MetricUploader.METRIC_TYPE_TOPLOGY;
}
LOG.debug("tp:{}, comp:{}, comp_stream:{}, task:{}, worker:{}, netty:{}, stream:{}",
topologyMetrics.get_topologyMetric().get_metrics_size(),
topologyMetrics.get_componentMetric().get_metrics_size(),
compStream,
topologyMetrics.get_taskMetric().get_metrics_size(),
topologyMetrics.get_workerMetric().get_metrics_size(),
topologyMetrics.get_nettyMetric().get_metrics_size(),
topologyMetrics.get_streamMetric().get_metrics_size());
} else {
summary.type = MetricUploader.METRIC_TYPE_TASK;
total += topologyMetrics.get_taskMetric().get_metrics_size();
}
}
context.getMetricCache().put(ClusterMetricsContext.PENDING_UPLOAD_METRIC_DATA_INFO + idx, summary);
context.getMetricCache().put(ClusterMetricsContext.PENDING_UPLOAD_METRIC_DATA + idx, topologyMetrics);
context.markSet(idx);
LOG.debug("Put metric data to local cache, topology:{}, idx:{}, total:{}", topologyId, idx, total);
} catch (Exception ex) {
LOG.error("Error", ex);
context.forceMarkUploaded(idx);
}
} }
|
public class class_name {
@Override
public void run() {
if (!context.getTopologyMetricContexts().containsKey(topologyId)) {
LOG.warn("topology {} has been killed or has not started, skip update.", topologyId); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// double check and reset stream metrics if disabled
if (!JStormMetrics.enableStreamMetrics) {
topologyMetrics.set_streamMetric(new MetricInfo()); // depends on control dependency: [if], data = [none]
}
if (!JStormMetrics.CLUSTER_METRIC_KEY.equals(topologyId)) {
updateClusterMetrics(topologyId, topologyMetrics); // depends on control dependency: [if], data = [none]
}
// overwrite nimbus-local metrics data
context.getMetricCache().putMetricData(topologyId, topologyMetrics);
// below process is kind of a transaction, first we lock an empty slot, mark it as PRE_SET
// by this time the slot is not yet ready for uploading as the upload thread looks for SET slots only
// after all metrics data has been saved, we mark it as SET, then it's ready for uploading.
int idx = context.getAndPresetFirstEmptyIndex();
if (idx < 0) {
LOG.error("Exceeding maxPendingUploadMetrics(too much metrics in local rocksdb), " +
"skip caching metrics data for topology:{}", topologyId); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try {
TopologyMetricDataInfo summary = new TopologyMetricDataInfo();
int total = 0;
summary.topologyId = topologyId; // depends on control dependency: [try], data = [none]
summary.timestamp = timestamp; // depends on control dependency: [try], data = [none]
if (topologyId.equals(JStormMetrics.NIMBUS_METRIC_KEY) || topologyId.equals(JStormMetrics.CLUSTER_METRIC_KEY)) {
summary.type = MetricUploader.METRIC_TYPE_TOPLOGY; // depends on control dependency: [if], data = [none]
} else {
total += topologyMetrics.get_topologyMetric().get_metrics_size()
+ topologyMetrics.get_componentMetric().get_metrics_size(); // depends on control dependency: [if], data = [none]
int compStream = 0;
if (topologyMetrics.is_set_compStreamMetric()) {
compStream = topologyMetrics.get_compStreamMetric().get_metrics_size(); // depends on control dependency: [if], data = [none]
total += compStream; // depends on control dependency: [if], data = [none]
}
if (total > 0) {
int sub = topologyMetrics.get_taskMetric().get_metrics_size()
+ topologyMetrics.get_workerMetric().get_metrics_size()
+ topologyMetrics.get_nettyMetric().get_metrics_size()
+ topologyMetrics.get_streamMetric().get_metrics_size();
if (sub > 0) {
total += sub; // depends on control dependency: [if], data = [none]
summary.type = MetricUploader.METRIC_TYPE_ALL; // depends on control dependency: [if], data = [none]
} else {
summary.type = MetricUploader.METRIC_TYPE_TOPLOGY; // depends on control dependency: [if], data = [none]
}
LOG.debug("tp:{}, comp:{}, comp_stream:{}, task:{}, worker:{}, netty:{}, stream:{}",
topologyMetrics.get_topologyMetric().get_metrics_size(),
topologyMetrics.get_componentMetric().get_metrics_size(),
compStream,
topologyMetrics.get_taskMetric().get_metrics_size(),
topologyMetrics.get_workerMetric().get_metrics_size(),
topologyMetrics.get_nettyMetric().get_metrics_size(),
topologyMetrics.get_streamMetric().get_metrics_size()); // depends on control dependency: [if], data = [none]
} else {
summary.type = MetricUploader.METRIC_TYPE_TASK; // depends on control dependency: [if], data = [none]
total += topologyMetrics.get_taskMetric().get_metrics_size(); // depends on control dependency: [if], data = [none]
}
}
context.getMetricCache().put(ClusterMetricsContext.PENDING_UPLOAD_METRIC_DATA_INFO + idx, summary); // depends on control dependency: [try], data = [none]
context.getMetricCache().put(ClusterMetricsContext.PENDING_UPLOAD_METRIC_DATA + idx, topologyMetrics); // depends on control dependency: [try], data = [none]
context.markSet(idx); // depends on control dependency: [try], data = [none]
LOG.debug("Put metric data to local cache, topology:{}, idx:{}, total:{}", topologyId, idx, total); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
LOG.error("Error", ex);
context.forceMarkUploaded(idx);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public IElementType advance() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
CharSequence zzBufferL = zzBuffer;
char[] zzBufferArrayL = zzBufferArray;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++));
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++));
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 5:
{ return SchemadocTypes.DOC_COMMENT_CONTENT;
}
case 9: break;
case 3:
{ return TokenType.WHITE_SPACE;
}
case 10: break;
case 2:
{ yybegin(COMMENT_DATA); return SchemadocTypes.DOC_COMMENT_CONTENT;
}
case 11: break;
case 1:
{ return TokenType.BAD_CHARACTER;
}
case 12: break;
case 4:
{ yybegin(COMMENT_DATA_LINE_START); return TokenType.WHITE_SPACE;
}
case 13: break;
case 8:
{ yybegin(COMMENT_DATA_START); return SchemadocTypes.DOC_COMMENT_START;
}
case 14: break;
case 6:
{ yybegin(COMMENT_DATA); return SchemadocTypes.DOC_COMMENT_LEADING_ASTRISK;
}
case 15: break;
case 7:
{ return SchemadocTypes.DOC_COMMENT_END;
}
case 16: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
return null;
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
} }
|
public class class_name {
public IElementType advance() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
CharSequence zzBufferL = zzBuffer;
char[] zzBufferArrayL = zzBufferArray;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++));
else if (zzAtEOF) {
zzInput = YYEOF; // depends on control dependency: [if], data = [none]
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL; // depends on control dependency: [if], data = [none]
zzMarkedPos = zzMarkedPosL; // depends on control dependency: [if], data = [none]
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos; // depends on control dependency: [if], data = [none]
zzMarkedPosL = zzMarkedPos; // depends on control dependency: [if], data = [none]
zzBufferL = zzBuffer; // depends on control dependency: [if], data = [none]
zzEndReadL = zzEndRead; // depends on control dependency: [if], data = [none]
if (eof) {
zzInput = YYEOF; // depends on control dependency: [if], data = [none]
break zzForAction;
}
else {
zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++)); // depends on control dependency: [if], data = [none]
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext; // depends on control dependency: [while], data = [none]
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState; // depends on control dependency: [if], data = [none]
zzMarkedPosL = zzCurrentPosL; // depends on control dependency: [if], data = [none]
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 5:
{ return SchemadocTypes.DOC_COMMENT_CONTENT;
}
case 9: break;
case 3:
{ return TokenType.WHITE_SPACE;
}
case 10: break;
case 2:
{ yybegin(COMMENT_DATA); return SchemadocTypes.DOC_COMMENT_CONTENT;
}
case 11: break;
case 1:
{ return TokenType.BAD_CHARACTER;
}
case 12: break;
case 4:
{ yybegin(COMMENT_DATA_LINE_START); return TokenType.WHITE_SPACE;
}
case 13: break;
case 8:
{ yybegin(COMMENT_DATA_START); return SchemadocTypes.DOC_COMMENT_START;
}
case 14: break;
case 6:
{ yybegin(COMMENT_DATA); return SchemadocTypes.DOC_COMMENT_LEADING_ASTRISK;
}
case 15: break;
case 7:
{ return SchemadocTypes.DOC_COMMENT_END;
}
case 16: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true; // depends on control dependency: [if], data = [none]
zzDoEOF(); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
else {
zzScanError(ZZ_NO_MATCH); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public Config getConfig(Class<?> testClass, Method method, Config globalConfig) {
Config config = Config.Builder.defaults().build();
config = override(config, globalConfig);
for (String packageName : reverse(packageHierarchyOf(testClass))) {
Config packageConfig = cachedPackageConfig(packageName);
config = override(config, packageConfig);
}
for (Class clazz : reverse(parentClassesFor(testClass))) {
Config classConfig = (Config) clazz.getAnnotation(Config.class);
config = override(config, classConfig);
}
Config methodConfig = method.getAnnotation(Config.class);
config = override(config, methodConfig);
return config;
} }
|
public class class_name {
public Config getConfig(Class<?> testClass, Method method, Config globalConfig) {
Config config = Config.Builder.defaults().build();
config = override(config, globalConfig);
for (String packageName : reverse(packageHierarchyOf(testClass))) {
Config packageConfig = cachedPackageConfig(packageName);
config = override(config, packageConfig); // depends on control dependency: [for], data = [none]
}
for (Class clazz : reverse(parentClassesFor(testClass))) {
Config classConfig = (Config) clazz.getAnnotation(Config.class);
config = override(config, classConfig); // depends on control dependency: [for], data = [none]
}
Config methodConfig = method.getAnnotation(Config.class);
config = override(config, methodConfig);
return config;
} }
|
public class class_name {
public <T, I> T getObject(Keyspace keyspace, String colFamName, I pkObj) {
if (null == pkObj) {
throw new IllegalArgumentException("object ID cannot be null or empty");
}
CFMappingDef<T> cfMapDef = cacheMgr.getCfMapDef(colFamName, true);
byte[] colFamKey = generateColumnFamilyKeyFromPkObj(cfMapDef, pkObj);
SliceQuery<byte[], String, byte[]> q = HFactory.createSliceQuery(keyspace,
BytesArraySerializer.get(), StringSerializer.get(), BytesArraySerializer.get());
q.setColumnFamily(colFamName);
q.setKey(colFamKey);
// if no anonymous handler then use specific columns
if (cfMapDef.isColumnSliceRequired()) {
q.setColumnNames(cfMapDef.getSliceColumnNameArr());
} else {
q.setRange("", "", false, maxNumColumns);
}
QueryResult<ColumnSlice<String, byte[]>> result = q.execute();
if (null == result || null == result.get()) {
return null;
}
T obj = createObject(cfMapDef, pkObj, result.get());
return obj;
} }
|
public class class_name {
public <T, I> T getObject(Keyspace keyspace, String colFamName, I pkObj) {
if (null == pkObj) {
throw new IllegalArgumentException("object ID cannot be null or empty");
}
CFMappingDef<T> cfMapDef = cacheMgr.getCfMapDef(colFamName, true);
byte[] colFamKey = generateColumnFamilyKeyFromPkObj(cfMapDef, pkObj);
SliceQuery<byte[], String, byte[]> q = HFactory.createSliceQuery(keyspace,
BytesArraySerializer.get(), StringSerializer.get(), BytesArraySerializer.get());
q.setColumnFamily(colFamName);
q.setKey(colFamKey);
// if no anonymous handler then use specific columns
if (cfMapDef.isColumnSliceRequired()) {
q.setColumnNames(cfMapDef.getSliceColumnNameArr()); // depends on control dependency: [if], data = [none]
} else {
q.setRange("", "", false, maxNumColumns); // depends on control dependency: [if], data = [none]
}
QueryResult<ColumnSlice<String, byte[]>> result = q.execute();
if (null == result || null == result.get()) {
return null; // depends on control dependency: [if], data = [none]
}
T obj = createObject(cfMapDef, pkObj, result.get());
return obj;
} }
|
public class class_name {
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public Searcher deleteFacet(String... attributes) {
for (String attribute : attributes) {
facetRequestCount.put(attribute, 0);
facets.remove(attribute);
}
rebuildQueryFacets();
return this;
} }
|
public class class_name {
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public Searcher deleteFacet(String... attributes) {
for (String attribute : attributes) {
facetRequestCount.put(attribute, 0); // depends on control dependency: [for], data = [attribute]
facets.remove(attribute); // depends on control dependency: [for], data = [attribute]
}
rebuildQueryFacets();
return this;
} }
|
public class class_name {
public Pattern<T, F> within(Time windowTime) {
if (windowTime != null) {
this.windowTime = windowTime;
}
return this;
} }
|
public class class_name {
public Pattern<T, F> within(Time windowTime) {
if (windowTime != null) {
this.windowTime = windowTime; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static String addParameter(final String url, final String name, final String value) {
if (url != null) {
final StringBuilder sb = new StringBuilder();
sb.append(url);
if (name != null) {
if (url.indexOf("?") >= 0) {
sb.append("&");
} else {
sb.append("?");
}
sb.append(name);
sb.append("=");
if (value != null) {
sb.append(urlEncode(value));
}
}
return sb.toString();
}
return null;
} }
|
public class class_name {
public static String addParameter(final String url, final String name, final String value) {
if (url != null) {
final StringBuilder sb = new StringBuilder();
sb.append(url); // depends on control dependency: [if], data = [(url]
if (name != null) {
if (url.indexOf("?") >= 0) {
sb.append("&"); // depends on control dependency: [if], data = [none]
} else {
sb.append("?"); // depends on control dependency: [if], data = [none]
}
sb.append(name); // depends on control dependency: [if], data = [(name]
sb.append("="); // depends on control dependency: [if], data = [none]
if (value != null) {
sb.append(urlEncode(value)); // depends on control dependency: [if], data = [(value]
}
}
return sb.toString(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static Config getConfig(ConfigClient client, URI u, Optional<Config> runtimeConfig) {
try {
return client.getConfig(u, runtimeConfig);
} catch (ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException e) {
throw new Error(e);
}
} }
|
public class class_name {
public static Config getConfig(ConfigClient client, URI u, Optional<Config> runtimeConfig) {
try {
return client.getConfig(u, runtimeConfig); // depends on control dependency: [try], data = [none]
} catch (ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException e) {
throw new Error(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected static <T extends MPBase> ArrayList<T> fillArrayWithResponseData(Class clazz, MPApiResponse response) throws MPException {
ArrayList<T> resourceArray = new ArrayList<T>();
if (response.getJsonElementResponse() != null) {
JsonArray jsonArray = MPCoreUtils.getArrayFromJsonElement(response.getJsonElementResponse());
if (jsonArray != null) {
for (int i = 0; i < jsonArray.size(); i++) {
T resource = MPCoreUtils.getResourceFromJson(clazz, (JsonObject) jsonArray.get(i));
resource._lastKnownJson = MPCoreUtils.getJsonFromResource(resource);
resourceArray.add(resource);
}
}
}
return resourceArray;
} }
|
public class class_name {
protected static <T extends MPBase> ArrayList<T> fillArrayWithResponseData(Class clazz, MPApiResponse response) throws MPException {
ArrayList<T> resourceArray = new ArrayList<T>();
if (response.getJsonElementResponse() != null) {
JsonArray jsonArray = MPCoreUtils.getArrayFromJsonElement(response.getJsonElementResponse());
if (jsonArray != null) {
for (int i = 0; i < jsonArray.size(); i++) {
T resource = MPCoreUtils.getResourceFromJson(clazz, (JsonObject) jsonArray.get(i));
resource._lastKnownJson = MPCoreUtils.getJsonFromResource(resource); // depends on control dependency: [for], data = [none]
resourceArray.add(resource); // depends on control dependency: [for], data = [none]
}
}
}
return resourceArray;
} }
|
public class class_name {
public synchronized Extract getUniqueExtract(TableType type, String namespace, String table) {
Extract newExtract = new Extract(type, namespace, table);
while (this.createdInstances.contains(newExtract)) {
if (Strings.isNullOrEmpty(newExtract.getExtractId())) {
newExtract.setExtractId(this.dtf.print(new DateTime()));
} else {
DateTime extractDateTime = this.dtf.parseDateTime(newExtract.getExtractId());
newExtract.setExtractId(this.dtf.print(extractDateTime.plusSeconds(1)));
}
}
this.createdInstances.add(newExtract);
return newExtract;
} }
|
public class class_name {
public synchronized Extract getUniqueExtract(TableType type, String namespace, String table) {
Extract newExtract = new Extract(type, namespace, table);
while (this.createdInstances.contains(newExtract)) {
if (Strings.isNullOrEmpty(newExtract.getExtractId())) {
newExtract.setExtractId(this.dtf.print(new DateTime())); // depends on control dependency: [if], data = [none]
} else {
DateTime extractDateTime = this.dtf.parseDateTime(newExtract.getExtractId());
newExtract.setExtractId(this.dtf.print(extractDateTime.plusSeconds(1))); // depends on control dependency: [if], data = [none]
}
}
this.createdInstances.add(newExtract);
return newExtract;
} }
|
public class class_name {
private String getCommaSeperatedIndexes(Set<String> data) {
Iterator<String> it = data.iterator();
String res = it.next();
if (data.size() == 1) {
return res;
}
res += ", ";
while (it.hasNext()) {
res += it.next() + ", ";
}
res = res.substring(0, res.length() - 2);
return res;
} }
|
public class class_name {
private String getCommaSeperatedIndexes(Set<String> data) {
Iterator<String> it = data.iterator();
String res = it.next();
if (data.size() == 1) {
return res; // depends on control dependency: [if], data = [none]
}
res += ", ";
while (it.hasNext()) {
res += it.next() + ", "; // depends on control dependency: [while], data = [none]
}
res = res.substring(0, res.length() - 2);
return res;
} }
|
public class class_name {
public MessageDeliveryStatus messageArrived(final Message message) {
if (!this.hasToLetMessageThroughTheGate(message)) {
return null;
}
final boolean messageAccepted = this.storage.registerMessage(message, this);
final MessageDeliveryStatus status = messageAccepted ? MessageDeliveryStatus.ACCEPTED
: MessageDeliveryStatus.REJECTED;
this.consumers.messageReceived(message, status, this);
return status;
} }
|
public class class_name {
public MessageDeliveryStatus messageArrived(final Message message) {
if (!this.hasToLetMessageThroughTheGate(message)) {
return null; // depends on control dependency: [if], data = [none]
}
final boolean messageAccepted = this.storage.registerMessage(message, this);
final MessageDeliveryStatus status = messageAccepted ? MessageDeliveryStatus.ACCEPTED
: MessageDeliveryStatus.REJECTED;
this.consumers.messageReceived(message, status, this);
return status;
} }
|
public class class_name {
public void clear() {
for(int i=1; i<=2*m+3; i++) {
n[i] = i+1;
}
f[1] = 0F;
f[2*m+3] = 1F;
for(int i=1; i<=m; i++) {
f[2*i+1] = quantiles[i-1];
}
for(int i=1; i<=m+1; i++) {
f[2*i] = (f[2*i-1] + f[2*i+1])/2F;
}
for(int i=1; i<=2*m+3; i++) {
d[i] = 1F + 2*(m+1)*f[i];
}
isInitializing = true;
ni = 1;
} }
|
public class class_name {
public void clear() {
for(int i=1; i<=2*m+3; i++) {
n[i] = i+1; // depends on control dependency: [for], data = [i]
}
f[1] = 0F;
f[2*m+3] = 1F;
for(int i=1; i<=m; i++) {
f[2*i+1] = quantiles[i-1]; // depends on control dependency: [for], data = [i]
}
for(int i=1; i<=m+1; i++) {
f[2*i] = (f[2*i-1] + f[2*i+1])/2F; // depends on control dependency: [for], data = [i]
}
for(int i=1; i<=2*m+3; i++) {
d[i] = 1F + 2*(m+1)*f[i]; // depends on control dependency: [for], data = [i]
}
isInitializing = true;
ni = 1;
} }
|
public class class_name {
protected XMLStreamException _constructUnexpectedInTyped(int nextToken) {
if (nextToken == START_ELEMENT) {
return _constructTypeException("Element content can not contain child START_ELEMENT when using Typed Access methods", null);
}
return _constructTypeException("Expected a text token, got "+tokenTypeDesc(nextToken), null);
} }
|
public class class_name {
protected XMLStreamException _constructUnexpectedInTyped(int nextToken) {
if (nextToken == START_ELEMENT) {
return _constructTypeException("Element content can not contain child START_ELEMENT when using Typed Access methods", null); // depends on control dependency: [if], data = [none]
}
return _constructTypeException("Expected a text token, got "+tokenTypeDesc(nextToken), null);
} }
|
public class class_name {
protected long readData( Layout index, DataType dataType, WritableByteChannel out) throws java.io.IOException {
long count = 0;
if (dataType.getPrimitiveClassType() == byte.class || dataType == DataType.CHAR) {
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
count += raf.readToByteChannel( out, chunk.getSrcPos(), chunk.getNelems());
}
} else if (dataType.getPrimitiveClassType() == short.class) {
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
count += raf.readToByteChannel( out, chunk.getSrcPos(), 2 * chunk.getNelems());
}
} else if (dataType.getPrimitiveClassType() == int.class || (dataType == DataType.FLOAT)) {
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
count += raf.readToByteChannel( out, chunk.getSrcPos(), 4 * chunk.getNelems());
}
} else if ((dataType == DataType.DOUBLE) || dataType.getPrimitiveClassType() == long.class) {
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
count += raf.readToByteChannel( out, chunk.getSrcPos(), 8 * chunk.getNelems());
}
}
return count;
} }
|
public class class_name {
protected long readData( Layout index, DataType dataType, WritableByteChannel out) throws java.io.IOException {
long count = 0;
if (dataType.getPrimitiveClassType() == byte.class || dataType == DataType.CHAR) {
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
count += raf.readToByteChannel( out, chunk.getSrcPos(), chunk.getNelems()); // depends on control dependency: [while], data = [none]
}
} else if (dataType.getPrimitiveClassType() == short.class) {
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
count += raf.readToByteChannel( out, chunk.getSrcPos(), 2 * chunk.getNelems()); // depends on control dependency: [while], data = [none]
}
} else if (dataType.getPrimitiveClassType() == int.class || (dataType == DataType.FLOAT)) {
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
count += raf.readToByteChannel( out, chunk.getSrcPos(), 4 * chunk.getNelems()); // depends on control dependency: [while], data = [none]
}
} else if ((dataType == DataType.DOUBLE) || dataType.getPrimitiveClassType() == long.class) {
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
count += raf.readToByteChannel( out, chunk.getSrcPos(), 8 * chunk.getNelems());
}
}
return count;
} }
|
public class class_name {
public void marshall(PauseStateScheduleActionSettings pauseStateScheduleActionSettings, ProtocolMarshaller protocolMarshaller) {
if (pauseStateScheduleActionSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pauseStateScheduleActionSettings.getPipelines(), PIPELINES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PauseStateScheduleActionSettings pauseStateScheduleActionSettings, ProtocolMarshaller protocolMarshaller) {
if (pauseStateScheduleActionSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pauseStateScheduleActionSettings.getPipelines(), PIPELINES_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 ComboBox createSiteSelect(CmsObject cms) {
final IndexedContainer availableSites = CmsVaadinUtils.getAvailableSitesContainer(cms, SITE_CAPTION);
ComboBox combo = new ComboBox(null, availableSites);
combo.setTextInputAllowed(true);
combo.setNullSelectionAllowed(false);
combo.setWidth("200px");
combo.setInputPrompt(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_CLICK_TO_EDIT_0));
combo.setItemCaptionPropertyId(SITE_CAPTION);
combo.select(cms.getRequestContext().getSiteRoot());
combo.setFilteringMode(FilteringMode.CONTAINS);
combo.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String value = (String)event.getProperty().getValue();
if (availableSites.containsId(value)) {
changeSite(value, null);
m_appContext.updateOnChange();
availableSites.removeAllContainerFilters();
}
}
});
if (Page.getCurrent().getBrowserWindowHeight() > 650) {
combo.setPageLength(20);
}
return combo;
} }
|
public class class_name {
private ComboBox createSiteSelect(CmsObject cms) {
final IndexedContainer availableSites = CmsVaadinUtils.getAvailableSitesContainer(cms, SITE_CAPTION);
ComboBox combo = new ComboBox(null, availableSites);
combo.setTextInputAllowed(true);
combo.setNullSelectionAllowed(false);
combo.setWidth("200px");
combo.setInputPrompt(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_CLICK_TO_EDIT_0));
combo.setItemCaptionPropertyId(SITE_CAPTION);
combo.select(cms.getRequestContext().getSiteRoot());
combo.setFilteringMode(FilteringMode.CONTAINS);
combo.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String value = (String)event.getProperty().getValue();
if (availableSites.containsId(value)) {
changeSite(value, null); // depends on control dependency: [if], data = [none]
m_appContext.updateOnChange(); // depends on control dependency: [if], data = [none]
availableSites.removeAllContainerFilters(); // depends on control dependency: [if], data = [none]
}
}
});
if (Page.getCurrent().getBrowserWindowHeight() > 650) {
combo.setPageLength(20); // depends on control dependency: [if], data = [none]
}
return combo;
} }
|
public class class_name {
void checkpoint(boolean defrag) {
if (filesReadOnly) {
return;
}
database.logger.appLog.logContext(SimpleLog.LOG_NORMAL, "start");
deleteNewAndOldFiles();
writeScript(false);
if (cache != null) {
if (forceDefrag()) {
defrag = true;
}
if (defrag) {
try {
cache.defrag();
} catch (Exception e) {}
} else {
cache.close(true);
try {
cache.backupFile();
} catch (Exception e1) {
deleteNewBackup();
cache.open(false);
return;
}
cache.open(false);
}
}
properties.setDBModified(HsqlDatabaseProperties.FILES_NEW);
closeLog();
deleteLog();
renameNewScript();
renameNewBackup();
properties.setDBModified(HsqlDatabaseProperties.FILES_MODIFIED);
if (dbLogWriter == null) {
return;
}
openLog();
Session[] sessions = database.sessionManager.getAllSessions();
/*
try {
for (int i = 0; i < sessions.length; i++) {
Session session = sessions[i];
if (session.isAutoCommit() == false) {
dbLogWriter.writeLogStatement(session, session.getAutoCommitStatement());
}
}
} catch (IOException e) {
throw Error.error(ErrorCode.FILE_IO_ERROR, logFileName);
}
*/
database.logger.appLog.logContext(SimpleLog.LOG_NORMAL, "end");
} }
|
public class class_name {
void checkpoint(boolean defrag) {
if (filesReadOnly) {
return; // depends on control dependency: [if], data = [none]
}
database.logger.appLog.logContext(SimpleLog.LOG_NORMAL, "start");
deleteNewAndOldFiles();
writeScript(false);
if (cache != null) {
if (forceDefrag()) {
defrag = true; // depends on control dependency: [if], data = [none]
}
if (defrag) {
try {
cache.defrag(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
} else {
cache.close(true); // depends on control dependency: [if], data = [none]
try {
cache.backupFile(); // depends on control dependency: [try], data = [none]
} catch (Exception e1) {
deleteNewBackup();
cache.open(false);
return;
} // depends on control dependency: [catch], data = [none]
cache.open(false); // depends on control dependency: [if], data = [none]
}
}
properties.setDBModified(HsqlDatabaseProperties.FILES_NEW);
closeLog();
deleteLog();
renameNewScript();
renameNewBackup();
properties.setDBModified(HsqlDatabaseProperties.FILES_MODIFIED);
if (dbLogWriter == null) {
return; // depends on control dependency: [if], data = [none]
}
openLog();
Session[] sessions = database.sessionManager.getAllSessions();
/*
try {
for (int i = 0; i < sessions.length; i++) {
Session session = sessions[i];
if (session.isAutoCommit() == false) {
dbLogWriter.writeLogStatement(session, session.getAutoCommitStatement());
}
}
} catch (IOException e) {
throw Error.error(ErrorCode.FILE_IO_ERROR, logFileName);
}
*/
database.logger.appLog.logContext(SimpleLog.LOG_NORMAL, "end");
} }
|
public class class_name {
public void txFormDups(ExpressionList _expressionList, final Instruction _instruction) throws ClassParseException {
if (_instruction instanceof I_DUP) {
Instruction e = _expressionList.getTail();
while (!e.producesStack()) {
e = e.getPrevExpr();
}
_expressionList.add(new CloneInstruction(this, e));
//System.out.println("clone of " + e);
} else if (_instruction instanceof I_DUP2) {
Instruction e = _expressionList.getTail();
while (!e.producesStack()) {
e = e.getPrevPC();
}
final Instruction clone = e;
e = e.getPrevExpr();
while (!e.producesStack()) {
e = e.getPrevExpr();
}
_expressionList.add(new CloneInstruction(this, e));
_expressionList.add(new CloneInstruction(this, clone));
} else if (_instruction instanceof I_DUP_X1) {
Instruction e = _expressionList.getTail();
while (!e.producesStack()) {
e = e.getPrevExpr();
}
final Instruction clone1 = new CloneInstruction(this, e);
e = e.getPrevExpr();
while (!e.producesStack()) {
e = e.getPrevExpr();
}
_expressionList.insertBetween(e.getPrevExpr(), e, clone1);
} else if (_instruction instanceof I_DUP_X2) {
// dup_x2 duplicates top operand and jams a copy in 3 down from the top
// ...word3, word2, word1 => ...word1, word3, word2, word1
Instruction e = _expressionList.getTail();
if (logger.isLoggable(Level.FINE)) {
logger.fine("Found DUP_X2 prev=" + e.getPrevExpr() + " e=" + e + " curr=" + _instruction);
}
// Get the previous instr to write to stack "word1"
while (!e.producesStack()) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("DUP_X2 skipping to find write: e=" + e);
}
e = e.getPrevExpr();
}
// Clone it, this will replace the dup action
final Instruction clone1 = new CloneInstruction(this, e);
if (logger.isLoggable(Level.FINE)) {
logger.fine("DUP_X2 cloning: clone1=" + clone1);
}
// Skip over 2 earlier writes to stack and capture 3rd one
e = e.getPrevExpr();
for (int i = 0; i < 2;) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("DUP_X2 skipping to find insert: e=" + e);
}
if (e.producesStack()) {
i++;
}
if (i < 2) {
e = e.getPrevExpr();
}
}
if (logger.isLoggable(Level.FINE)) {
logger.fine("DUP_X2 insert: prev=" + e.getPrevExpr() + " e=" + e + " clone=" + clone1);
}
// Add our clone in between those two writes
_expressionList.insertBetween(e.getPrevExpr(), e, clone1);
} else if (_instruction instanceof DUP) {
throw new ClassParseException(_instruction, ClassParseException.TYPE.UNSUPPORTEDBYTECODE);
}
} }
|
public class class_name {
public void txFormDups(ExpressionList _expressionList, final Instruction _instruction) throws ClassParseException {
if (_instruction instanceof I_DUP) {
Instruction e = _expressionList.getTail();
while (!e.producesStack()) {
e = e.getPrevExpr(); // depends on control dependency: [while], data = [none]
}
_expressionList.add(new CloneInstruction(this, e));
//System.out.println("clone of " + e);
} else if (_instruction instanceof I_DUP2) {
Instruction e = _expressionList.getTail();
while (!e.producesStack()) {
e = e.getPrevPC(); // depends on control dependency: [while], data = [none]
}
final Instruction clone = e;
e = e.getPrevExpr();
while (!e.producesStack()) {
e = e.getPrevExpr(); // depends on control dependency: [while], data = [none]
}
_expressionList.add(new CloneInstruction(this, e));
_expressionList.add(new CloneInstruction(this, clone));
} else if (_instruction instanceof I_DUP_X1) {
Instruction e = _expressionList.getTail();
while (!e.producesStack()) {
e = e.getPrevExpr(); // depends on control dependency: [while], data = [none]
}
final Instruction clone1 = new CloneInstruction(this, e);
e = e.getPrevExpr();
while (!e.producesStack()) {
e = e.getPrevExpr(); // depends on control dependency: [while], data = [none]
}
_expressionList.insertBetween(e.getPrevExpr(), e, clone1);
} else if (_instruction instanceof I_DUP_X2) {
// dup_x2 duplicates top operand and jams a copy in 3 down from the top
// ...word3, word2, word1 => ...word1, word3, word2, word1
Instruction e = _expressionList.getTail();
if (logger.isLoggable(Level.FINE)) {
logger.fine("Found DUP_X2 prev=" + e.getPrevExpr() + " e=" + e + " curr=" + _instruction); // depends on control dependency: [if], data = [none]
}
// Get the previous instr to write to stack "word1"
while (!e.producesStack()) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("DUP_X2 skipping to find write: e=" + e); // depends on control dependency: [if], data = [none]
}
e = e.getPrevExpr(); // depends on control dependency: [while], data = [none]
}
// Clone it, this will replace the dup action
final Instruction clone1 = new CloneInstruction(this, e);
if (logger.isLoggable(Level.FINE)) {
logger.fine("DUP_X2 cloning: clone1=" + clone1); // depends on control dependency: [if], data = [none]
}
// Skip over 2 earlier writes to stack and capture 3rd one
e = e.getPrevExpr();
for (int i = 0; i < 2;) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("DUP_X2 skipping to find insert: e=" + e); // depends on control dependency: [if], data = [none]
}
if (e.producesStack()) {
i++; // depends on control dependency: [if], data = [none]
}
if (i < 2) {
e = e.getPrevExpr(); // depends on control dependency: [if], data = [none]
}
}
if (logger.isLoggable(Level.FINE)) {
logger.fine("DUP_X2 insert: prev=" + e.getPrevExpr() + " e=" + e + " clone=" + clone1); // depends on control dependency: [if], data = [none]
}
// Add our clone in between those two writes
_expressionList.insertBetween(e.getPrevExpr(), e, clone1);
} else if (_instruction instanceof DUP) {
throw new ClassParseException(_instruction, ClassParseException.TYPE.UNSUPPORTEDBYTECODE);
}
} }
|
public class class_name {
public void marshall(StorageType storageType, ProtocolMarshaller protocolMarshaller) {
if (storageType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(storageType.getStorageTypeName(), STORAGETYPENAME_BINDING);
protocolMarshaller.marshall(storageType.getStorageSubTypeName(), STORAGESUBTYPENAME_BINDING);
protocolMarshaller.marshall(storageType.getStorageTypeLimits(), STORAGETYPELIMITS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StorageType storageType, ProtocolMarshaller protocolMarshaller) {
if (storageType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(storageType.getStorageTypeName(), STORAGETYPENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageType.getStorageSubTypeName(), STORAGESUBTYPENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageType.getStorageTypeLimits(), STORAGETYPELIMITS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected static String safePrint(Object... o){
StringBuilder sb = new StringBuilder();
for (Object obj: o){
sb.append(obj != null ? obj : "null");
}
return sb.toString();
} }
|
public class class_name {
protected static String safePrint(Object... o){
StringBuilder sb = new StringBuilder();
for (Object obj: o){
sb.append(obj != null ? obj : "null"); // depends on control dependency: [for], data = [obj]
}
return sb.toString();
} }
|
public class class_name {
public void marshall(ListResourcesForTagOptionRequest listResourcesForTagOptionRequest, ProtocolMarshaller protocolMarshaller) {
if (listResourcesForTagOptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listResourcesForTagOptionRequest.getTagOptionId(), TAGOPTIONID_BINDING);
protocolMarshaller.marshall(listResourcesForTagOptionRequest.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(listResourcesForTagOptionRequest.getPageSize(), PAGESIZE_BINDING);
protocolMarshaller.marshall(listResourcesForTagOptionRequest.getPageToken(), PAGETOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListResourcesForTagOptionRequest listResourcesForTagOptionRequest, ProtocolMarshaller protocolMarshaller) {
if (listResourcesForTagOptionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listResourcesForTagOptionRequest.getTagOptionId(), TAGOPTIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourcesForTagOptionRequest.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourcesForTagOptionRequest.getPageSize(), PAGESIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listResourcesForTagOptionRequest.getPageToken(), PAGETOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static int stringToUTFBytes(String str,
HsqlByteArrayOutputStream out) {
int strlen = str.length();
int c,
count = 0;
if (out.count + strlen + 8 > out.buffer.length) {
out.ensureRoom(strlen + 8);
}
char[] arr = str.toCharArray();
for (int i = 0; i < strlen; i++) {
c = arr[i];
if (c >= 0x0001 && c <= 0x007F) {
out.buffer[out.count++] = (byte) c;
count++;
} else if (c > 0x07FF) {
out.buffer[out.count++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
out.buffer[out.count++] = (byte) (0x80 | ((c >> 6) & 0x3F));
out.buffer[out.count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
count += 3;
} else {
out.buffer[out.count++] = (byte) (0xC0 | ((c >> 6) & 0x1F));
out.buffer[out.count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
count += 2;
}
if (out.count + 8 > out.buffer.length) {
out.ensureRoom(strlen - i + 8);
}
}
return count;
} }
|
public class class_name {
public static int stringToUTFBytes(String str,
HsqlByteArrayOutputStream out) {
int strlen = str.length();
int c,
count = 0;
if (out.count + strlen + 8 > out.buffer.length) {
out.ensureRoom(strlen + 8); // depends on control dependency: [if], data = [none]
}
char[] arr = str.toCharArray();
for (int i = 0; i < strlen; i++) {
c = arr[i]; // depends on control dependency: [for], data = [i]
if (c >= 0x0001 && c <= 0x007F) {
out.buffer[out.count++] = (byte) c; // depends on control dependency: [if], data = [none]
count++; // depends on control dependency: [if], data = [none]
} else if (c > 0x07FF) {
out.buffer[out.count++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); // depends on control dependency: [if], data = [(c]
out.buffer[out.count++] = (byte) (0x80 | ((c >> 6) & 0x3F)); // depends on control dependency: [if], data = [(c]
out.buffer[out.count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); // depends on control dependency: [if], data = [(c]
count += 3; // depends on control dependency: [if], data = [none]
} else {
out.buffer[out.count++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); // depends on control dependency: [if], data = [(c]
out.buffer[out.count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); // depends on control dependency: [if], data = [(c]
count += 2; // depends on control dependency: [if], data = [none]
}
if (out.count + 8 > out.buffer.length) {
out.ensureRoom(strlen - i + 8); // depends on control dependency: [if], data = [none]
}
}
return count;
} }
|
public class class_name {
public void update(){
logger.info("Begin automatic schema updating.");
if(!existsTable()){
createTable();
}
int currentVersion = getCurrentVersion();
int version = currentVersion;
String sql = null;
while((sql = getSql(version + 1)) != null){
if(sql.trim().length() != 0){
sqlManager.executeUpdate(new StringSqlResource(sql));
}
version++;
}
if(version != currentVersion){
updateVersion(version);
logger.info(String.format("Schema was updated to version %d.", version));
} else {
logger.info("There are no updates.");
}
logger.info("End automatic schema updating.");
} }
|
public class class_name {
public void update(){
logger.info("Begin automatic schema updating.");
if(!existsTable()){
createTable();
// depends on control dependency: [if], data = [none]
}
int currentVersion = getCurrentVersion();
int version = currentVersion;
String sql = null;
while((sql = getSql(version + 1)) != null){
if(sql.trim().length() != 0){
sqlManager.executeUpdate(new StringSqlResource(sql));
// depends on control dependency: [if], data = [none]
}
version++;
// depends on control dependency: [while], data = [none]
}
if(version != currentVersion){
updateVersion(version);
// depends on control dependency: [if], data = [(version]
logger.info(String.format("Schema was updated to version %d.", version));
// depends on control dependency: [if], data = [none]
} else {
logger.info("There are no updates.");
// depends on control dependency: [if], data = [none]
}
logger.info("End automatic schema updating.");
} }
|
public class class_name {
public void insertMetrics(Collection<IMetric> metrics, ColumnFamily cf, boolean isRecordingDelayedMetrics, Clock clock) throws ConnectionException {
Timer.Context ctx = Instrumentation.getWriteTimerContext(cf.getName());
Multimap<Locator, IMetric> map = asMultimap(metrics);
MutationBatch batch = keyspace.prepareMutationBatch();
try {
for (Locator locator : map.keySet()) {
ColumnListMutation<Long> mutation = batch.withRow(cf, locator);
for (IMetric metric : map.get(locator)) {
mutation.putColumn(
metric.getCollectionTime(),
metric.getMetricValue(),
(AbstractSerializer) (Serializers.serializerFor(metric.getMetricValue().getClass())),
metric.getTtlInSeconds());
if (cf.getName().equals(CassandraModel.CF_METRICS_PREAGGREGATED_FULL_NAME)) {
Instrumentation.markFullResPreaggregatedMetricWritten();
}
if (isRecordingDelayedMetrics) {
//retaining the same conditional logic that was used to perform insertLocator(locator, batch).
insertLocatorIfDelayed(metric, batch, clock);
}
}
if (!LocatorCache.getInstance().isLocatorCurrentInBatchLayer(locator)) {
insertLocator(locator, batch);
LocatorCache.getInstance().setLocatorCurrentInBatchLayer(locator);
}
}
try {
batch.execute();
} catch (ConnectionException e) {
Instrumentation.markWriteError(e);
log.error("Connection exception persisting data", e);
throw e;
}
} finally {
ctx.stop();
}
} }
|
public class class_name {
public void insertMetrics(Collection<IMetric> metrics, ColumnFamily cf, boolean isRecordingDelayedMetrics, Clock clock) throws ConnectionException {
Timer.Context ctx = Instrumentation.getWriteTimerContext(cf.getName());
Multimap<Locator, IMetric> map = asMultimap(metrics);
MutationBatch batch = keyspace.prepareMutationBatch();
try {
for (Locator locator : map.keySet()) {
ColumnListMutation<Long> mutation = batch.withRow(cf, locator);
for (IMetric metric : map.get(locator)) {
mutation.putColumn(
metric.getCollectionTime(),
metric.getMetricValue(),
(AbstractSerializer) (Serializers.serializerFor(metric.getMetricValue().getClass())),
metric.getTtlInSeconds()); // depends on control dependency: [for], data = [none]
if (cf.getName().equals(CassandraModel.CF_METRICS_PREAGGREGATED_FULL_NAME)) {
Instrumentation.markFullResPreaggregatedMetricWritten(); // depends on control dependency: [if], data = [none]
}
if (isRecordingDelayedMetrics) {
//retaining the same conditional logic that was used to perform insertLocator(locator, batch).
insertLocatorIfDelayed(metric, batch, clock); // depends on control dependency: [if], data = [none]
}
}
if (!LocatorCache.getInstance().isLocatorCurrentInBatchLayer(locator)) {
insertLocator(locator, batch); // depends on control dependency: [if], data = [none]
LocatorCache.getInstance().setLocatorCurrentInBatchLayer(locator); // depends on control dependency: [if], data = [none]
}
}
try {
batch.execute(); // depends on control dependency: [try], data = [none]
} catch (ConnectionException e) {
Instrumentation.markWriteError(e);
log.error("Connection exception persisting data", e);
throw e;
} // depends on control dependency: [catch], data = [none]
} finally {
ctx.stop();
}
} }
|
public class class_name {
private void visitBinaryOperator(Token op, Node n) {
Node left = n.getFirstChild();
JSType leftType = getJSType(left);
Node right = n.getLastChild();
JSType rightType = getJSType(right);
switch (op) {
case ASSIGN_LSH:
case ASSIGN_RSH:
case LSH:
case RSH:
case ASSIGN_URSH:
case URSH:
String opStr = NodeUtil.opToStr(n.getToken());
if (!leftType.matchesNumberContext()) {
report(left, BIT_OPERATION, opStr, leftType.toString());
} else {
this.validator.expectNumberStrict(n, leftType, "operator " + opStr);
}
if (!rightType.matchesNumberContext()) {
report(right, BIT_OPERATION, opStr, rightType.toString());
} else {
this.validator.expectNumberStrict(n, rightType, "operator " + opStr);
}
break;
case ASSIGN_DIV:
case ASSIGN_MOD:
case ASSIGN_MUL:
case ASSIGN_SUB:
case ASSIGN_EXPONENT:
case DIV:
case MOD:
case MUL:
case SUB:
case EXPONENT:
validator.expectNumber(left, leftType, "left operand");
validator.expectNumber(right, rightType, "right operand");
break;
case ASSIGN_BITAND:
case ASSIGN_BITXOR:
case ASSIGN_BITOR:
case BITAND:
case BITXOR:
case BITOR:
validator.expectBitwiseable(left, leftType, "bad left operand to bitwise operator");
validator.expectBitwiseable(right, rightType, "bad right operand to bitwise operator");
break;
case ASSIGN_ADD:
case ADD:
break;
default:
report(n, UNEXPECTED_TOKEN, op.toString());
}
ensureTyped(n);
} }
|
public class class_name {
private void visitBinaryOperator(Token op, Node n) {
Node left = n.getFirstChild();
JSType leftType = getJSType(left);
Node right = n.getLastChild();
JSType rightType = getJSType(right);
switch (op) {
case ASSIGN_LSH:
case ASSIGN_RSH:
case LSH:
case RSH:
case ASSIGN_URSH:
case URSH:
String opStr = NodeUtil.opToStr(n.getToken());
if (!leftType.matchesNumberContext()) {
report(left, BIT_OPERATION, opStr, leftType.toString()); // depends on control dependency: [if], data = [none]
} else {
this.validator.expectNumberStrict(n, leftType, "operator " + opStr); // depends on control dependency: [if], data = [none]
}
if (!rightType.matchesNumberContext()) {
report(right, BIT_OPERATION, opStr, rightType.toString()); // depends on control dependency: [if], data = [none]
} else {
this.validator.expectNumberStrict(n, rightType, "operator " + opStr); // depends on control dependency: [if], data = [none]
}
break;
case ASSIGN_DIV:
case ASSIGN_MOD:
case ASSIGN_MUL:
case ASSIGN_SUB:
case ASSIGN_EXPONENT:
case DIV:
case MOD:
case MUL:
case SUB:
case EXPONENT:
validator.expectNumber(left, leftType, "left operand");
validator.expectNumber(right, rightType, "right operand");
break;
case ASSIGN_BITAND:
case ASSIGN_BITXOR:
case ASSIGN_BITOR:
case BITAND:
case BITXOR:
case BITOR:
validator.expectBitwiseable(left, leftType, "bad left operand to bitwise operator");
validator.expectBitwiseable(right, rightType, "bad right operand to bitwise operator");
break;
case ASSIGN_ADD:
case ADD:
break;
default:
report(n, UNEXPECTED_TOKEN, op.toString());
}
ensureTyped(n);
} }
|
public class class_name {
public static void initialize() {
String homeDirName = System.getProperty("jdcp.home");
File homeDir;
if (homeDirName != null) {
homeDir = new File(homeDirName);
} else {
homeDir = FileUtil.getApplicationDataDirectory("jdcp");
System.setProperty("jdcp.home", homeDir.getPath());
}
homeDir.mkdir();
if (System.getProperty("derby.system.home") == null) {
System.setProperty("derby.system.home", homeDir.getPath());
}
} }
|
public class class_name {
public static void initialize() {
String homeDirName = System.getProperty("jdcp.home");
File homeDir;
if (homeDirName != null) {
homeDir = new File(homeDirName); // depends on control dependency: [if], data = [(homeDirName]
} else {
homeDir = FileUtil.getApplicationDataDirectory("jdcp"); // depends on control dependency: [if], data = [none]
System.setProperty("jdcp.home", homeDir.getPath()); // depends on control dependency: [if], data = [none]
}
homeDir.mkdir();
if (System.getProperty("derby.system.home") == null) {
System.setProperty("derby.system.home", homeDir.getPath()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private PreparedStatement checkValidity(PreparedStatement ps, String key) {
long currentTime = currentTimeMillis();
Long lastChecked = threadedPsTimeMap.get().get(key);
if (lastChecked == null) {
// if never checked, setting to 0 ensures check will occur
// (as long as we're not less than 10min past 1 Jan 1970)
lastChecked = 0L;
}
if (currentTime - lastChecked.longValue() > VALIDITY_CHECK_INTERVAL) {
try {
Connection psConn = ps.getConnection();
if (psConn == null || psConn.isClosed()
|| !psConn.isValid(VALIDITY_TIMEOUT)) {
logger.info("Connection for PreparedStatement is closed or "
+ "invalid; removing from cache");
// remove the prepared statement w/ invalid connection
threadedPsMap.get().remove(key);
ps = null;
}
} catch (SQLException e) {
logger.info("Failed to check Prepared Statement validity.", e);
ps = null;
}
}
return ps;
} }
|
public class class_name {
private PreparedStatement checkValidity(PreparedStatement ps, String key) {
long currentTime = currentTimeMillis();
Long lastChecked = threadedPsTimeMap.get().get(key);
if (lastChecked == null) {
// if never checked, setting to 0 ensures check will occur
// (as long as we're not less than 10min past 1 Jan 1970)
lastChecked = 0L; // depends on control dependency: [if], data = [none]
}
if (currentTime - lastChecked.longValue() > VALIDITY_CHECK_INTERVAL) {
try {
Connection psConn = ps.getConnection();
if (psConn == null || psConn.isClosed()
|| !psConn.isValid(VALIDITY_TIMEOUT)) {
logger.info("Connection for PreparedStatement is closed or "
+ "invalid; removing from cache"); // depends on control dependency: [if], data = [none]
// remove the prepared statement w/ invalid connection
threadedPsMap.get().remove(key); // depends on control dependency: [if], data = [none]
ps = null; // depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
logger.info("Failed to check Prepared Statement validity.", e);
ps = null;
} // depends on control dependency: [catch], data = [none]
}
return ps;
} }
|
public class class_name {
public static int whichMax(int[] x) {
int m = x[0];
int which = 0;
for (int i = 1; i < x.length; i++) {
if (x[i] > m) {
m = x[i];
which = i;
}
}
return which;
} }
|
public class class_name {
public static int whichMax(int[] x) {
int m = x[0];
int which = 0;
for (int i = 1; i < x.length; i++) {
if (x[i] > m) {
m = x[i]; // depends on control dependency: [if], data = [none]
which = i; // depends on control dependency: [if], data = [none]
}
}
return which;
} }
|
public class class_name {
public IScope createFeatureCallScopeForReceiver(final XExpression featureCall, final XExpression receiver, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
if (receiver == null || receiver.eIsProxy())
return IScope.NULLSCOPE;
LightweightTypeReference receiverType = resolvedTypes.getActualType(receiver);
if (receiverType != null && !isUnknownReceiverType(receiverType)) {
JvmIdentifiableElement linkedReceiver = resolvedTypes.getLinkedFeature(asAbstractFeatureCall(receiver));
boolean typeLiteral = false;
IScope root = createTypeLiteralScope(featureCall, receiver, session, resolvedTypes, receiverType, linkedReceiver);
if (root != null) {
if (featureCall instanceof XMemberFeatureCall && ((XMemberFeatureCall) featureCall).isExplicitStatic()) {
return root;
}
typeLiteral = true;
} else {
root = IScope.NULLSCOPE;
}
// check if 'super' was used as receiver which renders extension features and static features invalid
if (typeLiteral || isValidFeatureCallArgument(receiver, linkedReceiver, session)) {
// static members that are invoked on a receiver, e.g. myString.CASE_INSENSITIVE_ORDER
IScope staticScope = createStaticScope(asAbstractFeatureCall(featureCall), receiver, receiverType, root, session, resolvedTypes);
// static extensions, if any, e.g. iterable.map [], or things that have been imported by means of import static extension MyType
IScope staticExtensionScope = createStaticExtensionsScope(receiver, receiverType, featureCall, staticScope, session, resolvedTypes);
// instance extensions, e.g. extension ReflectionUtils with myObject.get('privateField')
IScope extensionScope = createDynamicExtensionsScope(receiver, receiverType, featureCall, staticExtensionScope, session, resolvedTypes);
// instance members, e.g. this.toString
return createFeatureScopeForTypeRef(receiver, receiverType, false, featureCall, session, linkedReceiver, extensionScope, true);
} else {
// put only instance members into the scope
return createFeatureScopeForTypeRef(receiver, receiverType, false, featureCall, session, linkedReceiver, IScope.NULLSCOPE, true);
}
} else if (typeLiteralHelper.isPotentialTypeLiteral(featureCall, resolvedTypes)) {
IScope errorScope = createFollowUpErrorScope(receiverType);
List<String> prefix = typeLiteralHelper.getTypeNameSegmentsFromConcreteSyntax((XMemberFeatureCall) featureCall);
if (prefix == null) {
return errorScope;
}
return createTypeLiteralScope(featureCall, QualifiedName.create(prefix), errorScope, session, resolvedTypes);
} else {
return createFollowUpErrorScope(receiverType);
}
} }
|
public class class_name {
public IScope createFeatureCallScopeForReceiver(final XExpression featureCall, final XExpression receiver, IFeatureScopeSession session, IResolvedTypes resolvedTypes) {
if (receiver == null || receiver.eIsProxy())
return IScope.NULLSCOPE;
LightweightTypeReference receiverType = resolvedTypes.getActualType(receiver);
if (receiverType != null && !isUnknownReceiverType(receiverType)) {
JvmIdentifiableElement linkedReceiver = resolvedTypes.getLinkedFeature(asAbstractFeatureCall(receiver));
boolean typeLiteral = false;
IScope root = createTypeLiteralScope(featureCall, receiver, session, resolvedTypes, receiverType, linkedReceiver);
if (root != null) {
if (featureCall instanceof XMemberFeatureCall && ((XMemberFeatureCall) featureCall).isExplicitStatic()) {
return root; // depends on control dependency: [if], data = [none]
}
typeLiteral = true; // depends on control dependency: [if], data = [none]
} else {
root = IScope.NULLSCOPE; // depends on control dependency: [if], data = [none]
}
// check if 'super' was used as receiver which renders extension features and static features invalid
if (typeLiteral || isValidFeatureCallArgument(receiver, linkedReceiver, session)) {
// static members that are invoked on a receiver, e.g. myString.CASE_INSENSITIVE_ORDER
IScope staticScope = createStaticScope(asAbstractFeatureCall(featureCall), receiver, receiverType, root, session, resolvedTypes);
// static extensions, if any, e.g. iterable.map [], or things that have been imported by means of import static extension MyType
IScope staticExtensionScope = createStaticExtensionsScope(receiver, receiverType, featureCall, staticScope, session, resolvedTypes);
// instance extensions, e.g. extension ReflectionUtils with myObject.get('privateField')
IScope extensionScope = createDynamicExtensionsScope(receiver, receiverType, featureCall, staticExtensionScope, session, resolvedTypes);
// instance members, e.g. this.toString
return createFeatureScopeForTypeRef(receiver, receiverType, false, featureCall, session, linkedReceiver, extensionScope, true); // depends on control dependency: [if], data = [none]
} else {
// put only instance members into the scope
return createFeatureScopeForTypeRef(receiver, receiverType, false, featureCall, session, linkedReceiver, IScope.NULLSCOPE, true); // depends on control dependency: [if], data = [none]
}
} else if (typeLiteralHelper.isPotentialTypeLiteral(featureCall, resolvedTypes)) {
IScope errorScope = createFollowUpErrorScope(receiverType);
List<String> prefix = typeLiteralHelper.getTypeNameSegmentsFromConcreteSyntax((XMemberFeatureCall) featureCall);
if (prefix == null) {
return errorScope; // depends on control dependency: [if], data = [none]
}
return createTypeLiteralScope(featureCall, QualifiedName.create(prefix), errorScope, session, resolvedTypes); // depends on control dependency: [if], data = [none]
} else {
return createFollowUpErrorScope(receiverType); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String getTopicTitleWithConditions(final ITopicNode specTopic, final BaseTopicWrapper<?> topic) {
final String condition = specTopic.getConditionStatement(true);
if (condition != null && topic.getTitle() != null && topic.getTitle().contains("condition")) {
try {
final Document doc = XMLUtilities.convertStringToDocument("<title>" + topic.getTitle() + "</title>");
// Process the condition on the title
DocBookUtilities.processConditions(condition, doc);
// Return the processed title
return XMLUtilities.convertNodeToString(doc, false);
} catch (Exception e) {
log.debug(e.getMessage());
}
return topic.getTitle();
} else {
return topic.getTitle();
}
} }
|
public class class_name {
public static String getTopicTitleWithConditions(final ITopicNode specTopic, final BaseTopicWrapper<?> topic) {
final String condition = specTopic.getConditionStatement(true);
if (condition != null && topic.getTitle() != null && topic.getTitle().contains("condition")) {
try {
final Document doc = XMLUtilities.convertStringToDocument("<title>" + topic.getTitle() + "</title>");
// Process the condition on the title
DocBookUtilities.processConditions(condition, doc); // depends on control dependency: [try], data = [none]
// Return the processed title
return XMLUtilities.convertNodeToString(doc, false); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.debug(e.getMessage());
} // depends on control dependency: [catch], data = [none]
return topic.getTitle(); // depends on control dependency: [if], data = [none]
} else {
return topic.getTitle(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected CharSequence getPersistenceScript(final UIGrid _uiGrid)
throws EFapsException
{
final StringBuilder ret = new StringBuilder();
ret.append("persistGet: function(_key) {");
if (Context.getThreadContext().containsUserAttribute(_uiGrid.getCacheKey(CacheKey.GRIDX))) {
final Set<Long> colIds = _uiGrid.getColumns()
.stream()
.map(col -> col.getField().getId())
.collect(Collectors.toSet());
boolean add = true;
final JSONObject json = new JSONObject(new JSONTokener(Context.getThreadContext().getUserAttribute(
_uiGrid.getCacheKey(CacheKey.GRIDX))));
final JSONArray columnsArray = json.getJSONArray("column");
for (int i = 0; i < columnsArray.length(); i++) {
final JSONObject colObj = (JSONObject) columnsArray.get(i);
final Long colid = colObj.getLong("id");
if (!colIds.contains(colid)) {
add = false;
break;
}
}
if (add && !json.isNull("filterBar")) {
final JSONObject filterBar = json.getJSONObject("filterBar");
if (!filterBar.isNull("conditions")) {
final JSONArray conditionsArray = filterBar.getJSONArray("conditions");
for (int i = 0; i < conditionsArray.length(); i++) {
final JSONObject colObj = (JSONObject) conditionsArray.get(i);
if (colObj.has("colId")) {
final Long colid = colObj.optLong("colId");
if (colid > 0 && !colIds.contains(colid)) {
add = false;
break;
}
}
}
}
}
if (add) {
ret.append("return ").append(json.toString());
}
}
ret.append("},\n")
.append("persistPut: function(_key, _value, _options) {\n")
.append(" var value;")
.append(" if(_value && lang.isObject(_value)){\n")
.append(" value = json.toJson(_value);\n")
.append(" }else{\n")
.append(" value = {expires: -1};\n")
.append(" }\n")
.append("top.eFaps.persistUserAttr('")
.append(_uiGrid.getCacheKey(CacheKey.GRIDX)).append("', value);")
.append("},\n");
return ret;
} }
|
public class class_name {
protected CharSequence getPersistenceScript(final UIGrid _uiGrid)
throws EFapsException
{
final StringBuilder ret = new StringBuilder();
ret.append("persistGet: function(_key) {");
if (Context.getThreadContext().containsUserAttribute(_uiGrid.getCacheKey(CacheKey.GRIDX))) {
final Set<Long> colIds = _uiGrid.getColumns()
.stream()
.map(col -> col.getField().getId())
.collect(Collectors.toSet());
boolean add = true;
final JSONObject json = new JSONObject(new JSONTokener(Context.getThreadContext().getUserAttribute(
_uiGrid.getCacheKey(CacheKey.GRIDX))));
final JSONArray columnsArray = json.getJSONArray("column");
for (int i = 0; i < columnsArray.length(); i++) {
final JSONObject colObj = (JSONObject) columnsArray.get(i);
final Long colid = colObj.getLong("id");
if (!colIds.contains(colid)) {
add = false; // depends on control dependency: [if], data = [none]
break;
}
}
if (add && !json.isNull("filterBar")) {
final JSONObject filterBar = json.getJSONObject("filterBar");
if (!filterBar.isNull("conditions")) {
final JSONArray conditionsArray = filterBar.getJSONArray("conditions");
for (int i = 0; i < conditionsArray.length(); i++) {
final JSONObject colObj = (JSONObject) conditionsArray.get(i);
if (colObj.has("colId")) {
final Long colid = colObj.optLong("colId");
if (colid > 0 && !colIds.contains(colid)) {
add = false; // depends on control dependency: [if], data = [none]
break;
}
}
}
}
}
if (add) {
ret.append("return ").append(json.toString()); // depends on control dependency: [if], data = [none]
}
}
ret.append("},\n")
.append("persistPut: function(_key, _value, _options) {\n")
.append(" var value;")
.append(" if(_value && lang.isObject(_value)){\n")
.append(" value = json.toJson(_value);\n")
.append(" }else{\n")
.append(" value = {expires: -1};\n")
.append(" }\n")
.append("top.eFaps.persistUserAttr('")
.append(_uiGrid.getCacheKey(CacheKey.GRIDX)).append("', value);")
.append("},\n");
return ret;
} }
|
public class class_name {
public static void setInputPaths(Job job,
Path... inputPaths) throws IOException {
Configuration conf = job.getConfiguration();
FileSystem fs = FileSystem.get(conf);
Path path = inputPaths[0].makeQualified(fs);
StringBuffer str = new StringBuffer(StringUtils.escapeString(path.toString()));
for(int i = 1; i < inputPaths.length;i++) {
str.append(StringUtils.COMMA_STR);
path = inputPaths[i].makeQualified(fs);
str.append(StringUtils.escapeString(path.toString()));
}
conf.set("mapred.input.dir", str.toString());
} }
|
public class class_name {
public static void setInputPaths(Job job,
Path... inputPaths) throws IOException {
Configuration conf = job.getConfiguration();
FileSystem fs = FileSystem.get(conf);
Path path = inputPaths[0].makeQualified(fs);
StringBuffer str = new StringBuffer(StringUtils.escapeString(path.toString()));
for(int i = 1; i < inputPaths.length;i++) {
str.append(StringUtils.COMMA_STR); // depends on control dependency: [for], data = [none]
path = inputPaths[i].makeQualified(fs); // depends on control dependency: [for], data = [i]
str.append(StringUtils.escapeString(path.toString())); // depends on control dependency: [for], data = [none]
}
conf.set("mapred.input.dir", str.toString());
} }
|
public class class_name {
@SuppressWarnings("rawtypes")
public static Object unpack(Object obj) {
Object value = obj;
while (value != null) {
if (value instanceof Closure) {
value = ((Closure) value).call();
} else if (value instanceof Callable) {
try {
value = ((Callable) value).call();
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
return value;
}
}
return value;
} }
|
public class class_name {
@SuppressWarnings("rawtypes")
public static Object unpack(Object obj) {
Object value = obj;
while (value != null) {
if (value instanceof Closure) {
value = ((Closure) value).call(); // depends on control dependency: [if], data = [none]
} else if (value instanceof Callable) {
try {
value = ((Callable) value).call(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} else {
return value; // depends on control dependency: [if], data = [none]
}
}
return value;
} }
|
public class class_name {
private CoreLabel makeCoreLabel(String line) {
CoreLabel wi = new CoreLabel();
// wi.line = line;
String[] bits = line.split("\\s+");
switch (bits.length) {
case 0:
case 1:
wi.setWord(BOUNDARY);
wi.set(AnswerAnnotation.class, OTHER);
break;
case 2:
wi.setWord(bits[0]);
wi.set(AnswerAnnotation.class, bits[1]);
break;
case 3:
wi.setWord(bits[0]);
wi.setTag(bits[1]);
wi.set(AnswerAnnotation.class, bits[2]);
break;
case 4:
wi.setWord(bits[0]);
wi.setTag(bits[1]);
wi.set(ChunkAnnotation.class, bits[2]);
wi.set(AnswerAnnotation.class, bits[3]);
break;
case 5:
if (flags.useLemmaAsWord) {
wi.setWord(bits[1]);
} else {
wi.setWord(bits[0]);
}
wi.set(LemmaAnnotation.class, bits[1]);
wi.setTag(bits[2]);
wi.set(ChunkAnnotation.class, bits[3]);
wi.set(AnswerAnnotation.class, bits[4]);
break;
default:
throw new RuntimeIOException("Unexpected input (many fields): " + line);
}
wi.set(OriginalAnswerAnnotation.class, wi.get(AnswerAnnotation.class));
return wi;
} }
|
public class class_name {
private CoreLabel makeCoreLabel(String line) {
CoreLabel wi = new CoreLabel();
// wi.line = line;
String[] bits = line.split("\\s+");
switch (bits.length) {
case 0:
case 1:
wi.setWord(BOUNDARY);
wi.set(AnswerAnnotation.class, OTHER);
break;
case 2:
wi.setWord(bits[0]);
wi.set(AnswerAnnotation.class, bits[1]);
break;
case 3:
wi.setWord(bits[0]);
wi.setTag(bits[1]);
wi.set(AnswerAnnotation.class, bits[2]);
break;
case 4:
wi.setWord(bits[0]);
wi.setTag(bits[1]);
wi.set(ChunkAnnotation.class, bits[2]);
wi.set(AnswerAnnotation.class, bits[3]);
break;
case 5:
if (flags.useLemmaAsWord) {
wi.setWord(bits[1]);
// depends on control dependency: [if], data = [none]
} else {
wi.setWord(bits[0]);
// depends on control dependency: [if], data = [none]
}
wi.set(LemmaAnnotation.class, bits[1]);
wi.setTag(bits[2]);
wi.set(ChunkAnnotation.class, bits[3]);
wi.set(AnswerAnnotation.class, bits[4]);
break;
default:
throw new RuntimeIOException("Unexpected input (many fields): " + line);
}
wi.set(OriginalAnswerAnnotation.class, wi.get(AnswerAnnotation.class));
return wi;
} }
|
public class class_name {
private static void getColumnList(Table t, int[] col, int len,
StringBuffer a) {
a.append('(');
for (int i = 0; i < len; i++) {
a.append(t.getColumn(col[i]).getName().statementName);
if (i < len - 1) {
a.append(',');
}
}
a.append(')');
} }
|
public class class_name {
private static void getColumnList(Table t, int[] col, int len,
StringBuffer a) {
a.append('(');
for (int i = 0; i < len; i++) {
a.append(t.getColumn(col[i]).getName().statementName); // depends on control dependency: [for], data = [i]
if (i < len - 1) {
a.append(','); // depends on control dependency: [if], data = [none]
}
}
a.append(')');
} }
|
public class class_name {
private void parseRec(BitSet traversed, BitSet extension, BitSet forbidden) {
BitSet newTraversed = null;
BitSet newExtension = null;
BitSet newForbidden = null;
BitSet potentialNode = null;
// Test whether the timeout is reached. Stop searching.
if (this.timeout > -1 && (System.currentTimeMillis() - this.start) > this.timeout) {
stop = true;
}
// if there is no more extension possible we
// have reached a potential new solution
if (extension.isEmpty()) {
solution(traversed);
}
// carry on with each possible extension
else {
// calculates the set of nodes that may still
// be reached at this stage (not forbidden)
potentialNode = ((BitSet) graphBitSet.clone());
potentialNode.andNot(forbidden);
potentialNode.or(traversed);
// checks if we must continue the search
// according to the potential node set
if (mustContinue(potentialNode)) {
// carry on research and update iteration count
nbIteration++;
// for each node in the set of possible extension (neighbors of
// the current partial solution, include the node to the solution
// and parse recursively the RGraph with the new context.
for (int x = extension.nextSetBit(0); x >= 0 && !stop; x = extension.nextSetBit(x + 1)) {
// evaluates the new set of forbidden nodes
// by including the nodes not compatible with the
// newly accepted node.
newForbidden = (BitSet) forbidden.clone();
newForbidden.or(((RNode) graph.get(x)).forbidden);
// if it is the first time we are here then
// traversed is empty and we initialize the set of
// possible extensions to the extension of the first
// accepted node in the solution.
if (traversed.isEmpty()) {
newExtension = (BitSet) (((RNode) graph.get(x)).extension.clone());
}
// else we simply update the set of solution by
// including the neighbors of the newly accepted node
else {
newExtension = (BitSet) extension.clone();
newExtension.or(((RNode) graph.get(x)).extension);
}
// extension my not contain forbidden nodes
newExtension.andNot(newForbidden);
// create the new set of traversed node
// (update current partial solution)
// and add x to the set of forbidden node
// (a node may only appear once in a solution)
newTraversed = (BitSet) traversed.clone();
newTraversed.set(x);
forbidden.set(x);
// parse recursively the RGraph
parseRec(newTraversed, newExtension, newForbidden);
}
}
}
} }
|
public class class_name {
private void parseRec(BitSet traversed, BitSet extension, BitSet forbidden) {
BitSet newTraversed = null;
BitSet newExtension = null;
BitSet newForbidden = null;
BitSet potentialNode = null;
// Test whether the timeout is reached. Stop searching.
if (this.timeout > -1 && (System.currentTimeMillis() - this.start) > this.timeout) {
stop = true; // depends on control dependency: [if], data = [none]
}
// if there is no more extension possible we
// have reached a potential new solution
if (extension.isEmpty()) {
solution(traversed); // depends on control dependency: [if], data = [none]
}
// carry on with each possible extension
else {
// calculates the set of nodes that may still
// be reached at this stage (not forbidden)
potentialNode = ((BitSet) graphBitSet.clone()); // depends on control dependency: [if], data = [none]
potentialNode.andNot(forbidden); // depends on control dependency: [if], data = [none]
potentialNode.or(traversed); // depends on control dependency: [if], data = [none]
// checks if we must continue the search
// according to the potential node set
if (mustContinue(potentialNode)) {
// carry on research and update iteration count
nbIteration++; // depends on control dependency: [if], data = [none]
// for each node in the set of possible extension (neighbors of
// the current partial solution, include the node to the solution
// and parse recursively the RGraph with the new context.
for (int x = extension.nextSetBit(0); x >= 0 && !stop; x = extension.nextSetBit(x + 1)) {
// evaluates the new set of forbidden nodes
// by including the nodes not compatible with the
// newly accepted node.
newForbidden = (BitSet) forbidden.clone(); // depends on control dependency: [for], data = [none]
newForbidden.or(((RNode) graph.get(x)).forbidden); // depends on control dependency: [for], data = [x]
// if it is the first time we are here then
// traversed is empty and we initialize the set of
// possible extensions to the extension of the first
// accepted node in the solution.
if (traversed.isEmpty()) {
newExtension = (BitSet) (((RNode) graph.get(x)).extension.clone()); // depends on control dependency: [if], data = [none]
}
// else we simply update the set of solution by
// including the neighbors of the newly accepted node
else {
newExtension = (BitSet) extension.clone(); // depends on control dependency: [if], data = [none]
newExtension.or(((RNode) graph.get(x)).extension); // depends on control dependency: [if], data = [none]
}
// extension my not contain forbidden nodes
newExtension.andNot(newForbidden); // depends on control dependency: [for], data = [none]
// create the new set of traversed node
// (update current partial solution)
// and add x to the set of forbidden node
// (a node may only appear once in a solution)
newTraversed = (BitSet) traversed.clone(); // depends on control dependency: [for], data = [none]
newTraversed.set(x); // depends on control dependency: [for], data = [x]
forbidden.set(x); // depends on control dependency: [for], data = [x]
// parse recursively the RGraph
parseRec(newTraversed, newExtension, newForbidden); // depends on control dependency: [for], data = [none]
}
}
}
} }
|
public class class_name {
public Observable<ServiceResponse<Page<VpnConnectionInner>>> listByVpnGatewayNextWithServiceResponseAsync(final String nextPageLink) {
return listByVpnGatewayNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<VpnConnectionInner>>, Observable<ServiceResponse<Page<VpnConnectionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<VpnConnectionInner>>> call(ServiceResponse<Page<VpnConnectionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByVpnGatewayNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<VpnConnectionInner>>> listByVpnGatewayNextWithServiceResponseAsync(final String nextPageLink) {
return listByVpnGatewayNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<VpnConnectionInner>>, Observable<ServiceResponse<Page<VpnConnectionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<VpnConnectionInner>>> call(ServiceResponse<Page<VpnConnectionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listByVpnGatewayNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
@Modified
protected void modified(ComponentContext context,
Map<String, Object> properties) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "modified", new Object[] { context,
properties });
}
try {
// If ME is stopped we start it again.This happens when ME might have
// not started during activate() and user changes the server.xml, we
// attempt to start it again(thinking user have reactified any
// server.xml issue if any )
if (service.getMeState().equals(ME_STATE.STOPPED.toString())) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.debug(tc, "Starting ME", service.getMeState());
SibTr.info(tc, "RESTART_ME_SIAS0106");
service.activate(context, properties, configAdminRef.getService());
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.debug(tc, "Modifying the configuration", service
.getMeState());
service.modified(context, properties, configAdminRef.getService());
}
} catch (Exception e) {
SibTr.exception(tc, e);
FFDCFilter.processException(e, this.getClass().getName(), "187", this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "modified");
}
} }
|
public class class_name {
@Modified
protected void modified(ComponentContext context,
Map<String, Object> properties) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "modified", new Object[] { context,
properties }); // depends on control dependency: [if], data = [none]
}
try {
// If ME is stopped we start it again.This happens when ME might have
// not started during activate() and user changes the server.xml, we
// attempt to start it again(thinking user have reactified any
// server.xml issue if any )
if (service.getMeState().equals(ME_STATE.STOPPED.toString())) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.debug(tc, "Starting ME", service.getMeState());
SibTr.info(tc, "RESTART_ME_SIAS0106"); // depends on control dependency: [if], data = [none]
service.activate(context, properties, configAdminRef.getService()); // depends on control dependency: [if], data = [none]
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.debug(tc, "Modifying the configuration", service
.getMeState());
service.modified(context, properties, configAdminRef.getService()); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
SibTr.exception(tc, e);
FFDCFilter.processException(e, this.getClass().getName(), "187", this);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "modified"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void draw(){
if (!mIsVisible)
return;
try {
MapView.LayoutParams lp = new MapView.LayoutParams(
MapView.LayoutParams.WRAP_CONTENT,
MapView.LayoutParams.WRAP_CONTENT,
mPosition, MapView.LayoutParams.BOTTOM_CENTER,
mOffsetX, mOffsetY);
mMapView.updateViewLayout(mView, lp); // supposed to work only on the UI Thread
} catch(Exception e) {
if (MapSnapshot.isUIThread()) {
throw e;
}
// in order to avoid a CalledFromWrongThreadException crash
}
} }
|
public class class_name {
public void draw(){
if (!mIsVisible)
return;
try {
MapView.LayoutParams lp = new MapView.LayoutParams(
MapView.LayoutParams.WRAP_CONTENT,
MapView.LayoutParams.WRAP_CONTENT,
mPosition, MapView.LayoutParams.BOTTOM_CENTER,
mOffsetX, mOffsetY);
mMapView.updateViewLayout(mView, lp); // supposed to work only on the UI Thread // depends on control dependency: [try], data = [none]
} catch(Exception e) {
if (MapSnapshot.isUIThread()) {
throw e;
}
// in order to avoid a CalledFromWrongThreadException crash
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String getActualProgress() {
try {
CmsProgressThread thread;
if (getProgressThread(getKey()) != null) {
thread = m_threads.get(getKey());
if (thread.isAlive()) {
// wait the configured time until to update the progress the first time
if (thread.getRuntime() < getShowWaitTime()) {
while ((thread.getRuntime() < getShowWaitTime()) && (thread.isAlive())) {
synchronized (this) {
wait(500);
}
}
} else {
// wait the configured refresh rate before returning
synchronized (this) {
wait(getRefreshRate());
}
}
}
if (!thread.isAlive()) {
// is an error occurred in the execution of the thread?
if (thread.getError() != null) {
return createError(
Messages.get().getBundle(getJsp().getRequestContext().getLocale()).key(
Messages.GUI_PROGRESS_ERROR_IN_THREAD_0),
thread.getError());
}
// return the result of the list created in the progress
return thread.getResult();
}
// create and return the actual progress in percent with the description to be shown
StringBuffer result = new StringBuffer();
result.append("PRO");
result.append(thread.getProgress());
result.append("%");
result.append("|");
result.append(thread.getDescription());
return result.toString();
} else {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_PROGRESS_THREAD_NOT_FOUND_1, getKey()));
}
return createError(Messages.get().getBundle(getJsp().getRequestContext().getLocale()).key(
Messages.GUI_PROGRESS_THREAD_NOT_FOUND_1,
getKey()));
}
} catch (Throwable t) {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_PROGRESS_ERROR_CALC_PROGRESS_0), t);
}
return createError(
Messages.get().getBundle(getJsp().getRequestContext().getLocale()).key(
Messages.GUI_PROGRESS_ERROR_CALCULATING_0),
t);
}
} }
|
public class class_name {
public String getActualProgress() {
try {
CmsProgressThread thread;
if (getProgressThread(getKey()) != null) {
thread = m_threads.get(getKey()); // depends on control dependency: [if], data = [none]
if (thread.isAlive()) {
// wait the configured time until to update the progress the first time
if (thread.getRuntime() < getShowWaitTime()) {
while ((thread.getRuntime() < getShowWaitTime()) && (thread.isAlive())) {
synchronized (this) { // depends on control dependency: [while], data = [none]
wait(500);
}
}
} else {
// wait the configured refresh rate before returning
synchronized (this) { // depends on control dependency: [if], data = [none]
wait(getRefreshRate());
}
}
}
if (!thread.isAlive()) {
// is an error occurred in the execution of the thread?
if (thread.getError() != null) {
return createError(
Messages.get().getBundle(getJsp().getRequestContext().getLocale()).key(
Messages.GUI_PROGRESS_ERROR_IN_THREAD_0),
thread.getError()); // depends on control dependency: [if], data = [none]
}
// return the result of the list created in the progress
return thread.getResult(); // depends on control dependency: [if], data = [none]
}
// create and return the actual progress in percent with the description to be shown
StringBuffer result = new StringBuffer();
result.append("PRO"); // depends on control dependency: [if], data = [none]
result.append(thread.getProgress()); // depends on control dependency: [if], data = [none]
result.append("%"); // depends on control dependency: [if], data = [none]
result.append("|"); // depends on control dependency: [if], data = [none]
result.append(thread.getDescription()); // depends on control dependency: [if], data = [none]
return result.toString(); // depends on control dependency: [if], data = [none]
} else {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_PROGRESS_THREAD_NOT_FOUND_1, getKey())); // depends on control dependency: [if], data = [none]
}
return createError(Messages.get().getBundle(getJsp().getRequestContext().getLocale()).key(
Messages.GUI_PROGRESS_THREAD_NOT_FOUND_1,
getKey())); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
if (LOG.isErrorEnabled()) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_PROGRESS_ERROR_CALC_PROGRESS_0), t); // depends on control dependency: [if], data = [none]
}
return createError(
Messages.get().getBundle(getJsp().getRequestContext().getLocale()).key(
Messages.GUI_PROGRESS_ERROR_CALCULATING_0),
t);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setOrientation(int orientation) {
if (orientation != HORIZONTAL && orientation != VERTICAL) {
throw new IllegalArgumentException("invalid orientation.");
}
if (mPendingSavedState != null && mPendingSavedState.mOrientation != orientation) {
// override pending state
mPendingSavedState.mOrientation = orientation;
}
if (orientation == mOrientation) {
return;
}
mOrientation = orientation;
mOrientationHelper = null;
requestLayout();
} }
|
public class class_name {
public void setOrientation(int orientation) {
if (orientation != HORIZONTAL && orientation != VERTICAL) {
throw new IllegalArgumentException("invalid orientation.");
}
if (mPendingSavedState != null && mPendingSavedState.mOrientation != orientation) {
// override pending state
mPendingSavedState.mOrientation = orientation; // depends on control dependency: [if], data = [none]
}
if (orientation == mOrientation) {
return; // depends on control dependency: [if], data = [none]
}
mOrientation = orientation;
mOrientationHelper = null;
requestLayout();
} }
|
public class class_name {
public String [] get(final String name) {
if(has(name)) {
List<String> values = headers.get(name).getValues();
return values.toArray(new String [values.size()]);
}
else
return null;
} }
|
public class class_name {
public String [] get(final String name) {
if(has(name)) {
List<String> values = headers.get(name).getValues();
return values.toArray(new String [values.size()]); // depends on control dependency: [if], data = [none]
}
else
return null;
} }
|
public class class_name {
public void callDestroyMethods() {
for (final DestroyMethodPoint destroyMethodPoint : beanDefinition.destroyMethodPoints()) {
try {
destroyMethodPoint.method.invoke(bean);
} catch (Exception ex) {
throw new PetiteException("Invalid destroy method: " + destroyMethodPoint.method, ex);
}
}
} }
|
public class class_name {
public void callDestroyMethods() {
for (final DestroyMethodPoint destroyMethodPoint : beanDefinition.destroyMethodPoints()) {
try {
destroyMethodPoint.method.invoke(bean); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw new PetiteException("Invalid destroy method: " + destroyMethodPoint.method, ex);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public void setNull(long[] mask) {
for (int maskPos = 0, i = 0; i < this.numFields;) {
long currMask = mask[maskPos];
for (int k = 64; i < this.numFields && k > 0; --k, i++, currMask >>>= 1) {
if ((currMask & 0x1) != 0) {
internallySetField(i, null);
}
}
}
} }
|
public class class_name {
public void setNull(long[] mask) {
for (int maskPos = 0, i = 0; i < this.numFields;) {
long currMask = mask[maskPos];
for (int k = 64; i < this.numFields && k > 0; --k, i++, currMask >>>= 1) {
if ((currMask & 0x1) != 0) {
internallySetField(i, null); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
@Around("@annotation(retryableAnnotation)")
public Object call(final ProceedingJoinPoint pjp, Retryable retryableAnnotation) throws Throwable {
final int maxTries = retryableAnnotation.maxTries();
final int retryDelayMillies = retryableAnnotation.retryDelayMillis();
final Class<? extends Throwable>[] retryOn = retryableAnnotation.retryOn();
final boolean doubleDelay = retryableAnnotation.doubleDelay();
final boolean throwCauseException = retryableAnnotation.throwCauseException();
if (logger.isDebugEnabled()) {
logger.debug("Have @Retryable method wrapping call on method {} of target object {}",
new Object[] {
pjp.getSignature().getName(),
pjp.getTarget()
});
}
ServiceRetrier serviceRetrier =
new ServiceRetrier(retryDelayMillies, maxTries, doubleDelay, throwCauseException, retryOn);
return serviceRetrier.invoke(
new Callable<Object>() {
public Object call() throws Exception {
try {
return pjp.proceed();
}
catch (Exception e) {
throw e;
}
catch (Error e) {
throw e;
}
catch (Throwable t) {
throw new RuntimeException(t);
}
}
}
);
} }
|
public class class_name {
@Around("@annotation(retryableAnnotation)")
public Object call(final ProceedingJoinPoint pjp, Retryable retryableAnnotation) throws Throwable {
final int maxTries = retryableAnnotation.maxTries();
final int retryDelayMillies = retryableAnnotation.retryDelayMillis();
final Class<? extends Throwable>[] retryOn = retryableAnnotation.retryOn();
final boolean doubleDelay = retryableAnnotation.doubleDelay();
final boolean throwCauseException = retryableAnnotation.throwCauseException();
if (logger.isDebugEnabled()) {
logger.debug("Have @Retryable method wrapping call on method {} of target object {}",
new Object[] {
pjp.getSignature().getName(),
pjp.getTarget()
});
}
ServiceRetrier serviceRetrier =
new ServiceRetrier(retryDelayMillies, maxTries, doubleDelay, throwCauseException, retryOn);
return serviceRetrier.invoke(
new Callable<Object>() {
public Object call() throws Exception {
try {
return pjp.proceed(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw e;
} // depends on control dependency: [catch], data = [none]
catch (Error e) {
throw e;
} // depends on control dependency: [catch], data = [none]
catch (Throwable t) {
throw new RuntimeException(t);
} // depends on control dependency: [catch], data = [none]
}
}
);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T osgiPropertyToObject(Object value, Class<T> type, T defaultValue) {
// only selected parameter types are supported
if (type == String.class) {
return (T)PropertiesUtil.toString(value, (String)defaultValue);
}
if (type == String[].class) {
return (T)decodeString(PropertiesUtil.toStringArray(value, (String[])defaultValue));
}
else if (type == Integer.class) {
Integer defaultIntValue = (Integer)defaultValue;
if (defaultIntValue == null) {
defaultIntValue = 0;
}
return (T)(Integer)PropertiesUtil.toInteger(value, defaultIntValue);
}
else if (type == Long.class) {
Long defaultLongValue = (Long)defaultValue;
if (defaultLongValue == null) {
defaultLongValue = 0L;
}
return (T)(Long)PropertiesUtil.toLong(value, defaultLongValue);
}
else if (type == Double.class) {
Double defaultDoubleValue = (Double)defaultValue;
if (defaultDoubleValue == null) {
defaultDoubleValue = 0d;
}
return (T)(Double)PropertiesUtil.toDouble(value, defaultDoubleValue);
}
else if (type == Boolean.class) {
Boolean defaultBooleanValue = (Boolean)defaultValue;
if (defaultBooleanValue == null) {
defaultBooleanValue = false;
}
return (T)(Boolean)PropertiesUtil.toBoolean(value, defaultBooleanValue);
}
else if (type == Map.class) {
Map<?, ?> defaultMap = (Map)defaultValue;
String[] defaultMapValue;
if (defaultMap == null) {
defaultMapValue = new String[0];
}
else {
defaultMapValue = new String[defaultMap.size()];
Map.Entry<?, ?>[] entries = Iterators.toArray(defaultMap.entrySet().iterator(), Map.Entry.class);
for (int i = 0; i < entries.length; i++) {
defaultMapValue[i] = encodeString(Objects.toString(entries[i].getKey(), ""))
+ KEY_VALUE_DELIMITER + encodeString(Objects.toString(entries[i].getValue(), ""));
}
}
String[] rawMap = PropertiesUtil.toStringArray(value, defaultMapValue);
Map<String, String> finalMap = new HashMap<String, String>(rawMap.length);
for (int i = 0; i < rawMap.length; i++) {
String[] keyValue = splitPreserveAllTokens(rawMap[i], KEY_VALUE_DELIMITER_CHAR);
if (keyValue.length == 2 && StringUtils.isNotEmpty(keyValue[0])) {
finalMap.put(decodeString(keyValue[0]), StringUtils.isEmpty(keyValue[1]) ? null : decodeString(keyValue[1]));
}
}
return (T)finalMap;
}
throw new IllegalArgumentException("Unsupported type: " + type.getName());
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T osgiPropertyToObject(Object value, Class<T> type, T defaultValue) {
// only selected parameter types are supported
if (type == String.class) {
return (T)PropertiesUtil.toString(value, (String)defaultValue); // depends on control dependency: [if], data = [none]
}
if (type == String[].class) {
return (T)decodeString(PropertiesUtil.toStringArray(value, (String[])defaultValue)); // depends on control dependency: [if], data = [none]
}
else if (type == Integer.class) {
Integer defaultIntValue = (Integer)defaultValue;
if (defaultIntValue == null) {
defaultIntValue = 0; // depends on control dependency: [if], data = [none]
}
return (T)(Integer)PropertiesUtil.toInteger(value, defaultIntValue); // depends on control dependency: [if], data = [none]
}
else if (type == Long.class) {
Long defaultLongValue = (Long)defaultValue;
if (defaultLongValue == null) {
defaultLongValue = 0L; // depends on control dependency: [if], data = [none]
}
return (T)(Long)PropertiesUtil.toLong(value, defaultLongValue); // depends on control dependency: [if], data = [none]
}
else if (type == Double.class) {
Double defaultDoubleValue = (Double)defaultValue;
if (defaultDoubleValue == null) {
defaultDoubleValue = 0d; // depends on control dependency: [if], data = [none]
}
return (T)(Double)PropertiesUtil.toDouble(value, defaultDoubleValue); // depends on control dependency: [if], data = [none]
}
else if (type == Boolean.class) {
Boolean defaultBooleanValue = (Boolean)defaultValue;
if (defaultBooleanValue == null) {
defaultBooleanValue = false; // depends on control dependency: [if], data = [none]
}
return (T)(Boolean)PropertiesUtil.toBoolean(value, defaultBooleanValue); // depends on control dependency: [if], data = [none]
}
else if (type == Map.class) {
Map<?, ?> defaultMap = (Map)defaultValue; // depends on control dependency: [if], data = [none]
String[] defaultMapValue;
if (defaultMap == null) {
defaultMapValue = new String[0]; // depends on control dependency: [if], data = [none]
}
else {
defaultMapValue = new String[defaultMap.size()]; // depends on control dependency: [if], data = [none]
Map.Entry<?, ?>[] entries = Iterators.toArray(defaultMap.entrySet().iterator(), Map.Entry.class);
for (int i = 0; i < entries.length; i++) {
defaultMapValue[i] = encodeString(Objects.toString(entries[i].getKey(), ""))
+ KEY_VALUE_DELIMITER + encodeString(Objects.toString(entries[i].getValue(), "")); // depends on control dependency: [for], data = [i]
}
}
String[] rawMap = PropertiesUtil.toStringArray(value, defaultMapValue);
Map<String, String> finalMap = new HashMap<String, String>(rawMap.length);
for (int i = 0; i < rawMap.length; i++) {
String[] keyValue = splitPreserveAllTokens(rawMap[i], KEY_VALUE_DELIMITER_CHAR);
if (keyValue.length == 2 && StringUtils.isNotEmpty(keyValue[0])) {
finalMap.put(decodeString(keyValue[0]), StringUtils.isEmpty(keyValue[1]) ? null : decodeString(keyValue[1])); // depends on control dependency: [if], data = [none]
}
}
return (T)finalMap; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("Unsupported type: " + type.getName());
} }
|
public class class_name {
public String getSessionid(boolean create) {
String sessionid = getCookie(SESSIONID_NAME, null);
if (create && (sessionid == null || sessionid.isEmpty())) {
sessionid = context.createSessionid();
this.newsessionid = sessionid;
}
return sessionid;
} }
|
public class class_name {
public String getSessionid(boolean create) {
String sessionid = getCookie(SESSIONID_NAME, null);
if (create && (sessionid == null || sessionid.isEmpty())) {
sessionid = context.createSessionid();
// depends on control dependency: [if], data = [none]
this.newsessionid = sessionid;
// depends on control dependency: [if], data = [none]
}
return sessionid;
} }
|
public class class_name {
private static DTDecisionRule toDecisionRule(EvaluationContext mainCtx, FEEL embeddedFEEL, int index, List<?> rule, int inputSize) {
// TODO should be check indeed block of inputSize n inputs, followed by block of outputs.
DTDecisionRule dr = new DTDecisionRule( index );
for ( int i = 0; i < rule.size(); i++ ) {
Object o = rule.get( i );
if ( i < inputSize ) {
dr.getInputEntry().add( toUnaryTest( mainCtx, o ) );
} else {
FEELEventListener ruleListener = event -> mainCtx.notifyEvt( () -> new FEELEventBase(event.getSeverity(),
Msg.createMessage(Msg.ERROR_COMPILE_EXPR_DT_FUNCTION_RULE_IDX, index+1, event.getMessage()),
event.getSourceException()));
embeddedFEEL.addListener(ruleListener);
CompiledExpression compiledExpression = embeddedFEEL.compile((String) o, embeddedFEEL.newCompilerContext());
dr.getOutputEntry().add( compiledExpression );
embeddedFEEL.removeListener(ruleListener);
}
}
return dr;
} }
|
public class class_name {
private static DTDecisionRule toDecisionRule(EvaluationContext mainCtx, FEEL embeddedFEEL, int index, List<?> rule, int inputSize) {
// TODO should be check indeed block of inputSize n inputs, followed by block of outputs.
DTDecisionRule dr = new DTDecisionRule( index );
for ( int i = 0; i < rule.size(); i++ ) {
Object o = rule.get( i );
if ( i < inputSize ) {
dr.getInputEntry().add( toUnaryTest( mainCtx, o ) ); // depends on control dependency: [if], data = [none]
} else {
FEELEventListener ruleListener = event -> mainCtx.notifyEvt( () -> new FEELEventBase(event.getSeverity(),
Msg.createMessage(Msg.ERROR_COMPILE_EXPR_DT_FUNCTION_RULE_IDX, index+1, event.getMessage()),
event.getSourceException()));
embeddedFEEL.addListener(ruleListener); // depends on control dependency: [if], data = [none]
CompiledExpression compiledExpression = embeddedFEEL.compile((String) o, embeddedFEEL.newCompilerContext());
dr.getOutputEntry().add( compiledExpression ); // depends on control dependency: [if], data = [none]
embeddedFEEL.removeListener(ruleListener); // depends on control dependency: [if], data = [none]
}
}
return dr;
} }
|
public class class_name {
public ConstructorInjectionPoint buildInjectionPoint(ASTType containingType, ASTConstructor astConstructor, AnalysisContext context) {
ConstructorInjectionPoint constructorInjectionPoint = new ConstructorInjectionPoint(containingType, astConstructor);
constructorInjectionPoint.addThrows(astConstructor.getThrowsTypes());
List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>();
//bindingAnnotations for single parameter from method level
if (astConstructor.getParameters().size() == 1) {
methodAnnotations.addAll(astConstructor.getAnnotations());
}
for (ASTParameter astParameter : astConstructor.getParameters()) {
List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations);
parameterAnnotations.addAll(astParameter.getAnnotations());
constructorInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context));
}
return constructorInjectionPoint;
} }
|
public class class_name {
public ConstructorInjectionPoint buildInjectionPoint(ASTType containingType, ASTConstructor astConstructor, AnalysisContext context) {
ConstructorInjectionPoint constructorInjectionPoint = new ConstructorInjectionPoint(containingType, astConstructor);
constructorInjectionPoint.addThrows(astConstructor.getThrowsTypes());
List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>();
//bindingAnnotations for single parameter from method level
if (astConstructor.getParameters().size() == 1) {
methodAnnotations.addAll(astConstructor.getAnnotations()); // depends on control dependency: [if], data = [none]
}
for (ASTParameter astParameter : astConstructor.getParameters()) {
List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations);
parameterAnnotations.addAll(astParameter.getAnnotations()); // depends on control dependency: [for], data = [astParameter]
constructorInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context)); // depends on control dependency: [for], data = [astParameter]
}
return constructorInjectionPoint;
} }
|
public class class_name {
protected final IType getDispInterfaceReturnType() {
IType r = method.getReturnType();
// if the return type is HRESULT, bind it to 'void'.
// dispinterfaces defined by C++ often uses HRESULT
// as the return value
IPrimitiveType pt = r.queryInterface(IPrimitiveType.class);
if (pt != null && pt.getVarType() == VarType.VT_HRESULT) {
// TODO: This causes a null pointer exception in some situations!
return null;
}
return r;
} }
|
public class class_name {
protected final IType getDispInterfaceReturnType() {
IType r = method.getReturnType();
// if the return type is HRESULT, bind it to 'void'.
// dispinterfaces defined by C++ often uses HRESULT
// as the return value
IPrimitiveType pt = r.queryInterface(IPrimitiveType.class);
if (pt != null && pt.getVarType() == VarType.VT_HRESULT) {
// TODO: This causes a null pointer exception in some situations!
return null; // depends on control dependency: [if], data = [none]
}
return r;
} }
|
public class class_name {
public float calculate(HELM2Notation helm2notation, int unitType) throws ExtinctionCoefficientException, ChemistryException {
LOG.debug("ExtinctionCalculation is starting with the unitType: " + unitType);
float result = 0.0f;
List<PolymerNotation> polymerNodes = helm2notation.getListOfPolymers();
for (PolymerNotation polymerNode : polymerNodes) {
String polymerType = polymerNode.getPolymerID().getType();
float ext = 0.0f;
ArrayList<PolymerNotation> not = new ArrayList<PolymerNotation>();
not.add(polymerNode);
if (polymerType.equals(Monomer.NUCLIEC_ACID_POLYMER_TYPE)) {
try {
ext = calculateExtinctionFromRNA(MethodsMonomerUtils.getListOfHandledMonomersOnlyBase(polymerNode.getPolymerElements().getListOfElements()));
} catch (CalculationException | IOException | HELM2HandledException | NotationException e) {
throw new ExtinctionCoefficientException(e.getMessage());
}
if (unitType == PEPTIDE_UNIT_TYPE) {
ext = ext * UNIT;
}
} else if (polymerType.equals(Monomer.PEPTIDE_POLYMER_TYPE)) {
try {
ext = calculateExtinctionFromPeptide(MethodsMonomerUtils.getListOfHandledMonomers(polymerNode.getPolymerElements().getListOfElements()));
} catch (IOException | HELM2HandledException e) {
throw new ExtinctionCoefficientException(e.getMessage());
}
if (unitType == RNA_UNIT_TYPE) {
ext = ext / UNIT;
}
}
result = result + ext;
}
return result;
} }
|
public class class_name {
public float calculate(HELM2Notation helm2notation, int unitType) throws ExtinctionCoefficientException, ChemistryException {
LOG.debug("ExtinctionCalculation is starting with the unitType: " + unitType);
float result = 0.0f;
List<PolymerNotation> polymerNodes = helm2notation.getListOfPolymers();
for (PolymerNotation polymerNode : polymerNodes) {
String polymerType = polymerNode.getPolymerID().getType();
float ext = 0.0f;
ArrayList<PolymerNotation> not = new ArrayList<PolymerNotation>();
not.add(polymerNode);
if (polymerType.equals(Monomer.NUCLIEC_ACID_POLYMER_TYPE)) {
try {
ext = calculateExtinctionFromRNA(MethodsMonomerUtils.getListOfHandledMonomersOnlyBase(polymerNode.getPolymerElements().getListOfElements()));
// depends on control dependency: [try], data = [none]
} catch (CalculationException | IOException | HELM2HandledException | NotationException e) {
throw new ExtinctionCoefficientException(e.getMessage());
}
// depends on control dependency: [catch], data = [none]
if (unitType == PEPTIDE_UNIT_TYPE) {
ext = ext * UNIT;
// depends on control dependency: [if], data = [none]
}
} else if (polymerType.equals(Monomer.PEPTIDE_POLYMER_TYPE)) {
try {
ext = calculateExtinctionFromPeptide(MethodsMonomerUtils.getListOfHandledMonomers(polymerNode.getPolymerElements().getListOfElements()));
// depends on control dependency: [try], data = [none]
} catch (IOException | HELM2HandledException e) {
throw new ExtinctionCoefficientException(e.getMessage());
}
// depends on control dependency: [catch], data = [none]
if (unitType == RNA_UNIT_TYPE) {
ext = ext / UNIT;
// depends on control dependency: [if], data = [none]
}
}
result = result + ext;
}
return result;
} }
|
public class class_name {
public static RequestQueue newRequestQueue(Context context) {
HttpStack stack;
if (Build.VERSION.SDK_INT >= 9) {
stack = new HurlStack();
} else {
stack = new HttpClientStack(AndroidHttpClient.newInstance("volley"));
}
return newRequestQueue(context, stack);
} }
|
public class class_name {
public static RequestQueue newRequestQueue(Context context) {
HttpStack stack;
if (Build.VERSION.SDK_INT >= 9) {
stack = new HurlStack(); // depends on control dependency: [if], data = [none]
} else {
stack = new HttpClientStack(AndroidHttpClient.newInstance("volley")); // depends on control dependency: [if], data = [none]
}
return newRequestQueue(context, stack);
} }
|
public class class_name {
@Override
public DatabaseDataType toDatabaseDataType(Database database) {
String originalDefinition = StringUtil.trimToEmpty(getRawDefinition());
// If a fractional precision is given, check is the DBMS supports the length
if (getParameters().length > 0) {
Integer desiredLength = null;
try {
desiredLength = Integer.parseInt(String.valueOf(getParameters()[0]));
} catch (NumberFormatException e) {
// That is ok, we won't touch the parameter in this case.
}
if (desiredLength != null) {
int maxFractionalDigits = database.getMaxFractionalDigitsForTimestamp();
if (maxFractionalDigits < desiredLength) {
throw new DatabaseIncapableOfOperation(
String.format(
"Using a TIMESTAMP data type with a fractional precision of %d", desiredLength
),
String.format(
"A timestamp datatype with %d fractional digits was requested, but %s " +
"only supports %d digits.",
desiredLength,
database.getDatabaseProductName(),
maxFractionalDigits
),
database
);
}
}
}
if (database instanceof MySQLDatabase) {
if (originalDefinition.contains(" ") || originalDefinition.contains("(")) {
return new DatabaseDataType(getRawDefinition());
}
return super.toDatabaseDataType(database);
}
if (database instanceof MSSQLDatabase) {
if (!LiquibaseConfiguration.getInstance()
.getProperty(GlobalConfiguration.class, GlobalConfiguration.CONVERT_DATA_TYPES)
.getValue(Boolean.class)
&& originalDefinition.toLowerCase(Locale.US).startsWith("timestamp")) {
return new DatabaseDataType(database.escapeDataTypeName("timestamp"));
}
return new DatabaseDataType(database.escapeDataTypeName("datetime"));
}
if (database instanceof SybaseDatabase) {
return new DatabaseDataType(database.escapeDataTypeName("datetime"));
}
if (database instanceof AbstractDb2Database) {
Object[] parameters = getParameters();
if ((parameters != null) && (parameters.length > 1)) {
parameters = new Object[] {parameters[1]};
}
return new DatabaseDataType(database.escapeDataTypeName("timestamp"), parameters);
}
/*
* From here on, we assume that we have a SQL standard compliant database that supports the
* TIMESTAMP[(p)] [WITH TIME ZONE|WITHOUT TIME ZONE] syntax. p is the number of fractional digits,
* i.e. if "2017-06-02 23:59:45.123456" is supported by the DBMS, p would be 6.
*/
DatabaseDataType type;
if (getParameters().length > 0) {
int fractionalDigits = 0;
String fractionalDigitsInput = getParameters()[0].toString();
try {
fractionalDigits = Integer.parseInt(fractionalDigitsInput);
} catch (NumberFormatException e) {
throw new RuntimeException(
new ParseException(String.format("A timestamp with '%s' fractional digits was requested, but '%s' does not " +
"seem to be an integer.", fractionalDigitsInput, fractionalDigitsInput))
);
}
int maxFractionalDigits = database.getMaxFractionalDigitsForTimestamp();
if (maxFractionalDigits < fractionalDigits) {
Scope.getCurrentScope().getLog(getClass()).warning(LogType.LOG, String.format(
"A timestamp datatype with %d fractional digits was requested, but the DBMS %s only supports " +
"%d digits. Because of this, the number of digits was reduced to %d.",
fractionalDigits, database.getDatabaseProductName(), maxFractionalDigits, maxFractionalDigits)
);
fractionalDigits = maxFractionalDigits;
}
type = new DatabaseDataType("TIMESTAMP", fractionalDigits);
} else {
type = new DatabaseDataType("TIMESTAMP");
}
if (getAdditionalInformation() != null
&& (database instanceof PostgresDatabase
|| database instanceof OracleDatabase)
|| database instanceof H2Database
|| database instanceof HsqlDatabase){
String additionalInformation = this.getAdditionalInformation();
if (additionalInformation != null) {
String additionInformation = additionalInformation.toUpperCase(Locale.US);
if ((database instanceof PostgresDatabase) && additionInformation.toUpperCase(Locale.US).contains("TIMEZONE")) {
additionalInformation = additionInformation.toUpperCase(Locale.US).replace("TIMEZONE", "TIME ZONE");
}
// CORE-3229 Oracle 11g doesn't support WITHOUT clause in TIMESTAMP data type
if ((database instanceof OracleDatabase) && additionInformation.startsWith("WITHOUT")) {
// https://docs.oracle.com/cd/B19306_01/server.102/b14225/ch4datetime.htm#sthref389
additionalInformation = null;
}
if ((database instanceof H2Database) && additionInformation.startsWith("WITHOUT")) {
// http://www.h2database.com/html/datatypes.html
additionalInformation = null;
}
}
type.addAdditionalInformation(additionalInformation);
return type;
}
return super.toDatabaseDataType(database);
} }
|
public class class_name {
@Override
public DatabaseDataType toDatabaseDataType(Database database) {
String originalDefinition = StringUtil.trimToEmpty(getRawDefinition());
// If a fractional precision is given, check is the DBMS supports the length
if (getParameters().length > 0) {
Integer desiredLength = null;
try {
desiredLength = Integer.parseInt(String.valueOf(getParameters()[0])); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
// That is ok, we won't touch the parameter in this case.
} // depends on control dependency: [catch], data = [none]
if (desiredLength != null) {
int maxFractionalDigits = database.getMaxFractionalDigitsForTimestamp();
if (maxFractionalDigits < desiredLength) {
throw new DatabaseIncapableOfOperation(
String.format(
"Using a TIMESTAMP data type with a fractional precision of %d", desiredLength
),
String.format(
"A timestamp datatype with %d fractional digits was requested, but %s " +
"only supports %d digits.",
desiredLength,
database.getDatabaseProductName(),
maxFractionalDigits
),
database
);
}
}
}
if (database instanceof MySQLDatabase) {
if (originalDefinition.contains(" ") || originalDefinition.contains("(")) {
return new DatabaseDataType(getRawDefinition()); // depends on control dependency: [if], data = [none]
}
return super.toDatabaseDataType(database); // depends on control dependency: [if], data = [none]
}
if (database instanceof MSSQLDatabase) {
if (!LiquibaseConfiguration.getInstance()
.getProperty(GlobalConfiguration.class, GlobalConfiguration.CONVERT_DATA_TYPES)
.getValue(Boolean.class)
&& originalDefinition.toLowerCase(Locale.US).startsWith("timestamp")) {
return new DatabaseDataType(database.escapeDataTypeName("timestamp")); // depends on control dependency: [if], data = [none]
}
return new DatabaseDataType(database.escapeDataTypeName("datetime")); // depends on control dependency: [if], data = [none]
}
if (database instanceof SybaseDatabase) {
return new DatabaseDataType(database.escapeDataTypeName("datetime")); // depends on control dependency: [if], data = [none]
}
if (database instanceof AbstractDb2Database) {
Object[] parameters = getParameters();
if ((parameters != null) && (parameters.length > 1)) {
parameters = new Object[] {parameters[1]}; // depends on control dependency: [if], data = [none]
}
return new DatabaseDataType(database.escapeDataTypeName("timestamp"), parameters); // depends on control dependency: [if], data = [none]
}
/*
* From here on, we assume that we have a SQL standard compliant database that supports the
* TIMESTAMP[(p)] [WITH TIME ZONE|WITHOUT TIME ZONE] syntax. p is the number of fractional digits,
* i.e. if "2017-06-02 23:59:45.123456" is supported by the DBMS, p would be 6.
*/
DatabaseDataType type;
if (getParameters().length > 0) {
int fractionalDigits = 0;
String fractionalDigitsInput = getParameters()[0].toString();
try {
fractionalDigits = Integer.parseInt(fractionalDigitsInput); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new RuntimeException(
new ParseException(String.format("A timestamp with '%s' fractional digits was requested, but '%s' does not " +
"seem to be an integer.", fractionalDigitsInput, fractionalDigitsInput))
);
}
int maxFractionalDigits = database.getMaxFractionalDigitsForTimestamp();
if (maxFractionalDigits < fractionalDigits) {
Scope.getCurrentScope().getLog(getClass()).warning(LogType.LOG, String.format(
"A timestamp datatype with %d fractional digits was requested, but the DBMS %s only supports " +
"%d digits. Because of this, the number of digits was reduced to %d.",
fractionalDigits, database.getDatabaseProductName(), maxFractionalDigits, maxFractionalDigits)
);
fractionalDigits = maxFractionalDigits;
}
type = new DatabaseDataType("TIMESTAMP", fractionalDigits);
} else {
type = new DatabaseDataType("TIMESTAMP");
}
if (getAdditionalInformation() != null
&& (database instanceof PostgresDatabase
|| database instanceof OracleDatabase)
|| database instanceof H2Database
|| database instanceof HsqlDatabase){
String additionalInformation = this.getAdditionalInformation();
if (additionalInformation != null) {
String additionInformation = additionalInformation.toUpperCase(Locale.US);
if ((database instanceof PostgresDatabase) && additionInformation.toUpperCase(Locale.US).contains("TIMEZONE")) {
additionalInformation = additionInformation.toUpperCase(Locale.US).replace("TIMEZONE", "TIME ZONE");
}
// CORE-3229 Oracle 11g doesn't support WITHOUT clause in TIMESTAMP data type
if ((database instanceof OracleDatabase) && additionInformation.startsWith("WITHOUT")) {
// https://docs.oracle.com/cd/B19306_01/server.102/b14225/ch4datetime.htm#sthref389
additionalInformation = null;
}
if ((database instanceof H2Database) && additionInformation.startsWith("WITHOUT")) {
// http://www.h2database.com/html/datatypes.html
additionalInformation = null;
} // depends on control dependency: [catch], data = [none]
}
type.addAdditionalInformation(additionalInformation);
return type;
}
return super.toDatabaseDataType(database);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected void triggerDone(Response<T> resolved) {
for (io.reinert.gdeferred.DoneCallback<T> callback : getDoneCallbacks()) {
try {
if (callback instanceof DoneCallback) {
((DoneCallback) callback).onDone(resolved);
} else {
callback.onDone(resolved.getPayload());
}
} catch (Exception e) {
log.log(Level.SEVERE, "An uncaught exception occurred in a DoneCallback", e);
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected void triggerDone(Response<T> resolved) {
for (io.reinert.gdeferred.DoneCallback<T> callback : getDoneCallbacks()) {
try {
if (callback instanceof DoneCallback) {
((DoneCallback) callback).onDone(resolved); // depends on control dependency: [if], data = [none]
} else {
callback.onDone(resolved.getPayload()); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
log.log(Level.SEVERE, "An uncaught exception occurred in a DoneCallback", e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
private List<AtlasEdge> removeUnusedEntries(AtlasVertex instanceVertex, String edgeLabel,
Collection<AtlasEdge> currentEntries,
Collection<AtlasEdge> newEntries,
IDataType entryType, AttributeInfo attributeInfo) throws AtlasException {
if (currentEntries != null && !currentEntries.isEmpty()) {
LOG.debug("Removing unused entries from the old collection");
if (entryType.getTypeCategory() == TypeCategory.STRUCT
|| entryType.getTypeCategory() == TypeCategory.CLASS) {
//Remove the edges for (current edges - new edges)
List<AtlasEdge> cloneElements = new ArrayList<>(currentEntries);
cloneElements.removeAll(newEntries);
List<AtlasEdge> additionalElements = new ArrayList<>();
if (LOG.isDebugEnabled()) {
LOG.debug("Removing unused entries from the old collection - {}", cloneElements);
}
if (!cloneElements.isEmpty()) {
for (AtlasEdge edge : cloneElements) {
boolean deleted = deleteHandler.deleteEdgeReference(edge, entryType.getTypeCategory(),
attributeInfo.isComposite, true);
if (!deleted) {
additionalElements.add(edge);
}
}
}
return additionalElements;
}
}
return new ArrayList<>();
} }
|
public class class_name {
private List<AtlasEdge> removeUnusedEntries(AtlasVertex instanceVertex, String edgeLabel,
Collection<AtlasEdge> currentEntries,
Collection<AtlasEdge> newEntries,
IDataType entryType, AttributeInfo attributeInfo) throws AtlasException {
if (currentEntries != null && !currentEntries.isEmpty()) {
LOG.debug("Removing unused entries from the old collection");
if (entryType.getTypeCategory() == TypeCategory.STRUCT
|| entryType.getTypeCategory() == TypeCategory.CLASS) {
//Remove the edges for (current edges - new edges)
List<AtlasEdge> cloneElements = new ArrayList<>(currentEntries);
cloneElements.removeAll(newEntries); // depends on control dependency: [if], data = [none]
List<AtlasEdge> additionalElements = new ArrayList<>();
if (LOG.isDebugEnabled()) {
LOG.debug("Removing unused entries from the old collection - {}", cloneElements); // depends on control dependency: [if], data = [none]
}
if (!cloneElements.isEmpty()) {
for (AtlasEdge edge : cloneElements) {
boolean deleted = deleteHandler.deleteEdgeReference(edge, entryType.getTypeCategory(),
attributeInfo.isComposite, true);
if (!deleted) {
additionalElements.add(edge); // depends on control dependency: [if], data = [none]
}
}
}
return additionalElements; // depends on control dependency: [if], data = [none]
}
}
return new ArrayList<>();
} }
|
public class class_name {
public static void toggleKeyPad(Context context) {
InputMethodManager imm = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
} }
|
public class class_name {
public static void toggleKeyPad(Context context) {
InputMethodManager imm = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void refreshFileList()
throws IOException {
FileStatus[] files = fileSystem.globStatus(inputDirectoryAndPattern);
for (FileStatus file : files) {
String fileName = file.getPath().getName();
if (!knownFileSet.contains(fileName)) {
if (endFileNumber != -1) {
// Sanity check against endFileNumber.
int newFileIndex = parseFileIndex(fileName);
Preconditions.checkState(newFileIndex < endFileNumber,
"Found new file '%s' with index %s, which isn't less than endFileNumber %s!",
fileName, newFileIndex, endFileNumber);
}
logger.atInfo().log(
"Adding new file '%s' of size %s to knownFileSet.", fileName, file.getLen());
knownFileSet.add(fileName);
fileQueue.add(file);
}
}
} }
|
public class class_name {
private void refreshFileList()
throws IOException {
FileStatus[] files = fileSystem.globStatus(inputDirectoryAndPattern);
for (FileStatus file : files) {
String fileName = file.getPath().getName();
if (!knownFileSet.contains(fileName)) {
if (endFileNumber != -1) {
// Sanity check against endFileNumber.
int newFileIndex = parseFileIndex(fileName);
Preconditions.checkState(newFileIndex < endFileNumber,
"Found new file '%s' with index %s, which isn't less than endFileNumber %s!",
fileName, newFileIndex, endFileNumber); // depends on control dependency: [if], data = [none]
}
logger.atInfo().log(
"Adding new file '%s' of size %s to knownFileSet.", fileName, file.getLen()); // depends on control dependency: [if], data = [none]
knownFileSet.add(fileName); // depends on control dependency: [if], data = [none]
fileQueue.add(file); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public A set(Iterable<Property> props) {
if (Iterables.isEmpty(props)) {
return (A) this;
}
return copy(delegate.put("data", Property.toArrayNode(props)));
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public A set(Iterable<Property> props) {
if (Iterables.isEmpty(props)) {
return (A) this; // depends on control dependency: [if], data = [none]
}
return copy(delegate.put("data", Property.toArrayNode(props)));
} }
|
public class class_name {
public ModifyReplicationGroupRequest withCacheSecurityGroupNames(String... cacheSecurityGroupNames) {
if (this.cacheSecurityGroupNames == null) {
setCacheSecurityGroupNames(new com.amazonaws.internal.SdkInternalList<String>(cacheSecurityGroupNames.length));
}
for (String ele : cacheSecurityGroupNames) {
this.cacheSecurityGroupNames.add(ele);
}
return this;
} }
|
public class class_name {
public ModifyReplicationGroupRequest withCacheSecurityGroupNames(String... cacheSecurityGroupNames) {
if (this.cacheSecurityGroupNames == null) {
setCacheSecurityGroupNames(new com.amazonaws.internal.SdkInternalList<String>(cacheSecurityGroupNames.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : cacheSecurityGroupNames) {
this.cacheSecurityGroupNames.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
protected void doUpdateBeanValue(final Object value) {
String beanProperty = getBeanProperty();
if (beanProperty != null && beanProperty.length() > 0 && !".".equals(beanProperty)) {
Object bean = getBean();
if (bean != null) {
try {
Object beanValue = getBeanValue();
if (!Util.equals(beanValue, value)) {
PropertyUtils.setProperty(bean, beanProperty, value);
}
} catch (Exception e) {
LOG.error("Failed to set bean property " + beanProperty + " on " + bean);
}
}
}
} }
|
public class class_name {
protected void doUpdateBeanValue(final Object value) {
String beanProperty = getBeanProperty();
if (beanProperty != null && beanProperty.length() > 0 && !".".equals(beanProperty)) {
Object bean = getBean();
if (bean != null) {
try {
Object beanValue = getBeanValue();
if (!Util.equals(beanValue, value)) {
PropertyUtils.setProperty(bean, beanProperty, value); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LOG.error("Failed to set bean property " + beanProperty + " on " + bean);
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
private static String removeCStyleComments(String ddl)
{
// Avoid Apache commons StringUtils.join() to minimize client dependencies.
StringBuilder sb = new StringBuilder();
for (String part : PAT_STRIP_CSTYLE_COMMENTS.split(ddl)) {
sb.append(part);
}
return sb.toString();
} }
|
public class class_name {
private static String removeCStyleComments(String ddl)
{
// Avoid Apache commons StringUtils.join() to minimize client dependencies.
StringBuilder sb = new StringBuilder();
for (String part : PAT_STRIP_CSTYLE_COMMENTS.split(ddl)) {
sb.append(part); // depends on control dependency: [for], data = [part]
}
return sb.toString();
} }
|
public class class_name {
public static RuntimeException unchecked(final Throwable t) {
if (t instanceof RuntimeException) {
return (RuntimeException) t;
} else {
return new RuntimeException(t);
}
} }
|
public class class_name {
public static RuntimeException unchecked(final Throwable t) {
if (t instanceof RuntimeException) {
return (RuntimeException) t; // depends on control dependency: [if], data = [none]
} else {
return new RuntimeException(t); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static AceRights parseValue(final int value) {
final AceRights res = new AceRights();
if (value == 0) {
return res;
}
res.others = value;
for (ObjectRight type : ObjectRight.values()) {
if ((value & type.getValue()) == type.getValue()) {
res.rights.add(type);
res.others ^= type.getValue();
}
}
return res;
} }
|
public class class_name {
public static AceRights parseValue(final int value) {
final AceRights res = new AceRights();
if (value == 0) {
return res; // depends on control dependency: [if], data = [none]
}
res.others = value;
for (ObjectRight type : ObjectRight.values()) {
if ((value & type.getValue()) == type.getValue()) {
res.rights.add(type); // depends on control dependency: [if], data = [none]
res.others ^= type.getValue(); // depends on control dependency: [if], data = [none]
}
}
return res;
} }
|
public class class_name {
public static String getParameter(DbConn cnx, String key, String defaultValue)
{
try
{
return cnx.runSelectSingle("globalprm_select_by_key", 3, String.class, key);
}
catch (NoResultException e)
{
return defaultValue;
}
} }
|
public class class_name {
public static String getParameter(DbConn cnx, String key, String defaultValue)
{
try
{
return cnx.runSelectSingle("globalprm_select_by_key", 3, String.class, key); // depends on control dependency: [try], data = [none]
}
catch (NoResultException e)
{
return defaultValue;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void closeOnEscape () {
addListener(new InputListener() {
@Override
public boolean keyDown (InputEvent event, int keycode) {
if (keycode == Keys.ESCAPE) {
close();
return true;
}
return false;
}
@Override
public boolean keyUp (InputEvent event, int keycode) {
if (keycode == Keys.BACK) {
close();
return true;
}
return false;
}
});
} }
|
public class class_name {
public void closeOnEscape () {
addListener(new InputListener() {
@Override
public boolean keyDown (InputEvent event, int keycode) {
if (keycode == Keys.ESCAPE) {
close(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
}
@Override
public boolean keyUp (InputEvent event, int keycode) {
if (keycode == Keys.BACK) {
close(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
}
});
} }
|
public class class_name {
public static void waitForProcessOutput(Process self, Appendable output, Appendable error) {
Thread tout = consumeProcessOutputStream(self, output);
Thread terr = consumeProcessErrorStream(self, error);
try { tout.join(); } catch (InterruptedException ignore) {}
try { terr.join(); } catch (InterruptedException ignore) {}
try { self.waitFor(); } catch (InterruptedException ignore) {}
closeStreams(self);
} }
|
public class class_name {
public static void waitForProcessOutput(Process self, Appendable output, Appendable error) {
Thread tout = consumeProcessOutputStream(self, output);
Thread terr = consumeProcessErrorStream(self, error);
try { tout.join(); } catch (InterruptedException ignore) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
try { terr.join(); } catch (InterruptedException ignore) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
try { self.waitFor(); } catch (InterruptedException ignore) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
closeStreams(self);
} }
|
public class class_name {
public synchronized void printConfigValues(String testName) {
if (baseConfig.isEmpty()) {
return;
}
StringBuilder builder = new StringBuilder(String.format("Configuration for <%s>: {", testName));
boolean isFirst = true;
for (ConfigProperty configProperty : ConfigProperty.values()) {
if (!isFirst) {
builder.append(", ");
}
String value = getConfigProperty(configProperty);
builder.append(String.format("(%s: %s)", configProperty, value));
isFirst = false;
}
builder.append("}\n");
SeLionLogger.getLogger().info(builder.toString());
} }
|
public class class_name {
public synchronized void printConfigValues(String testName) {
if (baseConfig.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
StringBuilder builder = new StringBuilder(String.format("Configuration for <%s>: {", testName));
boolean isFirst = true;
for (ConfigProperty configProperty : ConfigProperty.values()) {
if (!isFirst) {
builder.append(", "); // depends on control dependency: [if], data = [none]
}
String value = getConfigProperty(configProperty);
builder.append(String.format("(%s: %s)", configProperty, value)); // depends on control dependency: [for], data = [configProperty]
isFirst = false; // depends on control dependency: [for], data = [none]
}
builder.append("}\n");
SeLionLogger.getLogger().info(builder.toString());
} }
|
public class class_name {
public static long getLongWithCurrentDate(String value, String timezone) {
if (Strings.isNullOrEmpty(value)) {
return 0;
}
DateTime time = getCurrentTime(timezone);
DateTimeFormatter dtFormatter = DateTimeFormat.forPattern(CURRENT_DATE_FORMAT).withZone(time.getZone());
if (value.toUpperCase().startsWith(CURRENT_DAY)) {
return Long
.parseLong(dtFormatter.print(time.minusDays(Integer.parseInt(value.substring(CURRENT_DAY.length() + 1)))));
}
if (value.toUpperCase().startsWith(CURRENT_HOUR)) {
return Long
.parseLong(dtFormatter.print(time.minusHours(Integer.parseInt(value.substring(CURRENT_HOUR.length() + 1)))));
}
return Long.parseLong(value);
} }
|
public class class_name {
public static long getLongWithCurrentDate(String value, String timezone) {
if (Strings.isNullOrEmpty(value)) {
return 0; // depends on control dependency: [if], data = [none]
}
DateTime time = getCurrentTime(timezone);
DateTimeFormatter dtFormatter = DateTimeFormat.forPattern(CURRENT_DATE_FORMAT).withZone(time.getZone());
if (value.toUpperCase().startsWith(CURRENT_DAY)) {
return Long
.parseLong(dtFormatter.print(time.minusDays(Integer.parseInt(value.substring(CURRENT_DAY.length() + 1))))); // depends on control dependency: [if], data = [none]
}
if (value.toUpperCase().startsWith(CURRENT_HOUR)) {
return Long
.parseLong(dtFormatter.print(time.minusHours(Integer.parseInt(value.substring(CURRENT_HOUR.length() + 1))))); // depends on control dependency: [if], data = [none]
}
return Long.parseLong(value);
} }
|
public class class_name {
public Map<Object, Object> getAttributes() {
if (null == attributes) {
attributes = new HashMap<Object,Object>();
}
return attributes;
} }
|
public class class_name {
public Map<Object, Object> getAttributes() {
if (null == attributes) {
attributes = new HashMap<Object,Object>(); // depends on control dependency: [if], data = [none]
}
return attributes;
} }
|
public class class_name {
public void setCursorPos(int pos) {
cursorPos = pos;
if (cursorPos > value.length()) {
cursorPos = value.length();
}
} }
|
public class class_name {
public void setCursorPos(int pos) {
cursorPos = pos;
if (cursorPos > value.length()) {
cursorPos = value.length();
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void setValue(Object instance, String propertyName, Object value) {
if (!isWriteIgnored(instance, propertyName)) {
PropertyProxyUtils.getPropertyAccessor(this.conversionService, this.useDirectFieldAccess, instance).setPropertyValue(propertyName, value);
}
} }
|
public class class_name {
@Override
public void setValue(Object instance, String propertyName, Object value) {
if (!isWriteIgnored(instance, propertyName)) {
PropertyProxyUtils.getPropertyAccessor(this.conversionService, this.useDirectFieldAccess, instance).setPropertyValue(propertyName, value); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected synchronized ExecutorService getExecutorService(String stageName) {
if (executorServiceFactory != null) {
return executorServiceFactory.getExecutorService(stageName);
}
// TODO: Use a default executor? Drive on current thread? Throw exception?
return null;
} }
|
public class class_name {
protected synchronized ExecutorService getExecutorService(String stageName) {
if (executorServiceFactory != null) {
return executorServiceFactory.getExecutorService(stageName); // depends on control dependency: [if], data = [none]
}
// TODO: Use a default executor? Drive on current thread? Throw exception?
return null;
} }
|
public class class_name {
public void mark(int readlimit) {
abortIfNeeded();
if (log.isDebugEnabled()) {
log.debug("Input stream marked at " + bytesReadPastMark + " bytes");
}
if (bytesReadPastMark <= bufferSize && buffer != null) {
/*
* Clear buffer of already-read data to make more space. It's safe
* to cast bytesReadPastMark to an int because it is known to be
* less than bufferSize, which is an int.
*/
byte[] newBuffer = new byte[this.bufferSize];
System.arraycopy(buffer, bufferOffset, newBuffer, 0, (int)(bytesReadPastMark - bufferOffset));
this.buffer = newBuffer;
this.bytesReadPastMark -= bufferOffset;
this.bufferOffset = 0;
} else {
// If mark is called after the buffer was already exceeded, create a new buffer.
this.bufferOffset = 0;
this.bytesReadPastMark = 0;
this.buffer = new byte[this.bufferSize];
}
} }
|
public class class_name {
public void mark(int readlimit) {
abortIfNeeded();
if (log.isDebugEnabled()) {
log.debug("Input stream marked at " + bytesReadPastMark + " bytes"); // depends on control dependency: [if], data = [none]
}
if (bytesReadPastMark <= bufferSize && buffer != null) {
/*
* Clear buffer of already-read data to make more space. It's safe
* to cast bytesReadPastMark to an int because it is known to be
* less than bufferSize, which is an int.
*/
byte[] newBuffer = new byte[this.bufferSize];
System.arraycopy(buffer, bufferOffset, newBuffer, 0, (int)(bytesReadPastMark - bufferOffset)); // depends on control dependency: [if], data = [none]
this.buffer = newBuffer; // depends on control dependency: [if], data = [none]
this.bytesReadPastMark -= bufferOffset; // depends on control dependency: [if], data = [none]
this.bufferOffset = 0; // depends on control dependency: [if], data = [none]
} else {
// If mark is called after the buffer was already exceeded, create a new buffer.
this.bufferOffset = 0; // depends on control dependency: [if], data = [none]
this.bytesReadPastMark = 0; // depends on control dependency: [if], data = [none]
this.buffer = new byte[this.bufferSize]; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static URI getResourceURI(String classpath) {
try {
return getResourceURL(classpath).toURI();
} catch (Exception e) {
return JMExceptionManager.handleExceptionAndReturnNull(log, e,
"getResourceURI", classpath);
}
} }
|
public class class_name {
public static URI getResourceURI(String classpath) {
try {
return getResourceURL(classpath).toURI(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return JMExceptionManager.handleExceptionAndReturnNull(log, e,
"getResourceURI", classpath);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void percolateDown(int pos) {
int p = pos;
int y = this.heap.get(p);
while (left(p) < this.heap.size()) {
int child = right(p) < this.heap.size() && this.s.lt(this.heap.get(right(p)), this.heap.get(left(p))) ? right(p) : left(p);
if (!this.s.lt(this.heap.get(child), y))
break;
this.heap.set(p, this.heap.get(child));
this.indices.set(this.heap.get(p), p);
p = child;
}
this.heap.set(p, y);
this.indices.set(y, p);
} }
|
public class class_name {
private void percolateDown(int pos) {
int p = pos;
int y = this.heap.get(p);
while (left(p) < this.heap.size()) {
int child = right(p) < this.heap.size() && this.s.lt(this.heap.get(right(p)), this.heap.get(left(p))) ? right(p) : left(p);
if (!this.s.lt(this.heap.get(child), y))
break;
this.heap.set(p, this.heap.get(child)); // depends on control dependency: [while], data = [none]
this.indices.set(this.heap.get(p), p); // depends on control dependency: [while], data = [none]
p = child; // depends on control dependency: [while], data = [none]
}
this.heap.set(p, y);
this.indices.set(y, p);
} }
|
public class class_name {
public void setSourceAlgorithms(java.util.Collection<SourceAlgorithm> sourceAlgorithms) {
if (sourceAlgorithms == null) {
this.sourceAlgorithms = null;
return;
}
this.sourceAlgorithms = new java.util.ArrayList<SourceAlgorithm>(sourceAlgorithms);
} }
|
public class class_name {
public void setSourceAlgorithms(java.util.Collection<SourceAlgorithm> sourceAlgorithms) {
if (sourceAlgorithms == null) {
this.sourceAlgorithms = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.sourceAlgorithms = new java.util.ArrayList<SourceAlgorithm>(sourceAlgorithms);
} }
|
public class class_name {
private void createIntervalList(){
synchronized(intervalLock){
if (_cachedIntervalInfos!=null)
return;
List<Interval> intervals = intervalRegistry.getIntervals();
_cachedIntervalInfos = new ArrayList<IntervalInfo>(intervals.size());
for (Interval interval : intervals) {
_cachedIntervalInfos.add(new IntervalInfo(interval));
interval.addSecondaryIntervalListener(this);
}
}
} }
|
public class class_name {
private void createIntervalList(){
synchronized(intervalLock){
if (_cachedIntervalInfos!=null)
return;
List<Interval> intervals = intervalRegistry.getIntervals();
_cachedIntervalInfos = new ArrayList<IntervalInfo>(intervals.size());
for (Interval interval : intervals) {
_cachedIntervalInfos.add(new IntervalInfo(interval)); // depends on control dependency: [for], data = [interval]
interval.addSecondaryIntervalListener(this); // depends on control dependency: [for], data = [interval]
}
}
} }
|
public class class_name {
public SwaggerMethodParser methodParser(Method swaggerMethod) {
SwaggerMethodParser result = methodParsers.get(swaggerMethod);
if (result == null) {
result = new SwaggerMethodParser(swaggerMethod, serializer, host());
methodParsers.put(swaggerMethod, result);
}
return result;
} }
|
public class class_name {
public SwaggerMethodParser methodParser(Method swaggerMethod) {
SwaggerMethodParser result = methodParsers.get(swaggerMethod);
if (result == null) {
result = new SwaggerMethodParser(swaggerMethod, serializer, host()); // depends on control dependency: [if], data = [none]
methodParsers.put(swaggerMethod, result); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public void setParmsToDirectBuffer() {
if (oByteBuffer.isDirect()) {
this.oWsBBDirect = this.oByteBuffer;
return;
}
if (oWsBBDirect == null) {
this.oWsBBDirect = ByteBuffer.allocateDirect(oByteBuffer.capacity());
}
// set the position and limit
this.oWsBBDirect.limit(oByteBuffer.limit());
this.oWsBBDirect.position(oByteBuffer.position());
} }
|
public class class_name {
public void setParmsToDirectBuffer() {
if (oByteBuffer.isDirect()) {
this.oWsBBDirect = this.oByteBuffer; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (oWsBBDirect == null) {
this.oWsBBDirect = ByteBuffer.allocateDirect(oByteBuffer.capacity()); // depends on control dependency: [if], data = [none]
}
// set the position and limit
this.oWsBBDirect.limit(oByteBuffer.limit());
this.oWsBBDirect.position(oByteBuffer.position());
} }
|
public class class_name {
public Collection<UserProfile> findUserProfiles() throws Exception
{
List<UserProfile> profiles = new ArrayList<UserProfile>();
Session session = service.getStorageSession();
try
{
NodeIterator userNodes = utils.getUsersStorageNode(session).getNodes();
while (userNodes.hasNext())
{
Node userNode = userNodes.nextNode();
String userName = userNode.getName();
Node profileNode;
try
{
profileNode = userNode.getNode(JCROrganizationServiceImpl.JOS_PROFILE);
}
catch (PathNotFoundException e)
{
continue;
}
UserProfile profile = readProfile(userName, profileNode);
if (profile != null)
{
profiles.add(profile);
}
}
}
finally
{
session.logout();
}
return profiles;
} }
|
public class class_name {
public Collection<UserProfile> findUserProfiles() throws Exception
{
List<UserProfile> profiles = new ArrayList<UserProfile>();
Session session = service.getStorageSession();
try
{
NodeIterator userNodes = utils.getUsersStorageNode(session).getNodes();
while (userNodes.hasNext())
{
Node userNode = userNodes.nextNode();
String userName = userNode.getName();
Node profileNode;
try
{
profileNode = userNode.getNode(JCROrganizationServiceImpl.JOS_PROFILE); // depends on control dependency: [try], data = [none]
}
catch (PathNotFoundException e)
{
continue;
} // depends on control dependency: [catch], data = [none]
UserProfile profile = readProfile(userName, profileNode);
if (profile != null)
{
profiles.add(profile); // depends on control dependency: [if], data = [(profile]
}
}
}
finally
{
session.logout();
}
return profiles;
} }
|
public class class_name {
protected int fill(RecyclerView.Recycler recycler, LayoutState layoutState,
RecyclerView.State state, boolean stopOnFocusable) {
// max offset we should set is mFastScroll + available
final int start = layoutState.mAvailable;
if (layoutState.mScrollingOffset != LayoutState.SCOLLING_OFFSET_NaN) {
// TODO ugly bug fix. should not happen
if (layoutState.mAvailable < 0) {
layoutState.mScrollingOffset += layoutState.mAvailable;
}
recycleByLayoutStateExpose(recycler, layoutState);
}
int remainingSpace = layoutState.mAvailable + layoutState.mExtra + recycleOffset;
while (remainingSpace > 0 && layoutState.hasMore(state)) {
layoutChunkResultCache.resetInternal();
layoutChunk(recycler, state, layoutState, layoutChunkResultCache);
if (layoutChunkResultCache.mFinished) {
break;
}
layoutState.mOffset += layoutChunkResultCache.mConsumed * layoutState.mLayoutDirection;
/**
* Consume the available space if:
* * layoutChunk did not request to be ignored
* * OR we are laying out scrap children
* * OR we are not doing pre-layout
*/
if (!layoutChunkResultCache.mIgnoreConsumed || mLayoutState.mScrapList != null
|| !state.isPreLayout()) {
layoutState.mAvailable -= layoutChunkResultCache.mConsumed;
// we keep a separate remaining space because mAvailable is important for recycling
remainingSpace -= layoutChunkResultCache.mConsumed;
}
if (layoutState.mScrollingOffset != LayoutState.SCOLLING_OFFSET_NaN) {
layoutState.mScrollingOffset += layoutChunkResultCache.mConsumed;
if (layoutState.mAvailable < 0) {
layoutState.mScrollingOffset += layoutState.mAvailable;
}
recycleByLayoutStateExpose(recycler, layoutState);
}
if (stopOnFocusable && layoutChunkResultCache.mFocusable) {
break;
}
}
if (DEBUG) {
validateChildOrderExpose();
}
return start - layoutState.mAvailable;
} }
|
public class class_name {
protected int fill(RecyclerView.Recycler recycler, LayoutState layoutState,
RecyclerView.State state, boolean stopOnFocusable) {
// max offset we should set is mFastScroll + available
final int start = layoutState.mAvailable;
if (layoutState.mScrollingOffset != LayoutState.SCOLLING_OFFSET_NaN) {
// TODO ugly bug fix. should not happen
if (layoutState.mAvailable < 0) {
layoutState.mScrollingOffset += layoutState.mAvailable; // depends on control dependency: [if], data = [none]
}
recycleByLayoutStateExpose(recycler, layoutState); // depends on control dependency: [if], data = [none]
}
int remainingSpace = layoutState.mAvailable + layoutState.mExtra + recycleOffset;
while (remainingSpace > 0 && layoutState.hasMore(state)) {
layoutChunkResultCache.resetInternal(); // depends on control dependency: [while], data = [none]
layoutChunk(recycler, state, layoutState, layoutChunkResultCache); // depends on control dependency: [while], data = [none]
if (layoutChunkResultCache.mFinished) {
break;
}
layoutState.mOffset += layoutChunkResultCache.mConsumed * layoutState.mLayoutDirection; // depends on control dependency: [while], data = [none]
/**
* Consume the available space if:
* * layoutChunk did not request to be ignored
* * OR we are laying out scrap children
* * OR we are not doing pre-layout
*/
if (!layoutChunkResultCache.mIgnoreConsumed || mLayoutState.mScrapList != null
|| !state.isPreLayout()) {
layoutState.mAvailable -= layoutChunkResultCache.mConsumed; // depends on control dependency: [if], data = [none]
// we keep a separate remaining space because mAvailable is important for recycling
remainingSpace -= layoutChunkResultCache.mConsumed; // depends on control dependency: [if], data = [none]
}
if (layoutState.mScrollingOffset != LayoutState.SCOLLING_OFFSET_NaN) {
layoutState.mScrollingOffset += layoutChunkResultCache.mConsumed; // depends on control dependency: [if], data = [none]
if (layoutState.mAvailable < 0) {
layoutState.mScrollingOffset += layoutState.mAvailable; // depends on control dependency: [if], data = [none]
}
recycleByLayoutStateExpose(recycler, layoutState); // depends on control dependency: [if], data = [none]
}
if (stopOnFocusable && layoutChunkResultCache.mFocusable) {
break;
}
}
if (DEBUG) {
validateChildOrderExpose(); // depends on control dependency: [if], data = [none]
}
return start - layoutState.mAvailable;
} }
|
public class class_name {
public void setBindings( Collection<VarBindingDef> bindings)
{
bindings_ = new HashMap<VarDef,VarBindingDef>();
properties_ = new PropertySet();
if( bindings != null)
{
for( VarBindingDef binding : bindings)
{
add( binding);
}
}
} }
|
public class class_name {
public void setBindings( Collection<VarBindingDef> bindings)
{
bindings_ = new HashMap<VarDef,VarBindingDef>();
properties_ = new PropertySet();
if( bindings != null)
{
for( VarBindingDef binding : bindings)
{
add( binding); // depends on control dependency: [for], data = [binding]
}
}
} }
|
public class class_name {
public static void getMapWidgetInfo(final String applicationId, final String mapId, final String name,
final WidgetConfigurationCallback callback) {
if (!CONFIG.containsKey(applicationId)) {
if (addCallback(applicationId, new DelayedCallback(mapId, name, callback))) {
configurationLoader.loadClientApplicationInfo(applicationId, SETTER);
}
} else {
execute(applicationId, mapId, name, callback);
}
} }
|
public class class_name {
public static void getMapWidgetInfo(final String applicationId, final String mapId, final String name,
final WidgetConfigurationCallback callback) {
if (!CONFIG.containsKey(applicationId)) {
if (addCallback(applicationId, new DelayedCallback(mapId, name, callback))) {
configurationLoader.loadClientApplicationInfo(applicationId, SETTER); // depends on control dependency: [if], data = [none]
}
} else {
execute(applicationId, mapId, name, callback); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Object getInjectValue(String string) {
Matcher m = pattern.matcher(string);
StringBuffer sb = new StringBuffer();
// Parse the content inside pattern "${}" when this pattern is found
while (m.find()) {
// Get parsing result
Object value = getValue(m.group(1));
// Return directly when the parsing result don't need to be casted to String
if (!(value instanceof String)) {
return value;
}
m.appendReplacement(sb, (String) value);
}
return m.appendTail(sb).toString();
} }
|
public class class_name {
public static Object getInjectValue(String string) {
Matcher m = pattern.matcher(string);
StringBuffer sb = new StringBuffer();
// Parse the content inside pattern "${}" when this pattern is found
while (m.find()) {
// Get parsing result
Object value = getValue(m.group(1));
// Return directly when the parsing result don't need to be casted to String
if (!(value instanceof String)) {
return value; // depends on control dependency: [if], data = [none]
}
m.appendReplacement(sb, (String) value); // depends on control dependency: [while], data = [none]
}
return m.appendTail(sb).toString();
} }
|
public class class_name {
private TableName snapshotExists(String snapshotName,
List<SnapshotDescription> snapshotDescriptions) {
if (snapshotDescriptions != null) {
Optional<SnapshotDescription> descriptor =
snapshotDescriptions.stream()
.filter(desc -> desc.getName().equals(snapshotName))
.findFirst();
return descriptor.isPresent() ? descriptor.get().getTableName() : null;
}
return null;
} }
|
public class class_name {
private TableName snapshotExists(String snapshotName,
List<SnapshotDescription> snapshotDescriptions) {
if (snapshotDescriptions != null) {
Optional<SnapshotDescription> descriptor =
snapshotDescriptions.stream()
.filter(desc -> desc.getName().equals(snapshotName))
.findFirst();
return descriptor.isPresent() ? descriptor.get().getTableName() : null; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void marshall(PersonDetail personDetail, ProtocolMarshaller protocolMarshaller) {
if (personDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(personDetail.getIndex(), INDEX_BINDING);
protocolMarshaller.marshall(personDetail.getBoundingBox(), BOUNDINGBOX_BINDING);
protocolMarshaller.marshall(personDetail.getFace(), FACE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PersonDetail personDetail, ProtocolMarshaller protocolMarshaller) {
if (personDetail == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(personDetail.getIndex(), INDEX_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(personDetail.getBoundingBox(), BOUNDINGBOX_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(personDetail.getFace(), FACE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void activateSnapping(List<SnappingRuleInfo> rules, SnapMode mode) {
if (rules != null) {
snapper = new Snapper(mapWidget.getMapModel(), rules, mode);
snappingActive = true;
}
} }
|
public class class_name {
public void activateSnapping(List<SnappingRuleInfo> rules, SnapMode mode) {
if (rules != null) {
snapper = new Snapper(mapWidget.getMapModel(), rules, mode); // depends on control dependency: [if], data = [none]
snappingActive = true; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static AtomTypeFactory getInstance(String configFile, IChemObjectBuilder builder) {
if (tables == null) {
tables = new Hashtable<String, AtomTypeFactory>();
}
if (!(tables.containsKey(configFile))) {
tables.put(configFile, new AtomTypeFactory(configFile, builder));
}
return tables.get(configFile);
} }
|
public class class_name {
public static AtomTypeFactory getInstance(String configFile, IChemObjectBuilder builder) {
if (tables == null) {
tables = new Hashtable<String, AtomTypeFactory>(); // depends on control dependency: [if], data = [none]
}
if (!(tables.containsKey(configFile))) {
tables.put(configFile, new AtomTypeFactory(configFile, builder)); // depends on control dependency: [if], data = [none]
}
return tables.get(configFile);
} }
|
public class class_name {
public Impl embedded(CharSequence ref, Resource resource) {
if (StringUtils.isNotEmpty(ref) && resource != null) {
List<Resource> resources = this.embeddedMap.computeIfAbsent(ref, charSequence -> new ArrayList<>());
resources.add(resource);
}
return (Impl) this;
} }
|
public class class_name {
public Impl embedded(CharSequence ref, Resource resource) {
if (StringUtils.isNotEmpty(ref) && resource != null) {
List<Resource> resources = this.embeddedMap.computeIfAbsent(ref, charSequence -> new ArrayList<>());
resources.add(resource); // depends on control dependency: [if], data = [none]
}
return (Impl) this;
} }
|
public class class_name {
public static final Number parseExtendedAttributeCurrency(String value)
{
Number result;
if (value == null)
{
result = null;
}
else
{
result = NumberHelper.getDouble(Double.parseDouble(correctNumberFormat(value)) / 100);
}
return result;
} }
|
public class class_name {
public static final Number parseExtendedAttributeCurrency(String value)
{
Number result;
if (value == null)
{
result = null; // depends on control dependency: [if], data = [none]
}
else
{
result = NumberHelper.getDouble(Double.parseDouble(correctNumberFormat(value)) / 100); // depends on control dependency: [if], data = [(value]
}
return result;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.