code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public Map<FieldDescriptor, Object> getAllFields() {
TreeMap<FieldDescriptor, Object> result = new TreeMap<FieldDescriptor, Object>();
for (final FieldDescriptor field : metadata.descriptor.getFields()) {
if (hasField(field)) {
result.put(field, getField(field));
}
}
return Collections.unmodifiableMap(result);
} } | public class class_name {
@Override
public Map<FieldDescriptor, Object> getAllFields() {
TreeMap<FieldDescriptor, Object> result = new TreeMap<FieldDescriptor, Object>();
for (final FieldDescriptor field : metadata.descriptor.getFields()) {
if (hasField(field)) {
result.put(field, getField(field)); // depends on control dependency: [if], data = [none]
}
}
return Collections.unmodifiableMap(result);
} } |
public class class_name {
@Override
public void checkParameterizedTerm(final Term term) throws SemanticWarning {
final FunctionEnum funcEnum = term.getFunctionEnum();
// Construct the signature
final StringBuilder bldr = new StringBuilder();
bldr.append(funcEnum.getDisplayValue());
bldr.append("(");
List<BELObject> functionArguments = term.getFunctionArguments();
if (hasItems(functionArguments)) {
for (int i = 0; i < functionArguments.size(); i++) {
final BELObject bo = functionArguments.get(i);
String arg = null;
if (bo instanceof Parameter) {
arg = processParameter((Parameter) bo);
} else if (bo instanceof Term) {
arg = processTerm((Term) bo);
if (arg == null) continue;
} else {
String type = bo.getClass().getName();
final String err = "unknown function argument " + type;
throw new UnsupportedOperationException(err);
}
if (i != 0) bldr.append(",");
bldr.append(arg);
}
}
bldr.append(")");
bldr.append(funcEnum.getReturnType().getDisplayValue());
Signature sig = null;
try {
sig = new Signature(bldr.toString());
} catch (InvalidArgument e) {
final String lf = term.toBELLongForm();
final String err = e.getMessage();
throw new SemanticWarning(lf, err);
}
final Function function = funcEnum.getFunction();
if (!function.validSignature(sig)) {
final Map<Signature, SemanticStatus> map = function.getStatus(sig);
final String lf = term.toBELLongForm();
final String err = format(SEMANTIC_TERM_FAILURE, lf);
throw new SemanticWarning(null, err, sig, map);
}
} } | public class class_name {
@Override
public void checkParameterizedTerm(final Term term) throws SemanticWarning {
final FunctionEnum funcEnum = term.getFunctionEnum();
// Construct the signature
final StringBuilder bldr = new StringBuilder();
bldr.append(funcEnum.getDisplayValue());
bldr.append("(");
List<BELObject> functionArguments = term.getFunctionArguments();
if (hasItems(functionArguments)) {
for (int i = 0; i < functionArguments.size(); i++) {
final BELObject bo = functionArguments.get(i);
String arg = null;
if (bo instanceof Parameter) {
arg = processParameter((Parameter) bo); // depends on control dependency: [if], data = [none]
} else if (bo instanceof Term) {
arg = processTerm((Term) bo); // depends on control dependency: [if], data = [none]
if (arg == null) continue;
} else {
String type = bo.getClass().getName();
final String err = "unknown function argument " + type;
throw new UnsupportedOperationException(err);
}
if (i != 0) bldr.append(",");
bldr.append(arg); // depends on control dependency: [for], data = [none]
}
}
bldr.append(")");
bldr.append(funcEnum.getReturnType().getDisplayValue());
Signature sig = null;
try {
sig = new Signature(bldr.toString());
} catch (InvalidArgument e) {
final String lf = term.toBELLongForm();
final String err = e.getMessage();
throw new SemanticWarning(lf, err);
}
final Function function = funcEnum.getFunction();
if (!function.validSignature(sig)) {
final Map<Signature, SemanticStatus> map = function.getStatus(sig);
final String lf = term.toBELLongForm();
final String err = format(SEMANTIC_TERM_FAILURE, lf);
throw new SemanticWarning(null, err, sig, map);
}
} } |
public class class_name {
public void setPrefixListIds(java.util.Collection<String> prefixListIds) {
if (prefixListIds == null) {
this.prefixListIds = null;
return;
}
this.prefixListIds = new com.amazonaws.internal.SdkInternalList<String>(prefixListIds);
} } | public class class_name {
public void setPrefixListIds(java.util.Collection<String> prefixListIds) {
if (prefixListIds == null) {
this.prefixListIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.prefixListIds = new com.amazonaws.internal.SdkInternalList<String>(prefixListIds);
} } |
public class class_name {
public static JSONArray copy(final JSONArray src) {
final JSONArray dest = new JSONArray();
final int len = src.length();
for (int i = 0; i < len; ++i) {
dest.put(src.opt(i));
}
return dest;
} } | public class class_name {
public static JSONArray copy(final JSONArray src) {
final JSONArray dest = new JSONArray();
final int len = src.length();
for (int i = 0; i < len; ++i) {
dest.put(src.opt(i)); // depends on control dependency: [for], data = [i]
}
return dest;
} } |
public class class_name {
public static String getStaticResourceUri(String resourceName, String versionInfo) {
resourceName = CmsStaticResourceHandler.removeStaticResourcePrefix(resourceName);
String uri = CmsStringUtil.joinPaths(OpenCms.getSystemInfo().getStaticResourceContext(), resourceName);
if (versionInfo != null) {
uri += "?v=" + versionInfo;
}
return uri;
} } | public class class_name {
public static String getStaticResourceUri(String resourceName, String versionInfo) {
resourceName = CmsStaticResourceHandler.removeStaticResourcePrefix(resourceName);
String uri = CmsStringUtil.joinPaths(OpenCms.getSystemInfo().getStaticResourceContext(), resourceName);
if (versionInfo != null) {
uri += "?v=" + versionInfo; // depends on control dependency: [if], data = [none]
}
return uri;
} } |
public class class_name {
public List<Rule> getAllActiveOfficeRules() {
List<Rule> rules = new ArrayList<>();
List<Rule> rulesActive = new ArrayList<>();
rules.addAll(builtinRules);
rules.addAll(userRules);
for (Rule rule : rules) {
if (!ignoreRule(rule) && !rule.isOfficeDefaultOff()) {
rulesActive.add(rule);
} else if (rule.isOfficeDefaultOn()) {
rulesActive.add(rule);
enableRule(rule.getId());
} else if (!ignoreRule(rule) && rule.isOfficeDefaultOff()) {
disableRule(rule.getId());
}
}
return rulesActive;
} } | public class class_name {
public List<Rule> getAllActiveOfficeRules() {
List<Rule> rules = new ArrayList<>();
List<Rule> rulesActive = new ArrayList<>();
rules.addAll(builtinRules);
rules.addAll(userRules);
for (Rule rule : rules) {
if (!ignoreRule(rule) && !rule.isOfficeDefaultOff()) {
rulesActive.add(rule); // depends on control dependency: [if], data = [none]
} else if (rule.isOfficeDefaultOn()) {
rulesActive.add(rule); // depends on control dependency: [if], data = [none]
enableRule(rule.getId()); // depends on control dependency: [if], data = [none]
} else if (!ignoreRule(rule) && rule.isOfficeDefaultOff()) {
disableRule(rule.getId()); // depends on control dependency: [if], data = [none]
}
}
return rulesActive;
} } |
public class class_name {
public static Field getField(Class<?> clazz, String fieldName)
{
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}
catch(NoSuchFieldException e) {
throw new NoSuchBeingException(e);
}
catch(SecurityException e) {
throw new BugError(e);
}
} } | public class class_name {
public static Field getField(Class<?> clazz, String fieldName)
{
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
// depends on control dependency: [try], data = [none]
return field;
// depends on control dependency: [try], data = [none]
}
catch(NoSuchFieldException e) {
throw new NoSuchBeingException(e);
}
// depends on control dependency: [catch], data = [none]
catch(SecurityException e) {
throw new BugError(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean loadRemote() {
for (URI itemToLoad : remoteResources) {
try {
return load(itemToLoad, false);
} catch (Exception e) {
LOG.log(Level.INFO, "Failed to load resource: " + itemToLoad, e);
}
}
return false;
} } | public class class_name {
public boolean loadRemote() {
for (URI itemToLoad : remoteResources) {
try {
return load(itemToLoad, false); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.log(Level.INFO, "Failed to load resource: " + itemToLoad, e);
} // depends on control dependency: [catch], data = [none]
}
return false;
} } |
public class class_name {
public static List<ByteBuffer> cloneByteBufferList(List<ByteBuffer> source) {
List<ByteBuffer> ret = new ArrayList<>(source.size());
for (ByteBuffer b : source) {
ret.add(cloneByteBuffer(b));
}
return ret;
} } | public class class_name {
public static List<ByteBuffer> cloneByteBufferList(List<ByteBuffer> source) {
List<ByteBuffer> ret = new ArrayList<>(source.size());
for (ByteBuffer b : source) {
ret.add(cloneByteBuffer(b)); // depends on control dependency: [for], data = [b]
}
return ret;
} } |
public class class_name {
public void add(final Condition condition) {
if (andConditions.isEmpty()) {
andConditions.add(new AndCondition());
}
andConditions.get(0).getConditions().add(condition);
} } | public class class_name {
public void add(final Condition condition) {
if (andConditions.isEmpty()) {
andConditions.add(new AndCondition()); // depends on control dependency: [if], data = [none]
}
andConditions.get(0).getConditions().add(condition);
} } |
public class class_name {
protected void
finishR(DapNode node)
{
if(ce != null && !ce.references(node)) return;
switch (node.getSort()) {
case DIMENSION:
this.alldimensions.add((DapDimension) node);
break;
case ENUMERATION:
this.allenums.add((DapEnumeration) node);
break;
case SEQUENCE:
case STRUCTURE:
this.allcompounds.add((DapStructure)node);
break;
case VARIABLE:
if(node.isTopLevel())
this.topvariables.add((DapVariable) node);
this.allvariables.add((DapVariable) node);
break;
case GROUP:
case DATASET:
DapGroup g = (DapGroup) node;
this.allgroups.add(g);
for(DapNode subnode : g.getDecls()) {
finishR(subnode);
}
break;
default: /*ignore*/
break;
}
} } | public class class_name {
protected void
finishR(DapNode node)
{
if(ce != null && !ce.references(node)) return;
switch (node.getSort()) {
case DIMENSION:
this.alldimensions.add((DapDimension) node);
break;
case ENUMERATION:
this.allenums.add((DapEnumeration) node);
break;
case SEQUENCE:
case STRUCTURE:
this.allcompounds.add((DapStructure)node);
break;
case VARIABLE:
if(node.isTopLevel())
this.topvariables.add((DapVariable) node);
this.allvariables.add((DapVariable) node);
break;
case GROUP:
case DATASET:
DapGroup g = (DapGroup) node;
this.allgroups.add(g);
for(DapNode subnode : g.getDecls()) {
finishR(subnode); // depends on control dependency: [for], data = [subnode]
}
break;
default: /*ignore*/
break;
}
} } |
public class class_name {
@Override
public boolean hasSameRules(TimeZone other) {
if (this == other) {
return true;
}
if (other instanceof VTimeZone) {
return tz.hasSameRules(((VTimeZone)other).tz);
}
return tz.hasSameRules(other);
} } | public class class_name {
@Override
public boolean hasSameRules(TimeZone other) {
if (this == other) {
return true; // depends on control dependency: [if], data = [none]
}
if (other instanceof VTimeZone) {
return tz.hasSameRules(((VTimeZone)other).tz); // depends on control dependency: [if], data = [none]
}
return tz.hasSameRules(other);
} } |
public class class_name {
void fillPage(final int position) {
if (Constants.DEBUG) {
Log.d("InfiniteViewPager", "setup Page " + position);
printPageModels("before newPage");
}
final PageModel<T> oldModel = mPageModels[position];
final PageModel<T> newModel = createPageModel(position);
if (oldModel == null || newModel == null) {
Log.w(Constants.LOG_TAG, "fillPage no model found " + oldModel + " " + newModel);
return;
}
// moving the new created views to the page of the viewpager
oldModel.removeAllChildren();
for (final View newChild : newModel.getChildren()) {
newModel.removeViewFromParent(newChild);
oldModel.addChild(newChild);
}
mPageModels[position].setIndicator(newModel.getIndicator());
} } | public class class_name {
void fillPage(final int position) {
if (Constants.DEBUG) {
Log.d("InfiniteViewPager", "setup Page " + position); // depends on control dependency: [if], data = [none]
printPageModels("before newPage"); // depends on control dependency: [if], data = [none]
}
final PageModel<T> oldModel = mPageModels[position];
final PageModel<T> newModel = createPageModel(position);
if (oldModel == null || newModel == null) {
Log.w(Constants.LOG_TAG, "fillPage no model found " + oldModel + " " + newModel); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// moving the new created views to the page of the viewpager
oldModel.removeAllChildren();
for (final View newChild : newModel.getChildren()) {
newModel.removeViewFromParent(newChild); // depends on control dependency: [for], data = [newChild]
oldModel.addChild(newChild); // depends on control dependency: [for], data = [newChild]
}
mPageModels[position].setIndicator(newModel.getIndicator());
} } |
public class class_name {
public void initialize() throws SQLException {
if (!Boolean.parseBoolean(System.getProperty(AUTO_CREATE_TABLES))) {
return;
}
if (configuredDaos == null) {
throw new SQLException("configuredDaos was not set in " + getClass().getSimpleName());
}
// find all of the daos and create the tables
for (Dao<?, ?> dao : configuredDaos) {
Class<?> clazz = dao.getDataClass();
try {
DatabaseTableConfig<?> tableConfig = null;
if (dao instanceof BaseDaoImpl) {
tableConfig = ((BaseDaoImpl<?, ?>) dao).getTableConfig();
}
if (tableConfig == null) {
tableConfig = DatabaseTableConfig.fromClass(connectionSource.getDatabaseType(), clazz);
}
TableUtils.createTable(connectionSource, tableConfig);
createdClasses.add(tableConfig);
} catch (Exception e) {
// we don't stop because the table might already exist
System.err.println("Was unable to auto-create table for " + clazz);
e.printStackTrace();
}
}
} } | public class class_name {
public void initialize() throws SQLException {
if (!Boolean.parseBoolean(System.getProperty(AUTO_CREATE_TABLES))) {
return;
}
if (configuredDaos == null) {
throw new SQLException("configuredDaos was not set in " + getClass().getSimpleName());
}
// find all of the daos and create the tables
for (Dao<?, ?> dao : configuredDaos) {
Class<?> clazz = dao.getDataClass();
try {
DatabaseTableConfig<?> tableConfig = null;
if (dao instanceof BaseDaoImpl) {
tableConfig = ((BaseDaoImpl<?, ?>) dao).getTableConfig(); // depends on control dependency: [if], data = [none]
}
if (tableConfig == null) {
tableConfig = DatabaseTableConfig.fromClass(connectionSource.getDatabaseType(), clazz); // depends on control dependency: [if], data = [none]
}
TableUtils.createTable(connectionSource, tableConfig); // depends on control dependency: [try], data = [none]
createdClasses.add(tableConfig); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// we don't stop because the table might already exist
System.err.println("Was unable to auto-create table for " + clazz);
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
<T> CompletableFuture<T> getOrAssignSegmentId(String segmentName, Duration timeout, @NonNull Function<Long, CompletableFuture<T>> thenCompose) {
// Check to see if the metadata already knows about this Segment.
long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true);
if (isValidSegmentId(segmentId)) {
// We already have a value, just return it (but make sure the Segment has not been deleted).
if (this.connector.containerMetadata.getStreamSegmentMetadata(segmentId).isDeleted()) {
return Futures.failedFuture(new StreamSegmentNotExistsException(segmentName));
} else {
// Even though we have the value in the metadata, we need to be very careful not to invoke this callback
// before any other existing callbacks are invoked. As such, verify if we have an existing PendingRequest
// for this segment - if so, tag onto it so we invoke these callbacks in the correct order.
QueuedCallback<T> queuedCallback = checkConcurrentAssignment(segmentName, thenCompose);
return queuedCallback == null ? thenCompose.apply(segmentId) : queuedCallback.result;
}
}
// See if anyone else is currently waiting to get this StreamSegment's id.
QueuedCallback<T> queuedCallback;
boolean needsAssignment = false;
synchronized (this.pendingRequests) {
PendingRequest pendingRequest = this.pendingRequests.getOrDefault(segmentName, null);
if (pendingRequest == null) {
needsAssignment = true;
pendingRequest = new PendingRequest();
this.pendingRequests.put(segmentName, pendingRequest);
}
queuedCallback = new QueuedCallback<>(thenCompose);
pendingRequest.callbacks.add(queuedCallback);
}
// We are the first/only ones requesting this id; go ahead and assign an id.
if (needsAssignment) {
this.executor.execute(() -> assignSegmentId(segmentName, timeout));
}
return queuedCallback.result;
} } | public class class_name {
<T> CompletableFuture<T> getOrAssignSegmentId(String segmentName, Duration timeout, @NonNull Function<Long, CompletableFuture<T>> thenCompose) {
// Check to see if the metadata already knows about this Segment.
long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true);
if (isValidSegmentId(segmentId)) {
// We already have a value, just return it (but make sure the Segment has not been deleted).
if (this.connector.containerMetadata.getStreamSegmentMetadata(segmentId).isDeleted()) {
return Futures.failedFuture(new StreamSegmentNotExistsException(segmentName)); // depends on control dependency: [if], data = [none]
} else {
// Even though we have the value in the metadata, we need to be very careful not to invoke this callback
// before any other existing callbacks are invoked. As such, verify if we have an existing PendingRequest
// for this segment - if so, tag onto it so we invoke these callbacks in the correct order.
QueuedCallback<T> queuedCallback = checkConcurrentAssignment(segmentName, thenCompose);
return queuedCallback == null ? thenCompose.apply(segmentId) : queuedCallback.result; // depends on control dependency: [if], data = [none]
}
}
// See if anyone else is currently waiting to get this StreamSegment's id.
QueuedCallback<T> queuedCallback;
boolean needsAssignment = false;
synchronized (this.pendingRequests) {
PendingRequest pendingRequest = this.pendingRequests.getOrDefault(segmentName, null);
if (pendingRequest == null) {
needsAssignment = true; // depends on control dependency: [if], data = [none]
pendingRequest = new PendingRequest(); // depends on control dependency: [if], data = [none]
this.pendingRequests.put(segmentName, pendingRequest); // depends on control dependency: [if], data = [none]
}
queuedCallback = new QueuedCallback<>(thenCompose);
pendingRequest.callbacks.add(queuedCallback);
}
// We are the first/only ones requesting this id; go ahead and assign an id.
if (needsAssignment) {
this.executor.execute(() -> assignSegmentId(segmentName, timeout)); // depends on control dependency: [if], data = [none]
}
return queuedCallback.result;
} } |
public class class_name {
public static void unregisterDao(ConnectionSource connectionSource,
Class<?>... classes) {
for (Class<?> clazz : classes) {
unregisterDao(connectionSource, clazz);
}
} } | public class class_name {
public static void unregisterDao(ConnectionSource connectionSource,
Class<?>... classes) {
for (Class<?> clazz : classes) {
unregisterDao(connectionSource, clazz); // depends on control dependency: [for], data = [clazz]
}
} } |
public class class_name {
private static int estimateTransacrionSize(UnsignedTransaction unsigned) {
// Create fake empty inputs
TransactionInput[] inputs = new TransactionInput[unsigned._funding.length];
for (int i = 0; i < inputs.length; i++) {
inputs[i] = new TransactionInput(unsigned._funding[i].outPoint, ScriptInput.EMPTY);
}
// Create fake transaction
Transaction t = new Transaction(1, inputs, unsigned._outputs, 0);
int txSize = t.toBytes().length;
// Add maximum size for each input
txSize += 140 * t.inputs.length;
return txSize;
} } | public class class_name {
private static int estimateTransacrionSize(UnsignedTransaction unsigned) {
// Create fake empty inputs
TransactionInput[] inputs = new TransactionInput[unsigned._funding.length];
for (int i = 0; i < inputs.length; i++) {
inputs[i] = new TransactionInput(unsigned._funding[i].outPoint, ScriptInput.EMPTY); // depends on control dependency: [for], data = [i]
}
// Create fake transaction
Transaction t = new Transaction(1, inputs, unsigned._outputs, 0);
int txSize = t.toBytes().length;
// Add maximum size for each input
txSize += 140 * t.inputs.length;
return txSize;
} } |
public class class_name {
private byte[] readBytes()
throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int c;
boolean cr=false;
boolean lf=false;
// loop for all lines`
while (true)
{
int b=0;
while ((c=(_char!=-2)?_char:_in.read())!=-1)
{
_char=-2;
// look for CR and/or LF
if (c==13 || c==10)
{
if (c==13) _char=_in.read();
break;
}
// look for boundary
if (b>=0 && b<_byteBoundary.length && c==_byteBoundary[b])
b++;
else
{
// this is not a boundary
if (cr) baos.write(13);
if (lf) baos.write(10);
cr=lf=false;
if (b>0)
baos.write(_byteBoundary,0,b);
b=-1;
baos.write(c);
}
}
// check partial boundary
if ((b>0 && b<_byteBoundary.length-2) ||
(b==_byteBoundary.length-1))
{
if (cr) baos.write(13);
if (lf) baos.write(10);
cr=lf=false;
baos.write(_byteBoundary,0,b);
b=-1;
}
// boundary match
if (b>0 || c==-1)
{
if (b==_byteBoundary.length)
_lastPart=true;
if (_char==10) _char=-2;
break;
}
// handle CR LF
if (cr) baos.write(13);
if (lf) baos.write(10);
cr=(c==13);
lf=(c==10 || _char==10);
if (_char==10) _char=-2;
}
if(log.isTraceEnabled())log.trace(baos.toString());
return baos.toByteArray();
} } | public class class_name {
private byte[] readBytes()
throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int c;
boolean cr=false;
boolean lf=false;
// loop for all lines`
while (true)
{
int b=0;
while ((c=(_char!=-2)?_char:_in.read())!=-1)
{
_char=-2; // depends on control dependency: [while], data = [none]
// look for CR and/or LF
if (c==13 || c==10)
{
if (c==13) _char=_in.read();
break;
}
// look for boundary
if (b>=0 && b<_byteBoundary.length && c==_byteBoundary[b])
b++;
else
{
// this is not a boundary
if (cr) baos.write(13);
if (lf) baos.write(10);
cr=lf=false; // depends on control dependency: [if], data = [none]
if (b>0)
baos.write(_byteBoundary,0,b);
b=-1; // depends on control dependency: [if], data = [none]
baos.write(c); // depends on control dependency: [if], data = [none]
}
}
// check partial boundary
if ((b>0 && b<_byteBoundary.length-2) ||
(b==_byteBoundary.length-1))
{
if (cr) baos.write(13);
if (lf) baos.write(10);
cr=lf=false; // depends on control dependency: [if], data = [none]
baos.write(_byteBoundary,0,b); // depends on control dependency: [if], data = [none]
b=-1; // depends on control dependency: [if], data = [none]
}
// boundary match
if (b>0 || c==-1)
{
if (b==_byteBoundary.length)
_lastPart=true;
if (_char==10) _char=-2;
break;
}
// handle CR LF
if (cr) baos.write(13);
if (lf) baos.write(10);
cr=(c==13);
lf=(c==10 || _char==10);
if (_char==10) _char=-2;
}
if(log.isTraceEnabled())log.trace(baos.toString());
return baos.toByteArray();
} } |
public class class_name {
public void update(PropertyData data, ChangedSizeHandler sizeHandler) throws RepositoryException,
UnsupportedOperationException, InvalidItemStateException, IllegalStateException
{
checkIfOpened();
try
{
String cid = getInternalId(data.getIdentifier());
// update type
if (updatePropertyByIdentifier(data.getPersistedVersion(), data.getType(), cid) <= 0)
{
throw new JCRInvalidItemStateException("(update) Property not found " + data.getQPath().getAsString() + " "
+ data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
ItemState.UPDATED);
}
// update reference
try
{
deleteReference(cid);
if (data.getType() == PropertyType.REFERENCE)
{
addReference(data);
}
}
catch (IOException e)
{
throw new RepositoryException("Can't update REFERENCE property (" + data.getQPath() + " "
+ data.getIdentifier() + ") value: " + e.getMessage(), e);
}
// do Values update: delete all and add all
deleteValues(cid, data, true, sizeHandler);
addValues(cid, data, sizeHandler);
if (LOG.isDebugEnabled())
{
LOG.debug("Property updated " + data.getQPath().getAsString() + ", " + data.getIdentifier()
+ (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data"));
}
}
catch (IOException e)
{
if (LOG.isDebugEnabled())
{
LOG.error("Property update. IO error: " + e, e);
}
throw new RepositoryException("Error of Property Value update " + e, e);
}
catch (SQLException e)
{
if (LOG.isDebugEnabled())
{
LOG.error("Property update. Database error: " + e, e);
}
exceptionHandler.handleUpdateException(e, data);
}
} } | public class class_name {
public void update(PropertyData data, ChangedSizeHandler sizeHandler) throws RepositoryException,
UnsupportedOperationException, InvalidItemStateException, IllegalStateException
{
checkIfOpened();
try
{
String cid = getInternalId(data.getIdentifier());
// update type
if (updatePropertyByIdentifier(data.getPersistedVersion(), data.getType(), cid) <= 0)
{
throw new JCRInvalidItemStateException("(update) Property not found " + data.getQPath().getAsString() + " "
+ data.getIdentifier() + ". Probably was deleted by another session ", data.getIdentifier(),
ItemState.UPDATED);
}
// update reference
try
{
deleteReference(cid); // depends on control dependency: [try], data = [none]
if (data.getType() == PropertyType.REFERENCE)
{
addReference(data); // depends on control dependency: [if], data = [none]
}
}
catch (IOException e)
{
throw new RepositoryException("Can't update REFERENCE property (" + data.getQPath() + " "
+ data.getIdentifier() + ") value: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
// do Values update: delete all and add all
deleteValues(cid, data, true, sizeHandler);
addValues(cid, data, sizeHandler);
if (LOG.isDebugEnabled())
{
LOG.debug("Property updated " + data.getQPath().getAsString() + ", " + data.getIdentifier()
+ (data.getValues() != null ? ", values count: " + data.getValues().size() : ", NULL data")); // depends on control dependency: [if], data = [none]
}
}
catch (IOException e)
{
if (LOG.isDebugEnabled())
{
LOG.error("Property update. IO error: " + e, e); // depends on control dependency: [if], data = [none]
}
throw new RepositoryException("Error of Property Value update " + e, e);
}
catch (SQLException e)
{
if (LOG.isDebugEnabled())
{
LOG.error("Property update. Database error: " + e, e); // depends on control dependency: [if], data = [none]
}
exceptionHandler.handleUpdateException(e, data);
}
} } |
public class class_name {
private void invokeValueChangeListeners(
final Collection<AbstractHtml5SharedObject> sharedObjects) {
for (final AbstractHtml5SharedObject sharedObject : sharedObjects) {
final AttributeValueChangeListener valueChangeListener = sharedObject
.getValueChangeListener(ACCESS_OBJECT);
if (valueChangeListener != null) {
// ownerTags should not be modified in the consuming
// part, here
// skipped it making unmodifiable to gain
// performance
final AttributeValueChangeListener.Event event = new AttributeValueChangeListener.Event(
this, ownerTags);
valueChangeListener.valueChanged(event);
}
}
if (valueChangeListeners != null) {
for (final AttributeValueChangeListener listener : valueChangeListeners) {
final AttributeValueChangeListener.Event event = new AttributeValueChangeListener.Event(
this, Collections.unmodifiableSet(ownerTags));
listener.valueChanged(event);
}
}
} } | public class class_name {
private void invokeValueChangeListeners(
final Collection<AbstractHtml5SharedObject> sharedObjects) {
for (final AbstractHtml5SharedObject sharedObject : sharedObjects) {
final AttributeValueChangeListener valueChangeListener = sharedObject
.getValueChangeListener(ACCESS_OBJECT);
if (valueChangeListener != null) {
// ownerTags should not be modified in the consuming
// part, here
// skipped it making unmodifiable to gain
// performance
final AttributeValueChangeListener.Event event = new AttributeValueChangeListener.Event(
this, ownerTags);
valueChangeListener.valueChanged(event); // depends on control dependency: [if], data = [none]
}
}
if (valueChangeListeners != null) {
for (final AttributeValueChangeListener listener : valueChangeListeners) {
final AttributeValueChangeListener.Event event = new AttributeValueChangeListener.Event(
this, Collections.unmodifiableSet(ownerTags));
listener.valueChanged(event); // depends on control dependency: [for], data = [listener]
}
}
} } |
public class class_name {
public CommandLine env(final String key, final String value) {
if (env == null) {
env = new HashMap<>();
}
env.put(key, value);
return this;
} } | public class class_name {
public CommandLine env(final String key, final String value) {
if (env == null) {
env = new HashMap<>(); // depends on control dependency: [if], data = [none]
}
env.put(key, value);
return this;
} } |
public class class_name {
@Override
public CheckAndMutateRowResponse checkAndMutateRow(CheckAndMutateRowRequest request) {
if (shouldOverrideAppProfile(request.getAppProfileId())) {
request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build();
}
return createUnaryListener(request, checkAndMutateRpc, request.getTableName())
.getBlockingResult();
} } | public class class_name {
@Override
public CheckAndMutateRowResponse checkAndMutateRow(CheckAndMutateRowRequest request) {
if (shouldOverrideAppProfile(request.getAppProfileId())) {
request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); // depends on control dependency: [if], data = [none]
}
return createUnaryListener(request, checkAndMutateRpc, request.getTableName())
.getBlockingResult();
} } |
public class class_name {
private final <T extends Value> void deserialize(T target, int offset, int limit, int fieldNumber) {
final InternalDeSerializer serializer = this.serializer;
serializer.memory = this.binaryData;
serializer.position = offset;
serializer.end = limit;
try {
target.read(serializer);
}
catch (Exception e) {
throw new DeserializationException("Error reading field " + fieldNumber + " as " + target.getClass().getName(), e);
}
} } | public class class_name {
private final <T extends Value> void deserialize(T target, int offset, int limit, int fieldNumber) {
final InternalDeSerializer serializer = this.serializer;
serializer.memory = this.binaryData;
serializer.position = offset;
serializer.end = limit;
try {
target.read(serializer); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new DeserializationException("Error reading field " + fieldNumber + " as " + target.getClass().getName(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setName(int pathId, String pathName) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_PATH +
" SET " + Constants.PATH_PROFILE_PATHNAME + " = ?" +
" WHERE " + Constants.GENERIC_ID + " = ?"
);
statement.setString(1, pathName);
statement.setInt(2, pathId);
statement.executeUpdate();
statement.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} } | public class class_name {
public void setName(int pathId, String pathName) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_PATH +
" SET " + Constants.PATH_PROFILE_PATHNAME + " = ?" +
" WHERE " + Constants.GENERIC_ID + " = ?"
);
statement.setString(1, pathName);
statement.setInt(2, pathId);
statement.executeUpdate();
statement.close();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private void linkUp(Mtp2 link) {
if (link.mtp2Listener != null) {
link.mtp2Listener.linkUp();
}
linkset.add(link);
if (linkset.isActive() && this.mtp3Listener != null) {
try {
mtp3Listener.linkUp();
} catch (Exception e) {
e.printStackTrace();
}
}
if (logger.isInfoEnabled()) {
logger.info(String.format("(%s) Link now IN_SERVICE", link.getName()));
}
} } | public class class_name {
private void linkUp(Mtp2 link) {
if (link.mtp2Listener != null) {
link.mtp2Listener.linkUp(); // depends on control dependency: [if], data = [none]
}
linkset.add(link);
if (linkset.isActive() && this.mtp3Listener != null) {
try {
mtp3Listener.linkUp(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
if (logger.isInfoEnabled()) {
logger.info(String.format("(%s) Link now IN_SERVICE", link.getName())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected final String getForFDelete(final Class<?> pClass) {
if (SeGoodsSpecifics.class == pClass
|| SeServiceSpecifics.class == pClass) {
return PrcEntityFDelete.class.getSimpleName();
}
return null;
} } | public class class_name {
protected final String getForFDelete(final Class<?> pClass) {
if (SeGoodsSpecifics.class == pClass
|| SeServiceSpecifics.class == pClass) {
return PrcEntityFDelete.class.getSimpleName(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public void format(Buffer buf) {
int pos = 0;
// initial the number of records as 0
setVal(buf, pos, Constant.defaultInstance(INTEGER));
int flagSize = Page.maxSize(BIGINT);
pos += Page.maxSize(INTEGER);
// set flags
for (int i = 0; i < flags.length; i++) {
setVal(buf, pos, new BigIntConstant(flags[i]));
pos += flagSize;
}
int slotSize = BTreePage.slotSize(sch);
for (int p = pos; p + slotSize <= Buffer.BUFFER_SIZE; p += slotSize)
makeDefaultRecord(buf, p);
} } | public class class_name {
@Override
public void format(Buffer buf) {
int pos = 0;
// initial the number of records as 0
setVal(buf, pos, Constant.defaultInstance(INTEGER));
int flagSize = Page.maxSize(BIGINT);
pos += Page.maxSize(INTEGER);
// set flags
for (int i = 0; i < flags.length; i++) {
setVal(buf, pos, new BigIntConstant(flags[i]));
// depends on control dependency: [for], data = [i]
pos += flagSize;
// depends on control dependency: [for], data = [none]
}
int slotSize = BTreePage.slotSize(sch);
for (int p = pos; p + slotSize <= Buffer.BUFFER_SIZE; p += slotSize)
makeDefaultRecord(buf, p);
} } |
public class class_name {
@Override
public String stringify(Document document) {
try {
StringWriter sw = new StringWriter();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.transform(new DOMSource(document), new StreamResult(sw));
return sw.toString();
} catch (TransformerException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
@Override
public String stringify(Document document) {
try {
StringWriter sw = new StringWriter();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); // depends on control dependency: [try], data = [none]
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); // depends on control dependency: [try], data = [none]
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); // depends on control dependency: [try], data = [none]
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); // depends on control dependency: [try], data = [none]
transformer.transform(new DOMSource(document), new StreamResult(sw)); // depends on control dependency: [try], data = [none]
return sw.toString(); // depends on control dependency: [try], data = [none]
} catch (TransformerException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void fullRedraw() {
if(!(getWidth() > 0 && getHeight() > 0)) {
LoggingUtil.warning("Thumbnail of zero size requested: " + visFactory);
return;
}
if(thumbid < 0) {
// LoggingUtil.warning("Generating new thumbnail " + this);
layer.appendChild(SVGUtil.svgWaitIcon(plot.getDocument(), 0, 0, getWidth(), getHeight()));
if(pendingThumbnail == null) {
pendingThumbnail = ThumbnailThread.queue(this);
}
return;
}
// LoggingUtil.warning("Injecting Thumbnail " + this);
Element i = plot.svgElement(SVGConstants.SVG_IMAGE_TAG);
SVGUtil.setAtt(i, SVGConstants.SVG_X_ATTRIBUTE, 0);
SVGUtil.setAtt(i, SVGConstants.SVG_Y_ATTRIBUTE, 0);
SVGUtil.setAtt(i, SVGConstants.SVG_WIDTH_ATTRIBUTE, getWidth());
SVGUtil.setAtt(i, SVGConstants.SVG_HEIGHT_ATTRIBUTE, getHeight());
i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_QNAME, ThumbnailRegistryEntry.INTERNAL_PROTOCOL + ":" + thumbid);
layer.appendChild(i);
} } | public class class_name {
@Override
public void fullRedraw() {
if(!(getWidth() > 0 && getHeight() > 0)) {
LoggingUtil.warning("Thumbnail of zero size requested: " + visFactory); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if(thumbid < 0) {
// LoggingUtil.warning("Generating new thumbnail " + this);
layer.appendChild(SVGUtil.svgWaitIcon(plot.getDocument(), 0, 0, getWidth(), getHeight())); // depends on control dependency: [if], data = [none]
if(pendingThumbnail == null) {
pendingThumbnail = ThumbnailThread.queue(this); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
// LoggingUtil.warning("Injecting Thumbnail " + this);
Element i = plot.svgElement(SVGConstants.SVG_IMAGE_TAG);
SVGUtil.setAtt(i, SVGConstants.SVG_X_ATTRIBUTE, 0);
SVGUtil.setAtt(i, SVGConstants.SVG_Y_ATTRIBUTE, 0);
SVGUtil.setAtt(i, SVGConstants.SVG_WIDTH_ATTRIBUTE, getWidth());
SVGUtil.setAtt(i, SVGConstants.SVG_HEIGHT_ATTRIBUTE, getHeight());
i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_QNAME, ThumbnailRegistryEntry.INTERNAL_PROTOCOL + ":" + thumbid);
layer.appendChild(i);
} } |
public class class_name {
public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> listMemberSchemasSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (serverName == null) {
throw new IllegalArgumentException("Parameter serverName is required and cannot be null.");
}
if (databaseName == null) {
throw new IllegalArgumentException("Parameter databaseName is required and cannot be null.");
}
if (syncGroupName == null) {
throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.");
}
if (syncMemberName == null) {
throw new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listMemberSchemas(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<SyncFullSchemaPropertiesInner>> result = listMemberSchemasDelegate(response);
return Observable.just(new ServiceResponse<Page<SyncFullSchemaPropertiesInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> listMemberSchemasSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName, final String syncMemberName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (serverName == null) {
throw new IllegalArgumentException("Parameter serverName is required and cannot be null.");
}
if (databaseName == null) {
throw new IllegalArgumentException("Parameter databaseName is required and cannot be null.");
}
if (syncGroupName == null) {
throw new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.");
}
if (syncMemberName == null) {
throw new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listMemberSchemas(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<SyncFullSchemaPropertiesInner>> result = listMemberSchemasDelegate(response);
return Observable.just(new ServiceResponse<Page<SyncFullSchemaPropertiesInner>>(result.body(), result.response())); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public void startElement(
String namespaceURI,
String localName,
String name,
Attributes atts)
throws org.xml.sax.SAXException
{
ElemContext elemContext = m_elemContext;
// clean up any pending things first
if (elemContext.m_startTagOpen)
{
closeStartTag();
elemContext.m_startTagOpen = false;
}
else if (m_cdataTagOpen)
{
closeCDATA();
m_cdataTagOpen = false;
}
else if (m_needToCallStartDocument)
{
startDocumentInternal();
m_needToCallStartDocument = false;
}
if (m_needToOutputDocTypeDecl) {
String n = name;
if (n == null || n.length() == 0) {
// If the lexical QName is not given
// use the localName in the DOCTYPE
n = localName;
}
outputDocTypeDecl(n);
}
// if this element has a namespace then treat it like XML
if (null != namespaceURI && namespaceURI.length() > 0)
{
super.startElement(namespaceURI, localName, name, atts);
return;
}
try
{
// getElemDesc2(name) is faster than getElemDesc(name)
ElemDesc elemDesc = getElemDesc2(name);
int elemFlags = elemDesc.getFlags();
// deal with indentation issues first
if (m_doIndent)
{
boolean isBlockElement = (elemFlags & ElemDesc.BLOCK) != 0;
if (m_ispreserve)
m_ispreserve = false;
else if (
(null != elemContext.m_elementName)
&& (!m_inBlockElem
|| isBlockElement) /* && !isWhiteSpaceSensitive */
)
{
m_startNewLine = true;
indent();
}
m_inBlockElem = !isBlockElement;
}
// save any attributes for later processing
if (atts != null)
addAttributes(atts);
m_isprevtext = false;
final java.io.Writer writer = m_writer;
writer.write('<');
writer.write(name);
if (m_tracer != null)
firePseudoAttributes();
if ((elemFlags & ElemDesc.EMPTY) != 0)
{
// an optimization for elements which are expected
// to be empty.
m_elemContext = elemContext.push();
/* XSLTC sometimes calls namespaceAfterStartElement()
* so we need to remember the name
*/
m_elemContext.m_elementName = name;
m_elemContext.m_elementDesc = elemDesc;
return;
}
else
{
elemContext = elemContext.push(namespaceURI,localName,name);
m_elemContext = elemContext;
elemContext.m_elementDesc = elemDesc;
elemContext.m_isRaw = (elemFlags & ElemDesc.RAW) != 0;
}
if ((elemFlags & ElemDesc.HEADELEM) != 0)
{
// This is the <HEAD> element, do some special processing
closeStartTag();
elemContext.m_startTagOpen = false;
if (!m_omitMetaTag)
{
if (m_doIndent)
indent();
writer.write(
"<META http-equiv=\"Content-Type\" content=\"text/html; charset=");
String encoding = getEncoding();
String encode = Encodings.getMimeEncoding(encoding);
writer.write(encode);
writer.write("\">");
}
}
}
catch (IOException e)
{
throw new SAXException(e);
}
} } | public class class_name {
public void startElement(
String namespaceURI,
String localName,
String name,
Attributes atts)
throws org.xml.sax.SAXException
{
ElemContext elemContext = m_elemContext;
// clean up any pending things first
if (elemContext.m_startTagOpen)
{
closeStartTag();
elemContext.m_startTagOpen = false;
}
else if (m_cdataTagOpen)
{
closeCDATA();
m_cdataTagOpen = false;
}
else if (m_needToCallStartDocument)
{
startDocumentInternal();
m_needToCallStartDocument = false;
}
if (m_needToOutputDocTypeDecl) {
String n = name;
if (n == null || n.length() == 0) {
// If the lexical QName is not given
// use the localName in the DOCTYPE
n = localName; // depends on control dependency: [if], data = [none]
}
outputDocTypeDecl(n);
}
// if this element has a namespace then treat it like XML
if (null != namespaceURI && namespaceURI.length() > 0)
{
super.startElement(namespaceURI, localName, name, atts);
return;
}
try
{
// getElemDesc2(name) is faster than getElemDesc(name)
ElemDesc elemDesc = getElemDesc2(name);
int elemFlags = elemDesc.getFlags();
// deal with indentation issues first
if (m_doIndent)
{
boolean isBlockElement = (elemFlags & ElemDesc.BLOCK) != 0;
if (m_ispreserve)
m_ispreserve = false;
else if (
(null != elemContext.m_elementName)
&& (!m_inBlockElem
|| isBlockElement) /* && !isWhiteSpaceSensitive */
)
{
m_startNewLine = true; // depends on control dependency: [if], data = []
indent(); // depends on control dependency: [if], data = []
}
m_inBlockElem = !isBlockElement; // depends on control dependency: [if], data = [none]
}
// save any attributes for later processing
if (atts != null)
addAttributes(atts);
m_isprevtext = false;
final java.io.Writer writer = m_writer;
writer.write('<');
writer.write(name);
if (m_tracer != null)
firePseudoAttributes();
if ((elemFlags & ElemDesc.EMPTY) != 0)
{
// an optimization for elements which are expected
// to be empty.
m_elemContext = elemContext.push(); // depends on control dependency: [if], data = [none]
/* XSLTC sometimes calls namespaceAfterStartElement()
* so we need to remember the name
*/
m_elemContext.m_elementName = name; // depends on control dependency: [if], data = [none]
m_elemContext.m_elementDesc = elemDesc; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
else
{
elemContext = elemContext.push(namespaceURI,localName,name); // depends on control dependency: [if], data = [none]
m_elemContext = elemContext; // depends on control dependency: [if], data = [none]
elemContext.m_elementDesc = elemDesc; // depends on control dependency: [if], data = [none]
elemContext.m_isRaw = (elemFlags & ElemDesc.RAW) != 0; // depends on control dependency: [if], data = [none]
}
if ((elemFlags & ElemDesc.HEADELEM) != 0)
{
// This is the <HEAD> element, do some special processing
closeStartTag(); // depends on control dependency: [if], data = [none]
elemContext.m_startTagOpen = false; // depends on control dependency: [if], data = [none]
if (!m_omitMetaTag)
{
if (m_doIndent)
indent();
writer.write(
"<META http-equiv=\"Content-Type\" content=\"text/html; charset="); // depends on control dependency: [if], data = [none]
String encoding = getEncoding();
String encode = Encodings.getMimeEncoding(encoding);
writer.write(encode); // depends on control dependency: [if], data = [none]
writer.write("\">"); // depends on control dependency: [if], data = [none]
}
}
}
catch (IOException e)
{
throw new SAXException(e);
}
} } |
public class class_name {
private void setProgressBarValue(int value, int maximum) {
this.progressBar.setIndeterminate(false);
if (this.progressBar.getMaximum() != maximum) {
this.progressBar.setMaximum(maximum);
}
this.progressBar.setValue(value);
} } | public class class_name {
private void setProgressBarValue(int value, int maximum) {
this.progressBar.setIndeterminate(false);
if (this.progressBar.getMaximum() != maximum) {
this.progressBar.setMaximum(maximum); // depends on control dependency: [if], data = [maximum)]
}
this.progressBar.setValue(value);
} } |
public class class_name {
static void blur(int[] srcPixels, int[] dstPixels, int width, int height, int radius) {
final int windowSize = radius * 2 + 1;
final int radiusPlusOne = radius + 1;
int sumAlpha;
int sumRed;
int sumGreen;
int sumBlue;
int srcIndex = 0;
int dstIndex;
int pixel;
final int[] sumLookupTable = createSumLookupTable(windowSize);
final int[] indexLookupTable = createIndexLookupTable(width, radius);
for (int y = 0; y < height; y++) {
sumAlpha = 0;
sumRed = 0;
sumGreen = 0;
sumBlue = 0;
dstIndex = y;
pixel = srcPixels[srcIndex];
sumAlpha += radiusPlusOne * (pixel >> 24 & 0xFF);
sumRed += radiusPlusOne * (pixel >> 16 & 0xFF);
sumGreen += radiusPlusOne * (pixel >> 8 & 0xFF);
sumBlue += radiusPlusOne * (pixel & 0xFF);
for (int i = 1; i <= radius; i++) {
pixel = srcPixels[srcIndex + indexLookupTable[i]];
sumAlpha += pixel >> 24 & 0xFF;
sumRed += pixel >> 16 & 0xFF;
sumGreen += pixel >> 8 & 0xFF;
sumBlue += pixel & 0xFF;
}
for (int x = 0; x < width; x++) {
dstPixels[dstIndex] = sumLookupTable[sumAlpha] << 24 | sumLookupTable[sumRed] << 16
| sumLookupTable[sumGreen] << 8 | sumLookupTable[sumBlue];
dstIndex += height;
int nextPixelIndex = x + radiusPlusOne;
if (nextPixelIndex >= width) {
nextPixelIndex = width - 1;
}
int previousPixelIndex = x - radius;
if (previousPixelIndex < 0) {
previousPixelIndex = 0;
}
final int nextPixel = srcPixels[srcIndex + nextPixelIndex];
final int previousPixel = srcPixels[srcIndex + previousPixelIndex];
sumAlpha += nextPixel >> 24 & 0xFF;
sumAlpha -= previousPixel >> 24 & 0xFF;
sumRed += nextPixel >> 16 & 0xFF;
sumRed -= previousPixel >> 16 & 0xFF;
sumGreen += nextPixel >> 8 & 0xFF;
sumGreen -= previousPixel >> 8 & 0xFF;
sumBlue += nextPixel & 0xFF;
sumBlue -= previousPixel & 0xFF;
}
srcIndex += width;
}
} } | public class class_name {
static void blur(int[] srcPixels, int[] dstPixels, int width, int height, int radius) {
final int windowSize = radius * 2 + 1;
final int radiusPlusOne = radius + 1;
int sumAlpha;
int sumRed;
int sumGreen;
int sumBlue;
int srcIndex = 0;
int dstIndex;
int pixel;
final int[] sumLookupTable = createSumLookupTable(windowSize);
final int[] indexLookupTable = createIndexLookupTable(width, radius);
for (int y = 0; y < height; y++) {
sumAlpha = 0;
// depends on control dependency: [for], data = [none]
sumRed = 0;
// depends on control dependency: [for], data = [none]
sumGreen = 0;
// depends on control dependency: [for], data = [none]
sumBlue = 0;
// depends on control dependency: [for], data = [none]
dstIndex = y;
// depends on control dependency: [for], data = [y]
pixel = srcPixels[srcIndex];
// depends on control dependency: [for], data = [none]
sumAlpha += radiusPlusOne * (pixel >> 24 & 0xFF);
// depends on control dependency: [for], data = [none]
sumRed += radiusPlusOne * (pixel >> 16 & 0xFF);
// depends on control dependency: [for], data = [none]
sumGreen += radiusPlusOne * (pixel >> 8 & 0xFF);
// depends on control dependency: [for], data = [none]
sumBlue += radiusPlusOne * (pixel & 0xFF);
// depends on control dependency: [for], data = [none]
for (int i = 1; i <= radius; i++) {
pixel = srcPixels[srcIndex + indexLookupTable[i]];
// depends on control dependency: [for], data = [i]
sumAlpha += pixel >> 24 & 0xFF;
// depends on control dependency: [for], data = [none]
sumRed += pixel >> 16 & 0xFF;
// depends on control dependency: [for], data = [none]
sumGreen += pixel >> 8 & 0xFF;
// depends on control dependency: [for], data = [none]
sumBlue += pixel & 0xFF;
// depends on control dependency: [for], data = [none]
}
for (int x = 0; x < width; x++) {
dstPixels[dstIndex] = sumLookupTable[sumAlpha] << 24 | sumLookupTable[sumRed] << 16
| sumLookupTable[sumGreen] << 8 | sumLookupTable[sumBlue];
// depends on control dependency: [for], data = [none]
dstIndex += height;
// depends on control dependency: [for], data = [none]
int nextPixelIndex = x + radiusPlusOne;
if (nextPixelIndex >= width) {
nextPixelIndex = width - 1;
// depends on control dependency: [if], data = [none]
}
int previousPixelIndex = x - radius;
if (previousPixelIndex < 0) {
previousPixelIndex = 0;
// depends on control dependency: [if], data = [none]
}
final int nextPixel = srcPixels[srcIndex + nextPixelIndex];
final int previousPixel = srcPixels[srcIndex + previousPixelIndex];
sumAlpha += nextPixel >> 24 & 0xFF;
// depends on control dependency: [for], data = [none]
sumAlpha -= previousPixel >> 24 & 0xFF;
// depends on control dependency: [for], data = [none]
sumRed += nextPixel >> 16 & 0xFF;
// depends on control dependency: [for], data = [none]
sumRed -= previousPixel >> 16 & 0xFF;
// depends on control dependency: [for], data = [none]
sumGreen += nextPixel >> 8 & 0xFF;
// depends on control dependency: [for], data = [none]
sumGreen -= previousPixel >> 8 & 0xFF;
// depends on control dependency: [for], data = [none]
sumBlue += nextPixel & 0xFF;
// depends on control dependency: [for], data = [none]
sumBlue -= previousPixel & 0xFF;
// depends on control dependency: [for], data = [none]
}
srcIndex += width;
// depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
void adjustScroll() {
if (iRowHeight == 0) {
return;
}
int w = 0;
for (int i = 0; i < iColCount; i++) {
w += iColWidth[i];
}
iGridWidth = w;
iGridHeight = iRowHeight * (iRowCount + 1);
sbHoriz.setValues(iX, iWidth, 0, iGridWidth);
int v = iY / iRowHeight,
h = iHeight / iRowHeight;
sbVert.setValues(v, h, 0, iRowCount + 1);
iX = sbHoriz.getValue();
iY = iRowHeight * sbVert.getValue();
} } | public class class_name {
void adjustScroll() {
if (iRowHeight == 0) {
return; // depends on control dependency: [if], data = [none]
}
int w = 0;
for (int i = 0; i < iColCount; i++) {
w += iColWidth[i]; // depends on control dependency: [for], data = [i]
}
iGridWidth = w;
iGridHeight = iRowHeight * (iRowCount + 1);
sbHoriz.setValues(iX, iWidth, 0, iGridWidth);
int v = iY / iRowHeight,
h = iHeight / iRowHeight;
sbVert.setValues(v, h, 0, iRowCount + 1);
iX = sbHoriz.getValue();
iY = iRowHeight * sbVert.getValue();
} } |
public class class_name {
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(6)
public int attachDetach() {
Context old = cu.attach();
try {
return key.get();
} finally {
Context.current().detach(old);
}
} } | public class class_name {
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@GroupThreads(6)
public int attachDetach() {
Context old = cu.attach();
try {
return key.get(); // depends on control dependency: [try], data = [none]
} finally {
Context.current().detach(old);
}
} } |
public class class_name {
@Transformer
public static String lowerFirst(Object o) {
if (null == o) return "";
String string = o.toString();
if (string.length() == 0) {
return string;
}
return ("" + string.charAt(0)).toLowerCase() + string.substring(1);
} } | public class class_name {
@Transformer
public static String lowerFirst(Object o) {
if (null == o) return "";
String string = o.toString();
if (string.length() == 0) {
return string; // depends on control dependency: [if], data = [none]
}
return ("" + string.charAt(0)).toLowerCase() + string.substring(1);
} } |
public class class_name {
public static String getPackageName(String filePath) {
char sep = File.separatorChar;
int n = filePath.lastIndexOf(sep);
if (n == -1 && sep != '/') {
// Try with linux separator if the system separator is not found.
sep = '/';
n = filePath.lastIndexOf(sep);
}
return n < 0 ? "." : filePath.substring(0, n).replace(sep, '.');
} } | public class class_name {
public static String getPackageName(String filePath) {
char sep = File.separatorChar;
int n = filePath.lastIndexOf(sep);
if (n == -1 && sep != '/') {
// Try with linux separator if the system separator is not found.
sep = '/'; // depends on control dependency: [if], data = [none]
n = filePath.lastIndexOf(sep); // depends on control dependency: [if], data = [none]
}
return n < 0 ? "." : filePath.substring(0, n).replace(sep, '.');
} } |
public class class_name {
public CliCommandBuilder setCommands(final String... commands) {
if (commands == null || commands.length == 0) {
addCliArgument(CliArgument.COMMANDS, null);
return this;
}
return setCommands(Arrays.asList(commands));
} } | public class class_name {
public CliCommandBuilder setCommands(final String... commands) {
if (commands == null || commands.length == 0) {
addCliArgument(CliArgument.COMMANDS, null); // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
}
return setCommands(Arrays.asList(commands));
} } |
public class class_name {
public static INDArray reverseTimeSeriesMask(INDArray mask, LayerWorkspaceMgr workspaceMgr, ArrayType arrayType){
if(mask == null){
return null;
}
if(mask.rank() == 3){
//Should normally not be used - but handle the per-output masking case
return reverseTimeSeries(mask, workspaceMgr, arrayType);
} else if(mask.rank() != 2){
throw new IllegalArgumentException("Invalid mask rank: must be rank 2 or 3. Got rank " + mask.rank()
+ " with shape " + Arrays.toString(mask.shape()));
}
// FIXME: int cast
int[] idxs = new int[(int) mask.size(1)];
int j=0;
for( int i=idxs.length-1; i>=0; i--){
idxs[j++] = i;
}
INDArray ret = workspaceMgr.createUninitialized(arrayType, mask.dataType(), new long[]{mask.size(0), idxs.length}, 'f');
return Nd4j.pullRows(mask, ret, 0, idxs);
/*
//Assume input mask is 2d: [minibatch, tsLength]
INDArray out = Nd4j.createUninitialized(mask.shape(), 'f');
CustomOp op = DynamicCustomOp.builder("reverse")
.addIntegerArguments(new int[]{1})
.addInputs(mask)
.addOutputs(out)
.callInplace(false)
.build();
Nd4j.getExecutioner().exec(op);
return out;
*/
} } | public class class_name {
public static INDArray reverseTimeSeriesMask(INDArray mask, LayerWorkspaceMgr workspaceMgr, ArrayType arrayType){
if(mask == null){
return null; // depends on control dependency: [if], data = [none]
}
if(mask.rank() == 3){
//Should normally not be used - but handle the per-output masking case
return reverseTimeSeries(mask, workspaceMgr, arrayType); // depends on control dependency: [if], data = [none]
} else if(mask.rank() != 2){
throw new IllegalArgumentException("Invalid mask rank: must be rank 2 or 3. Got rank " + mask.rank()
+ " with shape " + Arrays.toString(mask.shape()));
}
// FIXME: int cast
int[] idxs = new int[(int) mask.size(1)];
int j=0;
for( int i=idxs.length-1; i>=0; i--){
idxs[j++] = i; // depends on control dependency: [for], data = [i]
}
INDArray ret = workspaceMgr.createUninitialized(arrayType, mask.dataType(), new long[]{mask.size(0), idxs.length}, 'f');
return Nd4j.pullRows(mask, ret, 0, idxs);
/*
//Assume input mask is 2d: [minibatch, tsLength]
INDArray out = Nd4j.createUninitialized(mask.shape(), 'f');
CustomOp op = DynamicCustomOp.builder("reverse")
.addIntegerArguments(new int[]{1})
.addInputs(mask)
.addOutputs(out)
.callInplace(false)
.build();
Nd4j.getExecutioner().exec(op);
return out;
*/
} } |
public class class_name {
public static ExpressionModel computeExpression(String expression) {
// Si l'expression est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null
return null;
}
// On Instancie un model d'expression
ExpressionModel expressionModel = new ExpressionModel(expression.trim());
// Index de l'iteration
int i = 0;
// Si la chaine contient des Fonctions
if(isExpressionContainPattern(expression.trim(), FUNC_CHAIN_PATTERN)) {
// Obtention de la liste des Fonctions
String[] functions = extractToken(expression, FUNC_CHAIN_PATTERN);
// Parcours
for (String function : functions) {
// Chaine en cours
String currentExpression = expressionModel.getComputedExpression();
// Nom de la Variable
String parameterName = "var" + i++;
// On remplace l'occurence courante par le nom de la variable
currentExpression = currentExpression.replace(function, ":" + parameterName);
// On met a jour l'expression computee
expressionModel.setComputedExpression(currentExpression);
// On ajoute les parametres
expressionModel.addParameter(parameterName, function);
}
}
// Tant que la chaene traitee contient des ENVs
while(isExpressionContainPattern(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN)) {
// Obtention de la liste des ENVs
String[] envs = extractToken(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN);
// Parcours
for (String env : envs) {
// Chaine en cours
String currentExpression = expressionModel.getComputedExpression();
// Nom de la Variable
String parameterName = "var" + i++;
// On remplace l'occurence courante par le nom de la variable
currentExpression = currentExpression.replace(env, ":" + parameterName);
// On met a jour l'expression computee
expressionModel.setComputedExpression(currentExpression);
// On ajoute les parametres
expressionModel.addParameter(parameterName, env);
}
}
// On retourne l'expression
return expressionModel;
} } | public class class_name {
public static ExpressionModel computeExpression(String expression) {
// Si l'expression est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null
return null;
// depends on control dependency: [if], data = [none]
}
// On Instancie un model d'expression
ExpressionModel expressionModel = new ExpressionModel(expression.trim());
// Index de l'iteration
int i = 0;
// Si la chaine contient des Fonctions
if(isExpressionContainPattern(expression.trim(), FUNC_CHAIN_PATTERN)) {
// Obtention de la liste des Fonctions
String[] functions = extractToken(expression, FUNC_CHAIN_PATTERN);
// Parcours
for (String function : functions) {
// Chaine en cours
String currentExpression = expressionModel.getComputedExpression();
// Nom de la Variable
String parameterName = "var" + i++;
// On remplace l'occurence courante par le nom de la variable
currentExpression = currentExpression.replace(function, ":" + parameterName);
// depends on control dependency: [for], data = [function]
// On met a jour l'expression computee
expressionModel.setComputedExpression(currentExpression);
// depends on control dependency: [for], data = [none]
// On ajoute les parametres
expressionModel.addParameter(parameterName, function);
// depends on control dependency: [for], data = [function]
}
}
// Tant que la chaene traitee contient des ENVs
while(isExpressionContainPattern(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN)) {
// Obtention de la liste des ENVs
String[] envs = extractToken(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN);
// Parcours
for (String env : envs) {
// Chaine en cours
String currentExpression = expressionModel.getComputedExpression();
// Nom de la Variable
String parameterName = "var" + i++;
// On remplace l'occurence courante par le nom de la variable
currentExpression = currentExpression.replace(env, ":" + parameterName);
// depends on control dependency: [for], data = [env]
// On met a jour l'expression computee
expressionModel.setComputedExpression(currentExpression);
// depends on control dependency: [for], data = [none]
// On ajoute les parametres
expressionModel.addParameter(parameterName, env);
// depends on control dependency: [for], data = [env]
}
}
// On retourne l'expression
return expressionModel;
} } |
public class class_name {
protected void delete(ManagedObject managedObject,
Transaction transaction,
long logSpaceReservedDelta)
throws ObjectManagerException {
final String methodName = "delete";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
methodName,
new Object[] { managedObject,
transaction,
new Long(logSpaceReservedDelta) });
// Make the ManagedObject ready for an deletion,
// give it a chance to blow up in anything is wrong.
managedObject.preDelete(transaction);
synchronized (this) {
// To defend against two application threads completing the same transaction and trying to
// continue with it at the same time we check that the Transaction still refers to this one,
// now that we are synchronized on the InternalTransaction.
if (transaction.internalTransaction != this) {
managedObject.postDelete(transaction, false);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName,
new Object[] { "via InvalidTransactionException",
transaction.internalTransaction });
// Same behaviour as if the transaction was completed and replaced by
// objectManagerState.dummyInternalTransaction.
throw new InvalidStateException(this,
InternalTransaction.stateTerminated,
InternalTransaction.stateNames[InternalTransaction.stateTerminated]);
} // if (transaction.internalTransaction != this).
// This object will be removed from the object store once the transaction
// is commted.
// Is data logging is required for this object in order to recover its
// removal?
long logSequenceNumber;
// The following try block catces failures to write the log record.
try {
if (managedObject.owningToken.getObjectStore().getPersistence()) {
testState(nextStateForInvolvePersistentObject);
logSpaceReservedDelta = logSpaceReservedDelta + Token.maximumSerializedSize();
if (logSpaceReserved == 0)
logSpaceReservedDelta = logSpaceReservedDelta + logSpaceReservedOverhead;
TransactionDeleteLogRecord transactionDeleteLogRecord = new TransactionDeleteLogRecord(this,
managedObject.owningToken);
// If we throw an exception in here no state change has been done.
logSequenceNumber = objectManagerState.logOutput.writeNext(transactionDeleteLogRecord, logSpaceReservedDelta,
true, false);
// The previous testState() call means we should not fail in here.
setState(nextStateForInvolvePersistentObject);
logSpaceReserved = logSpaceReserved + logSpaceReservedDelta;
} else { // if (token.getObjectStore().persistent).
setState(nextStateForInvolveNonPersistentObject);
logSequenceNumber = objectManagerState.getDummyLogSequenceNumber();
} // If Non Persistent.
} catch (ObjectManagerException exception) {
// The write was not done.
// No FFDC Code Needed.
ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:1644:1.41");
// Drive the postDelete method for the object.
managedObject.postDelete(transaction, false);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName,
new Object[] { exception });
throw exception;
} // catch (ObjectManagerException...
loggedSerializedBytes.remove(managedObject.owningToken);
// The ManagedObject is now included in the transaction.
includedManagedObjects.put(managedObject.owningToken, managedObject);
// Remember which version it was when we logged it.
logSequenceNumbers.put(managedObject.owningToken,
new Long(logSequenceNumber));
managedObjectSequenceNumbers.put(managedObject.owningToken,
new Long(managedObject.getUpdateSequence()));
} // synchronized (this);
// Drive the postDelete method for the object.
managedObject.postDelete(transaction, true);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName);
} } | public class class_name {
protected void delete(ManagedObject managedObject,
Transaction transaction,
long logSpaceReservedDelta)
throws ObjectManagerException {
final String methodName = "delete";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
methodName,
new Object[] { managedObject,
transaction,
new Long(logSpaceReservedDelta) });
// Make the ManagedObject ready for an deletion,
// give it a chance to blow up in anything is wrong.
managedObject.preDelete(transaction);
synchronized (this) {
// To defend against two application threads completing the same transaction and trying to
// continue with it at the same time we check that the Transaction still refers to this one,
// now that we are synchronized on the InternalTransaction.
if (transaction.internalTransaction != this) {
managedObject.postDelete(transaction, false); // depends on control dependency: [if], data = [none]
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName,
new Object[] { "via InvalidTransactionException",
transaction.internalTransaction });
// Same behaviour as if the transaction was completed and replaced by
// objectManagerState.dummyInternalTransaction.
throw new InvalidStateException(this,
InternalTransaction.stateTerminated,
InternalTransaction.stateNames[InternalTransaction.stateTerminated]);
} // if (transaction.internalTransaction != this).
// This object will be removed from the object store once the transaction
// is commted.
// Is data logging is required for this object in order to recover its
// removal?
long logSequenceNumber;
// The following try block catces failures to write the log record.
try {
if (managedObject.owningToken.getObjectStore().getPersistence()) {
testState(nextStateForInvolvePersistentObject); // depends on control dependency: [if], data = [none]
logSpaceReservedDelta = logSpaceReservedDelta + Token.maximumSerializedSize(); // depends on control dependency: [if], data = [none]
if (logSpaceReserved == 0)
logSpaceReservedDelta = logSpaceReservedDelta + logSpaceReservedOverhead;
TransactionDeleteLogRecord transactionDeleteLogRecord = new TransactionDeleteLogRecord(this,
managedObject.owningToken);
// If we throw an exception in here no state change has been done.
logSequenceNumber = objectManagerState.logOutput.writeNext(transactionDeleteLogRecord, logSpaceReservedDelta,
true, false); // depends on control dependency: [if], data = [none]
// The previous testState() call means we should not fail in here.
setState(nextStateForInvolvePersistentObject); // depends on control dependency: [if], data = [none]
logSpaceReserved = logSpaceReserved + logSpaceReservedDelta; // depends on control dependency: [if], data = [none]
} else { // if (token.getObjectStore().persistent).
setState(nextStateForInvolveNonPersistentObject); // depends on control dependency: [if], data = [none]
logSequenceNumber = objectManagerState.getDummyLogSequenceNumber(); // depends on control dependency: [if], data = [none]
} // If Non Persistent.
} catch (ObjectManagerException exception) {
// The write was not done.
// No FFDC Code Needed.
ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:1644:1.41");
// Drive the postDelete method for the object.
managedObject.postDelete(transaction, false);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName,
new Object[] { exception });
throw exception;
} // catch (ObjectManagerException... // depends on control dependency: [catch], data = [none]
loggedSerializedBytes.remove(managedObject.owningToken);
// The ManagedObject is now included in the transaction.
includedManagedObjects.put(managedObject.owningToken, managedObject);
// Remember which version it was when we logged it.
logSequenceNumbers.put(managedObject.owningToken,
new Long(logSequenceNumber));
managedObjectSequenceNumbers.put(managedObject.owningToken,
new Long(managedObject.getUpdateSequence()));
} // synchronized (this);
// Drive the postDelete method for the object.
managedObject.postDelete(transaction, true);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName);
} } |
public class class_name {
@Nullable
PaymentIntent confirmPaymentIntent(
@NonNull PaymentIntentParams paymentIntentParams,
@NonNull String publishableKey,
@Nullable String stripeAccount)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
APIException {
final Map<String, Object> paramMap = paymentIntentParams.toParamMap();
mNetworkUtils.addUidParamsToPaymentIntent(paramMap);
final RequestOptions options = RequestOptions.builder(publishableKey, stripeAccount,
RequestOptions.TYPE_QUERY)
.build();
try {
final String apiKey = options.getPublishableApiKey();
if (StripeTextUtils.isBlank(apiKey)) {
return null;
}
logTelemetryData();
final SourceParams sourceParams = paymentIntentParams.getSourceParams();
final String sourceType = sourceParams != null ? sourceParams.getType() : null;
final Map<String, Object> loggingParams = mLoggingUtils
.getPaymentIntentConfirmationParams(null, apiKey, sourceType);
RequestOptions loggingOptions = RequestOptions.builder(publishableKey).build();
logApiCall(loggingParams, loggingOptions);
final String paymentIntentId = PaymentIntent.parseIdFromClientSecret(
paymentIntentParams.getClientSecret());
final StripeResponse response = requestData(RequestExecutor.RestMethod.POST,
getConfirmPaymentIntentUrl(paymentIntentId), paramMap, options);
return PaymentIntent.fromString(response.getResponseBody());
} catch (CardException unexpected) {
// This particular kind of exception should not be possible from a PaymentI API endpoint
throw new APIException(unexpected.getMessage(), unexpected.getRequestId(),
unexpected.getStatusCode(), null, unexpected);
}
} } | public class class_name {
@Nullable
PaymentIntent confirmPaymentIntent(
@NonNull PaymentIntentParams paymentIntentParams,
@NonNull String publishableKey,
@Nullable String stripeAccount)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
APIException {
final Map<String, Object> paramMap = paymentIntentParams.toParamMap();
mNetworkUtils.addUidParamsToPaymentIntent(paramMap);
final RequestOptions options = RequestOptions.builder(publishableKey, stripeAccount,
RequestOptions.TYPE_QUERY)
.build();
try {
final String apiKey = options.getPublishableApiKey();
if (StripeTextUtils.isBlank(apiKey)) {
return null; // depends on control dependency: [if], data = [none]
}
logTelemetryData();
final SourceParams sourceParams = paymentIntentParams.getSourceParams();
final String sourceType = sourceParams != null ? sourceParams.getType() : null;
final Map<String, Object> loggingParams = mLoggingUtils
.getPaymentIntentConfirmationParams(null, apiKey, sourceType);
RequestOptions loggingOptions = RequestOptions.builder(publishableKey).build();
logApiCall(loggingParams, loggingOptions);
final String paymentIntentId = PaymentIntent.parseIdFromClientSecret(
paymentIntentParams.getClientSecret());
final StripeResponse response = requestData(RequestExecutor.RestMethod.POST,
getConfirmPaymentIntentUrl(paymentIntentId), paramMap, options);
return PaymentIntent.fromString(response.getResponseBody());
} catch (CardException unexpected) {
// This particular kind of exception should not be possible from a PaymentI API endpoint
throw new APIException(unexpected.getMessage(), unexpected.getRequestId(),
unexpected.getStatusCode(), null, unexpected);
}
} } |
public class class_name {
public static <X> Lens.Simple<List<X>, Maybe<X>> elementAt(int index) {
return simpleLens(xs -> maybe(xs.size() > index ? xs.get(index) : null),
(xs, maybeX) -> {
List<X> updated = new ArrayList<>(xs);
return maybeX.fmap(x -> {
int minimumSize = index + 1;
if (minimumSize > xs.size()) {
take(abs(updated.size() - minimumSize), repeat((X) null)).forEach(updated::add);
}
updated.set(index, x);
return updated;
}).orElseGet(() -> {
if (updated.size() > index) {
updated.set(index, null);
}
return updated;
});
});
} } | public class class_name {
public static <X> Lens.Simple<List<X>, Maybe<X>> elementAt(int index) {
return simpleLens(xs -> maybe(xs.size() > index ? xs.get(index) : null),
(xs, maybeX) -> {
List<X> updated = new ArrayList<>(xs);
return maybeX.fmap(x -> {
int minimumSize = index + 1;
if (minimumSize > xs.size()) {
take(abs(updated.size() - minimumSize), repeat((X) null)).forEach(updated::add); // depends on control dependency: [if], data = [none]
}
updated.set(index, x);
return updated;
}).orElseGet(() -> {
if (updated.size() > index) {
updated.set(index, null); // depends on control dependency: [if], data = [none]
}
return updated;
});
});
} } |
public class class_name {
public Object nextElement()
{
// d139782 Begins
if (hasMoreElements()) {
// d140126 Begins
// some previous nextElement call detected that the server resources has
// been released, the last element was returned. Any subsequent call
// to nextElement will result with a CollectionCannotBeFurtherAccessedException.
if (collectionExceptionPending)
{
throw new CollectionCannotBeFurtherAccessedException();
}
// d140126 Ends
// extract the next element from the local wrapper collection.
Object result = wrappers.elementAt(itrIndex++); // LIDB833.1
// test if local index has advanced to exceed the max count.
if (server == null ||
(parentCollection != null &&
((FinderResultClientCollection) parentCollection).hasAllWrappers()))
{ // server == null indicates greedy collection and all wrapper is available.
// in lazy collection and Collection interface, potentially there are other
// iterator concurrently updating the client wrapper cached in the Collection object
// this check is used to examine this iterator's parent Collection for short-cut wrapper
// retrieval.
if (itrIndex >= wrappers.size()) { // LIDB833.1
exhausted = true;
}
} else
{ // if next element index is not in the client wrapper cache,
// need to find out from the remote server to satisfy the next hasMoreElement()
// call semantics.
if (itrIndex >= wrappers.size()) { // LIDB833.1
try {
// go remote to get the next sub-collection of wrappers
Vector nextWrappers = server.getNextWrapperCollection(wrappers.size(),
chunkSize);
if (nextWrappers == null || nextWrappers.size() == 0) {
// well, there are no more from remote
exhausted = true;
if (parentCollection != null)
{ // need to inform parent Collection all wrappers has been retrieved from server.
((FinderResultClientCollection) parentCollection).allWrappersCached();
}
} else { // LIDB833.1
// append the next set of wrappers to the parent's wrapper set
wrappers.addAll(nextWrappers); // LIDB833.1
}
} catch (RemoteException rex) {
collectionExceptionPending = true; // d140126
// throw new CollectionCannotBeFurtherAccessedException(); // LIDB833.1
}
}
}
return (result);
}
// d139782 Ends
throw new NoSuchElementException();
} } | public class class_name {
public Object nextElement()
{
// d139782 Begins
if (hasMoreElements()) {
// d140126 Begins
// some previous nextElement call detected that the server resources has
// been released, the last element was returned. Any subsequent call
// to nextElement will result with a CollectionCannotBeFurtherAccessedException.
if (collectionExceptionPending)
{
throw new CollectionCannotBeFurtherAccessedException();
}
// d140126 Ends
// extract the next element from the local wrapper collection.
Object result = wrappers.elementAt(itrIndex++); // LIDB833.1
// test if local index has advanced to exceed the max count.
if (server == null ||
(parentCollection != null &&
((FinderResultClientCollection) parentCollection).hasAllWrappers()))
{ // server == null indicates greedy collection and all wrapper is available.
// in lazy collection and Collection interface, potentially there are other
// iterator concurrently updating the client wrapper cached in the Collection object
// this check is used to examine this iterator's parent Collection for short-cut wrapper
// retrieval.
if (itrIndex >= wrappers.size()) { // LIDB833.1
exhausted = true; // depends on control dependency: [if], data = [none]
}
} else
{ // if next element index is not in the client wrapper cache,
// need to find out from the remote server to satisfy the next hasMoreElement()
// call semantics.
if (itrIndex >= wrappers.size()) { // LIDB833.1
try {
// go remote to get the next sub-collection of wrappers
Vector nextWrappers = server.getNextWrapperCollection(wrappers.size(),
chunkSize);
if (nextWrappers == null || nextWrappers.size() == 0) {
// well, there are no more from remote
exhausted = true; // depends on control dependency: [if], data = [none]
if (parentCollection != null)
{ // need to inform parent Collection all wrappers has been retrieved from server.
((FinderResultClientCollection) parentCollection).allWrappersCached(); // depends on control dependency: [if], data = [none]
}
} else { // LIDB833.1
// append the next set of wrappers to the parent's wrapper set
wrappers.addAll(nextWrappers); // LIDB833.1 // depends on control dependency: [if], data = [(nextWrappers]
}
} catch (RemoteException rex) {
collectionExceptionPending = true; // d140126
// throw new CollectionCannotBeFurtherAccessedException(); // LIDB833.1
} // depends on control dependency: [catch], data = [none]
}
}
return (result); // depends on control dependency: [if], data = [none]
}
// d139782 Ends
throw new NoSuchElementException();
} } |
public class class_name {
private WsByteBuffer getSoleWriteContextBuffer() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSoleWriteContextBuffer");
WsByteBuffer writeBuffer = null;
final WsByteBuffer[] writeBuffers = writeCtx.getBuffers();
if (writeBuffers != null) {
final int writeBuffersSize = writeBuffers.length;
if (writeBuffersSize > 0) {
writeBuffer = writeBuffers[0];
if (writeBuffersSize > 1) {
writeCtx.setBuffer(writeBuffer);
for (int i = 1; i < writeBuffersSize; i++) {
if (writeBuffers[i] != null) writeBuffers[i].release();
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSoleWriteContextBuffer", writeBuffer);
return writeBuffer;
} } | public class class_name {
private WsByteBuffer getSoleWriteContextBuffer() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSoleWriteContextBuffer");
WsByteBuffer writeBuffer = null;
final WsByteBuffer[] writeBuffers = writeCtx.getBuffers();
if (writeBuffers != null) {
final int writeBuffersSize = writeBuffers.length;
if (writeBuffersSize > 0) {
writeBuffer = writeBuffers[0]; // depends on control dependency: [if], data = [none]
if (writeBuffersSize > 1) {
writeCtx.setBuffer(writeBuffer); // depends on control dependency: [if], data = [none]
for (int i = 1; i < writeBuffersSize; i++) {
if (writeBuffers[i] != null) writeBuffers[i].release();
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSoleWriteContextBuffer", writeBuffer);
return writeBuffer;
} } |
public class class_name {
public <K, V> void build(CommandArgs<K, V> args) {
// ADDJOB queue_name job <ms-timeout> [REPLICATE <count>] [DELAY <sec>] [RETRY <sec>] [TTL <sec>] [MAXLEN <count>]
// [ASYNC]
if (replicate != null) {
args.add(REPLICATE).add(replicate);
}
if (delay != null) {
args.add(CommandKeyword.DELAY).add(delay);
}
if (retry != null) {
args.add(CommandKeyword.RETRY).add(retry);
}
if (ttl != null) {
args.add(CommandKeyword.TTL).add(ttl);
}
if (maxlen != null) {
args.add(CommandKeyword.MAXLEN).add(maxlen);
}
if (async != null && async.booleanValue()) {
args.add(CommandKeyword.ASYNC);
}
} } | public class class_name {
public <K, V> void build(CommandArgs<K, V> args) {
// ADDJOB queue_name job <ms-timeout> [REPLICATE <count>] [DELAY <sec>] [RETRY <sec>] [TTL <sec>] [MAXLEN <count>]
// [ASYNC]
if (replicate != null) {
args.add(REPLICATE).add(replicate); // depends on control dependency: [if], data = [(replicate]
}
if (delay != null) {
args.add(CommandKeyword.DELAY).add(delay); // depends on control dependency: [if], data = [(delay]
}
if (retry != null) {
args.add(CommandKeyword.RETRY).add(retry); // depends on control dependency: [if], data = [(retry]
}
if (ttl != null) {
args.add(CommandKeyword.TTL).add(ttl); // depends on control dependency: [if], data = [(ttl]
}
if (maxlen != null) {
args.add(CommandKeyword.MAXLEN).add(maxlen); // depends on control dependency: [if], data = [(maxlen]
}
if (async != null && async.booleanValue()) {
args.add(CommandKeyword.ASYNC); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean start() {
Set<String> excludedMethodName = buildExcludedMethodName();
ConcurrentMap<String, AuthzHandler> authzMaps = Maps.newConcurrentMap();
//逐个访问所有注册的Controller,解析Controller及action上的所有Shiro注解。
//并依据这些注解,actionKey提前构建好权限检查处理器。
final List<Routes.Route> routeItemList = routes.getRouteItemList();
for (Routes.Route route : routeItemList) {
final Class<? extends Controller> controllerClass = route.getControllerClass();
String controllerKey = route.getControllerKey();
// 获取Controller的所有Shiro注解。
List<Annotation> controllerAnnotations = getAuthzAnnotations(controllerClass);
// 逐个遍历方法。
Method[] methods = controllerClass.getMethods();
for (Method method : methods) {
//排除掉Controller基类的所有方法,并且只关注没有参数的Action方法。
if (!excludedMethodName.contains(method.getName())
&& method.getParameterTypes().length == 0) {
//若该方法上存在ClearShiro注解,则对该action不进行访问控制检查。
if (isClearShiroAnnotationPresent(method)) {
continue;
}
//获取方法的所有Shiro注解。
List<Annotation> methodAnnotations = getAuthzAnnotations(method);
//依据Controller的注解和方法的注解来生成访问控制处理器。
AuthzHandler authzHandler = createAuthzHandler(controllerAnnotations, methodAnnotations);
//生成访问控制处理器成功。
if (authzHandler != null) {
//构建ActionKey,参考ActionMapping中实现
String actionKey = createActionKey(controllerClass, method, controllerKey);
//添加映射
authzMaps.put(actionKey, authzHandler);
}
}
}
}
//注入到ShiroKit类中。ShiroKit类以单例模式运行。
ShiroKit.init(authzMaps);
return true;
} } | public class class_name {
@Override
public boolean start() {
Set<String> excludedMethodName = buildExcludedMethodName();
ConcurrentMap<String, AuthzHandler> authzMaps = Maps.newConcurrentMap();
//逐个访问所有注册的Controller,解析Controller及action上的所有Shiro注解。
//并依据这些注解,actionKey提前构建好权限检查处理器。
final List<Routes.Route> routeItemList = routes.getRouteItemList();
for (Routes.Route route : routeItemList) {
final Class<? extends Controller> controllerClass = route.getControllerClass();
String controllerKey = route.getControllerKey();
// 获取Controller的所有Shiro注解。
List<Annotation> controllerAnnotations = getAuthzAnnotations(controllerClass);
// 逐个遍历方法。
Method[] methods = controllerClass.getMethods();
for (Method method : methods) {
//排除掉Controller基类的所有方法,并且只关注没有参数的Action方法。
if (!excludedMethodName.contains(method.getName())
&& method.getParameterTypes().length == 0) {
//若该方法上存在ClearShiro注解,则对该action不进行访问控制检查。
if (isClearShiroAnnotationPresent(method)) {
continue;
}
//获取方法的所有Shiro注解。
List<Annotation> methodAnnotations = getAuthzAnnotations(method);
//依据Controller的注解和方法的注解来生成访问控制处理器。
AuthzHandler authzHandler = createAuthzHandler(controllerAnnotations, methodAnnotations);
//生成访问控制处理器成功。
if (authzHandler != null) {
//构建ActionKey,参考ActionMapping中实现
String actionKey = createActionKey(controllerClass, method, controllerKey);
//添加映射
authzMaps.put(actionKey, authzHandler); // depends on control dependency: [if], data = [none]
}
}
}
}
//注入到ShiroKit类中。ShiroKit类以单例模式运行。
ShiroKit.init(authzMaps);
return true;
} } |
public class class_name {
public ByteBuffer getByteBuffer()
{
if (buffer == null)
{
return null;
}
if (!(buffer instanceof ByteBuffer))
{
return null;
}
ByteBuffer internalByteBuffer = (ByteBuffer)buffer;
ByteBuffer byteBuffer = internalByteBuffer.slice();
return byteBuffer.order(ByteOrder.nativeOrder());
} } | public class class_name {
public ByteBuffer getByteBuffer()
{
if (buffer == null)
{
return null;
// depends on control dependency: [if], data = [none]
}
if (!(buffer instanceof ByteBuffer))
{
return null;
// depends on control dependency: [if], data = [none]
}
ByteBuffer internalByteBuffer = (ByteBuffer)buffer;
ByteBuffer byteBuffer = internalByteBuffer.slice();
return byteBuffer.order(ByteOrder.nativeOrder());
} } |
public class class_name {
public int saveErrorLog(final PrintStream out)
{
final MappedByteBuffer cncByteBuffer = mapExistingCncFile(null);
try
{
return saveErrorLog(out, cncByteBuffer);
}
finally
{
IoUtil.unmap(cncByteBuffer);
}
} } | public class class_name {
public int saveErrorLog(final PrintStream out)
{
final MappedByteBuffer cncByteBuffer = mapExistingCncFile(null);
try
{
return saveErrorLog(out, cncByteBuffer); // depends on control dependency: [try], data = [none]
}
finally
{
IoUtil.unmap(cncByteBuffer);
}
} } |
public class class_name {
private void notifyMessageReceived(boolean lastInBatch)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "notifyMessageReceived", lastInBatch);
if (lastInBatch)
{
batchesReceived++;
batchesReady++;
}
messagesReceived++;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "notifyMessageReceived");
} } | public class class_name {
private void notifyMessageReceived(boolean lastInBatch)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "notifyMessageReceived", lastInBatch);
if (lastInBatch)
{
batchesReceived++; // depends on control dependency: [if], data = [none]
batchesReady++; // depends on control dependency: [if], data = [none]
}
messagesReceived++;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "notifyMessageReceived");
} } |
public class class_name {
protected void publishJobFinished(CmsPublishJobInfoBean publishJob) {
// in order to avoid not removable publish locks, unlock all assigned resources again
try {
unlockPublishList(publishJob);
} catch (Throwable t) {
// log failure, most likely a database problem
LOG.error(t.getLocalizedMessage(), t);
}
// trigger the old event mechanism
CmsDbContext dbc = m_dbContextFactory.getDbContext(publishJob.getCmsObject().getRequestContext());
try {
// fire an event that a project has been published
Map<String, Object> eventData = new HashMap<String, Object>();
eventData.put(I_CmsEventListener.KEY_REPORT, publishJob.getPublishReport());
eventData.put(
I_CmsEventListener.KEY_PUBLISHID,
publishJob.getPublishList().getPublishHistoryId().toString());
eventData.put(I_CmsEventListener.KEY_PROJECTID, dbc.currentProject().getUuid());
eventData.put(I_CmsEventListener.KEY_DBCONTEXT, dbc);
CmsEvent afterPublishEvent = new CmsEvent(I_CmsEventListener.EVENT_PUBLISH_PROJECT, eventData);
OpenCms.fireCmsEvent(afterPublishEvent);
} catch (Throwable t) {
if (dbc != null) {
dbc.rollback();
}
LOG.error(t.getLocalizedMessage(), t);
// catch every thing including runtime exceptions
publishJob.getPublishReport().println(t);
} finally {
if (dbc != null) {
try {
dbc.clear();
} catch (Throwable t) {
// ignore
}
dbc = null;
}
}
try {
// fire the publish finish event
m_listeners.fireFinish(new CmsPublishJobRunning(publishJob));
} catch (Throwable t) {
// log failure, most likely a database problem
LOG.error(t.getLocalizedMessage(), t);
}
try {
// finish the job
publishJob.finish();
} catch (Throwable t) {
// log failure, most likely a database problem
LOG.error(t.getLocalizedMessage(), t);
}
try {
// put the publish job into the history list
m_publishHistory.add(publishJob);
} catch (Throwable t) {
// log failure, most likely a database problem
LOG.error(t.getLocalizedMessage(), t);
}
if (Thread.currentThread() == m_currentPublishThread) {
// wipe the dead thread, only if this thread has not been abandoned
m_currentPublishThread = null;
}
// clear the published resources cache
OpenCms.getMemoryMonitor().flushCache(CmsMemoryMonitor.CacheType.PUBLISHED_RESOURCES);
// try to start a new publish job
checkCurrentPublishJobThread();
} } | public class class_name {
protected void publishJobFinished(CmsPublishJobInfoBean publishJob) {
// in order to avoid not removable publish locks, unlock all assigned resources again
try {
unlockPublishList(publishJob); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// log failure, most likely a database problem
LOG.error(t.getLocalizedMessage(), t);
} // depends on control dependency: [catch], data = [none]
// trigger the old event mechanism
CmsDbContext dbc = m_dbContextFactory.getDbContext(publishJob.getCmsObject().getRequestContext());
try {
// fire an event that a project has been published
Map<String, Object> eventData = new HashMap<String, Object>();
eventData.put(I_CmsEventListener.KEY_REPORT, publishJob.getPublishReport()); // depends on control dependency: [try], data = [none]
eventData.put(
I_CmsEventListener.KEY_PUBLISHID,
publishJob.getPublishList().getPublishHistoryId().toString()); // depends on control dependency: [try], data = [none]
eventData.put(I_CmsEventListener.KEY_PROJECTID, dbc.currentProject().getUuid()); // depends on control dependency: [try], data = [none]
eventData.put(I_CmsEventListener.KEY_DBCONTEXT, dbc); // depends on control dependency: [try], data = [none]
CmsEvent afterPublishEvent = new CmsEvent(I_CmsEventListener.EVENT_PUBLISH_PROJECT, eventData);
OpenCms.fireCmsEvent(afterPublishEvent); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
if (dbc != null) {
dbc.rollback(); // depends on control dependency: [if], data = [none]
}
LOG.error(t.getLocalizedMessage(), t);
// catch every thing including runtime exceptions
publishJob.getPublishReport().println(t);
} finally { // depends on control dependency: [catch], data = [none]
if (dbc != null) {
try {
dbc.clear(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// ignore
} // depends on control dependency: [catch], data = [none]
dbc = null; // depends on control dependency: [if], data = [none]
}
}
try {
// fire the publish finish event
m_listeners.fireFinish(new CmsPublishJobRunning(publishJob)); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// log failure, most likely a database problem
LOG.error(t.getLocalizedMessage(), t);
} // depends on control dependency: [catch], data = [none]
try {
// finish the job
publishJob.finish(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// log failure, most likely a database problem
LOG.error(t.getLocalizedMessage(), t);
} // depends on control dependency: [catch], data = [none]
try {
// put the publish job into the history list
m_publishHistory.add(publishJob); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// log failure, most likely a database problem
LOG.error(t.getLocalizedMessage(), t);
} // depends on control dependency: [catch], data = [none]
if (Thread.currentThread() == m_currentPublishThread) {
// wipe the dead thread, only if this thread has not been abandoned
m_currentPublishThread = null; // depends on control dependency: [if], data = [none]
}
// clear the published resources cache
OpenCms.getMemoryMonitor().flushCache(CmsMemoryMonitor.CacheType.PUBLISHED_RESOURCES);
// try to start a new publish job
checkCurrentPublishJobThread();
} } |
public class class_name {
public void recomputeSegmentKeys() throws IOException {
if (!closed && segmentRegistration != null) {
if (segmentRegistration.equals(SEGMENT_SORT_ASC)
|| segmentRegistration.equals(SEGMENT_SORT_DESC)
|| segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)
|| segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) {
if (segmentRegistration.equals(SEGMENT_SORT_ASC)
|| segmentRegistration.equals(SEGMENT_SORT_DESC)) {
segmentKeys.clear();
// recompute boundaries
for (Entry<String, Map<String, T1>> entry : segmentKeyValueList
.entrySet()) {
T1 tmpSegmentValueBoundary = boundaryForSegment(entry.getKey());
segmentValuesBoundary.put(entry.getKey(), tmpSegmentValueBoundary);
}
// compute adjusted boundaries and compute keys
for (Entry<String, Map<String, T1>> entry : segmentKeyValueList
.entrySet()) {
this.segmentName = entry.getKey();
Map<String, T1> keyValueList = entry.getValue();
T1 tmpSegmentValueBoundaryForComputing = boundaryForSegmentComputing(
entry.getKey());
for (Entry<String, T1> subEntry : keyValueList.entrySet()) {
if (tmpSegmentValueBoundaryForComputing == null
|| compareWithBoundary(subEntry.getValue(),
tmpSegmentValueBoundaryForComputing)) {
if (!segmentKeys.contains(subEntry.getKey())) {
segmentKeys.add(subEntry.getKey());
}
}
}
}
}
Map<String, T1> keyValueList;
Set<String> recomputeKeyList;
segmentRecomputeKeyList = new LinkedHashMap<>();
for (String key : segmentKeys) {
for (Entry<String, Map<String, T1>> entry : segmentKeyValueList
.entrySet()) {
keyValueList = entry.getValue();
if (!keyValueList.containsKey(key)) {
if (!segmentRecomputeKeyList.containsKey(entry.getKey())) {
recomputeKeyList = new HashSet<>();
segmentRecomputeKeyList.put(entry.getKey(), recomputeKeyList);
} else {
recomputeKeyList = segmentRecomputeKeyList.get(entry.getKey());
}
recomputeKeyList.add(key);
}
}
}
this.segmentName = null;
} else {
throw new IOException(
"not for segmentRegistration " + segmentRegistration);
}
} else {
throw new IOException("already closed or no segmentRegistration ("
+ segmentRegistration + ")");
}
} } | public class class_name {
public void recomputeSegmentKeys() throws IOException {
if (!closed && segmentRegistration != null) {
if (segmentRegistration.equals(SEGMENT_SORT_ASC)
|| segmentRegistration.equals(SEGMENT_SORT_DESC)
|| segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)
|| segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) {
if (segmentRegistration.equals(SEGMENT_SORT_ASC)
|| segmentRegistration.equals(SEGMENT_SORT_DESC)) {
segmentKeys.clear(); // depends on control dependency: [if], data = [none]
// recompute boundaries
for (Entry<String, Map<String, T1>> entry : segmentKeyValueList
.entrySet()) {
T1 tmpSegmentValueBoundary = boundaryForSegment(entry.getKey());
segmentValuesBoundary.put(entry.getKey(), tmpSegmentValueBoundary); // depends on control dependency: [for], data = [entry]
}
// compute adjusted boundaries and compute keys
for (Entry<String, Map<String, T1>> entry : segmentKeyValueList
.entrySet()) {
this.segmentName = entry.getKey(); // depends on control dependency: [for], data = [entry]
Map<String, T1> keyValueList = entry.getValue();
T1 tmpSegmentValueBoundaryForComputing = boundaryForSegmentComputing(
entry.getKey());
for (Entry<String, T1> subEntry : keyValueList.entrySet()) {
if (tmpSegmentValueBoundaryForComputing == null
|| compareWithBoundary(subEntry.getValue(),
tmpSegmentValueBoundaryForComputing)) {
if (!segmentKeys.contains(subEntry.getKey())) {
segmentKeys.add(subEntry.getKey()); // depends on control dependency: [if], data = [none]
}
}
}
}
}
Map<String, T1> keyValueList;
Set<String> recomputeKeyList;
segmentRecomputeKeyList = new LinkedHashMap<>();
for (String key : segmentKeys) {
for (Entry<String, Map<String, T1>> entry : segmentKeyValueList
.entrySet()) {
keyValueList = entry.getValue(); // depends on control dependency: [for], data = [entry]
if (!keyValueList.containsKey(key)) {
if (!segmentRecomputeKeyList.containsKey(entry.getKey())) {
recomputeKeyList = new HashSet<>(); // depends on control dependency: [if], data = [none]
segmentRecomputeKeyList.put(entry.getKey(), recomputeKeyList); // depends on control dependency: [if], data = [none]
} else {
recomputeKeyList = segmentRecomputeKeyList.get(entry.getKey()); // depends on control dependency: [if], data = [none]
}
recomputeKeyList.add(key); // depends on control dependency: [if], data = [none]
}
}
}
this.segmentName = null;
} else {
throw new IOException(
"not for segmentRegistration " + segmentRegistration);
}
} else {
throw new IOException("already closed or no segmentRegistration ("
+ segmentRegistration + ")");
}
} } |
public class class_name {
public boolean validateSignature(final Pair<Assertion, WsFederationConfiguration> resultPair) {
if (resultPair == null) {
LOGGER.warn("No assertion or its configuration was provided to validate signatures");
return false;
}
val configuration = resultPair.getValue();
val assertion = resultPair.getKey();
if (assertion == null || configuration == null) {
LOGGER.warn("No signature or configuration was provided to validate signatures");
return false;
}
val signature = assertion.getSignature();
if (signature == null) {
LOGGER.warn("No signature is attached to the assertion to validate");
return false;
}
try {
LOGGER.debug("Validating the signature...");
val validator = new SAMLSignatureProfileValidator();
validator.validate(signature);
val criteriaSet = new CriteriaSet();
criteriaSet.add(new UsageCriterion(UsageType.SIGNING));
criteriaSet.add(new EntityRoleCriterion(IDPSSODescriptor.DEFAULT_ELEMENT_NAME));
criteriaSet.add(new ProtocolCriterion(SAMLConstants.SAML20P_NS));
criteriaSet.add(new EntityIdCriterion(configuration.getIdentityProviderIdentifier()));
try {
val engine = buildSignatureTrustEngine(configuration);
LOGGER.debug("Validating signature via trust engine for [{}]", configuration.getIdentityProviderIdentifier());
return engine.validate(signature, criteriaSet);
} catch (final SecurityException e) {
LOGGER.warn(e.getMessage(), e);
}
} catch (final SignatureException e) {
LOGGER.error("Failed to validate assertion signature", e);
}
SamlUtils.logSamlObject(this.configBean, assertion);
LOGGER.error("Signature doesn't match any signing credential and cannot be validated.");
return false;
} } | public class class_name {
public boolean validateSignature(final Pair<Assertion, WsFederationConfiguration> resultPair) {
if (resultPair == null) {
LOGGER.warn("No assertion or its configuration was provided to validate signatures"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
val configuration = resultPair.getValue();
val assertion = resultPair.getKey();
if (assertion == null || configuration == null) {
LOGGER.warn("No signature or configuration was provided to validate signatures"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
val signature = assertion.getSignature();
if (signature == null) {
LOGGER.warn("No signature is attached to the assertion to validate"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
try {
LOGGER.debug("Validating the signature..."); // depends on control dependency: [try], data = [none]
val validator = new SAMLSignatureProfileValidator();
validator.validate(signature); // depends on control dependency: [try], data = [none]
val criteriaSet = new CriteriaSet();
criteriaSet.add(new UsageCriterion(UsageType.SIGNING)); // depends on control dependency: [try], data = [none]
criteriaSet.add(new EntityRoleCriterion(IDPSSODescriptor.DEFAULT_ELEMENT_NAME)); // depends on control dependency: [try], data = [none]
criteriaSet.add(new ProtocolCriterion(SAMLConstants.SAML20P_NS)); // depends on control dependency: [try], data = [none]
criteriaSet.add(new EntityIdCriterion(configuration.getIdentityProviderIdentifier())); // depends on control dependency: [try], data = [none]
try {
val engine = buildSignatureTrustEngine(configuration);
LOGGER.debug("Validating signature via trust engine for [{}]", configuration.getIdentityProviderIdentifier()); // depends on control dependency: [try], data = [none]
return engine.validate(signature, criteriaSet); // depends on control dependency: [try], data = [none]
} catch (final SecurityException e) {
LOGGER.warn(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} catch (final SignatureException e) {
LOGGER.error("Failed to validate assertion signature", e);
} // depends on control dependency: [catch], data = [none]
SamlUtils.logSamlObject(this.configBean, assertion);
LOGGER.error("Signature doesn't match any signing credential and cannot be validated.");
return false;
} } |
public class class_name {
public <E> long increment(PartitionKey key, String fieldName, long amount,
EntityMapper<E> entityMapper) {
Increment increment = entityMapper.mapToIncrement(key, fieldName, amount);
HTableInterface table = pool.getTable(tableName);
Result result;
try {
result = table.increment(increment);
} catch (IOException e) {
throw new DatasetIOException("Error incrementing field.", e);
}
return entityMapper.mapFromIncrementResult(result, fieldName);
} } | public class class_name {
public <E> long increment(PartitionKey key, String fieldName, long amount,
EntityMapper<E> entityMapper) {
Increment increment = entityMapper.mapToIncrement(key, fieldName, amount);
HTableInterface table = pool.getTable(tableName);
Result result;
try {
result = table.increment(increment); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new DatasetIOException("Error incrementing field.", e);
} // depends on control dependency: [catch], data = [none]
return entityMapper.mapFromIncrementResult(result, fieldName);
} } |
public class class_name {
private List<Integer> getFreeValenciesForRingGroup(IAtomContainer molecule, List<Integer> atomsToCheck, Matrix M,
IRingSet rs) {
List<Integer> fvtc = new ArrayList<Integer>();
for (int i = 0; i < atomsToCheck.size(); i++) {
int j = atomsToCheck.get(i);
//Put in an implicit hydrogen atom for Planar3 C- atoms in 5-membered rings (it doesn't get put in by the Smiles parser)
if (("C".equals(molecule.getAtom(j).getSymbol()))
&& (molecule.getAtom(j).getHybridization() == Hybridization.PLANAR3)) {
//Check that ring containing the atom is five-membered
for (IAtomContainer ac : rs.atomContainers()) {
if (ac.contains(molecule.getAtom(j))) {
if ((int) molecule.getBondOrderSum(molecule.getAtom(j)) == 2 && ac.getAtomCount() == 5) {
molecule.getAtom(j).setImplicitHydrogenCount(1);
break;
}
}
}
}
int implicitH = 0;
if (molecule.getAtom(j).getImplicitHydrogenCount() == null) {
CDKHydrogenAdder ha = CDKHydrogenAdder.getInstance(molecule.getBuilder());
try {
ha.addImplicitHydrogens(molecule, molecule.getAtom(j));
implicitH = molecule.getAtom(j).getImplicitHydrogenCount();
} catch (CDKException e) {
//No need to do anything because implicitH already set to 0
}
} else {
implicitH = molecule.getAtom(j).getImplicitHydrogenCount();
}
fvtc.add(molecule.getAtom(j).getValency()
- (implicitH + (int) molecule.getBondOrderSum(molecule.getAtom(j))) + M.sumOfRow(i));
}
return fvtc;
} } | public class class_name {
private List<Integer> getFreeValenciesForRingGroup(IAtomContainer molecule, List<Integer> atomsToCheck, Matrix M,
IRingSet rs) {
List<Integer> fvtc = new ArrayList<Integer>();
for (int i = 0; i < atomsToCheck.size(); i++) {
int j = atomsToCheck.get(i);
//Put in an implicit hydrogen atom for Planar3 C- atoms in 5-membered rings (it doesn't get put in by the Smiles parser)
if (("C".equals(molecule.getAtom(j).getSymbol()))
&& (molecule.getAtom(j).getHybridization() == Hybridization.PLANAR3)) {
//Check that ring containing the atom is five-membered
for (IAtomContainer ac : rs.atomContainers()) {
if (ac.contains(molecule.getAtom(j))) {
if ((int) molecule.getBondOrderSum(molecule.getAtom(j)) == 2 && ac.getAtomCount() == 5) {
molecule.getAtom(j).setImplicitHydrogenCount(1); // depends on control dependency: [if], data = [none]
break;
}
}
}
}
int implicitH = 0;
if (molecule.getAtom(j).getImplicitHydrogenCount() == null) {
CDKHydrogenAdder ha = CDKHydrogenAdder.getInstance(molecule.getBuilder());
try {
ha.addImplicitHydrogens(molecule, molecule.getAtom(j)); // depends on control dependency: [try], data = [none]
implicitH = molecule.getAtom(j).getImplicitHydrogenCount(); // depends on control dependency: [try], data = [none]
} catch (CDKException e) {
//No need to do anything because implicitH already set to 0
} // depends on control dependency: [catch], data = [none]
} else {
implicitH = molecule.getAtom(j).getImplicitHydrogenCount(); // depends on control dependency: [if], data = [none]
}
fvtc.add(molecule.getAtom(j).getValency()
- (implicitH + (int) molecule.getBondOrderSum(molecule.getAtom(j))) + M.sumOfRow(i)); // depends on control dependency: [for], data = [none]
}
return fvtc;
} } |
public class class_name {
public Process getProcessByVersion(String name, Integer version) {
AssertHelper.notEmpty(name);
if(version == null) {
version = access().getLatestProcessVersion(name);
}
if(version == null) {
version = 0;
}
Process entity = null;
String processName = name + DEFAULT_SEPARATOR + version;
Cache<String, Process> entityCache = ensureAvailableEntityCache();
if(entityCache != null) {
entity = entityCache.get(processName);
}
if(entity != null) {
if(log.isDebugEnabled()) {
log.debug("obtain process[name={}] from cache.", processName);
}
return entity;
}
List<Process> processs = access().getProcesss(null, new QueryFilter().setName(name).setVersion(version));
if(processs != null && !processs.isEmpty()) {
if(log.isDebugEnabled()) {
log.debug("obtain process[name={}] from database.", processName);
}
entity = processs.get(0);
cache(entity);
}
return entity;
} } | public class class_name {
public Process getProcessByVersion(String name, Integer version) {
AssertHelper.notEmpty(name);
if(version == null) {
version = access().getLatestProcessVersion(name); // depends on control dependency: [if], data = [none]
}
if(version == null) {
version = 0; // depends on control dependency: [if], data = [none]
}
Process entity = null;
String processName = name + DEFAULT_SEPARATOR + version;
Cache<String, Process> entityCache = ensureAvailableEntityCache();
if(entityCache != null) {
entity = entityCache.get(processName); // depends on control dependency: [if], data = [none]
}
if(entity != null) {
if(log.isDebugEnabled()) {
log.debug("obtain process[name={}] from cache.", processName);
}
return entity;
}
List<Process> processs = access().getProcesss(null, new QueryFilter().setName(name).setVersion(version));
if(processs != null && !processs.isEmpty()) {
if(log.isDebugEnabled()) {
log.debug("obtain process[name={}] from database.", processName);
}
entity = processs.get(0);
cache(entity);
}
return entity;
} } |
public class class_name {
public final Object handleRestReturnType(Mono<HttpDecodedResponse> asyncHttpDecodedResponse, final SwaggerMethodParser methodParser, final Type returnType) {
final Mono<HttpDecodedResponse> asyncExpectedResponse = ensureExpectedStatus(asyncHttpDecodedResponse, methodParser);
final Object result;
if (TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class)) {
final Type monoTypeParam = TypeUtil.getTypeArgument(returnType);
if (TypeUtil.isTypeOrSubTypeOf(monoTypeParam, Void.class)) {
// ProxyMethod ReturnType: Mono<Void>
result = asyncExpectedResponse.then();
} else {
// ProxyMethod ReturnType: Mono<? extends RestResponseBase<?, ?>>
result = asyncExpectedResponse.flatMap(response ->
handleRestResponseReturnType(response, methodParser, monoTypeParam));
}
} else if (FluxUtil.isFluxByteBuf(returnType)) {
// ProxyMethod ReturnType: Flux<ByteBuf>
result = asyncExpectedResponse.flatMapMany(ar -> ar.sourceResponse().body());
} else if (TypeUtil.isTypeOrSubTypeOf(returnType, void.class) || TypeUtil.isTypeOrSubTypeOf(returnType, Void.class)) {
// ProxyMethod ReturnType: Void
asyncExpectedResponse.block();
result = null;
} else {
// ProxyMethod ReturnType: T where T != async (Mono, Flux) or sync Void
// Block the deserialization until a value T is received
result = asyncExpectedResponse
.flatMap(httpResponse -> handleRestResponseReturnType(httpResponse, methodParser, returnType))
.block();
}
return result;
} } | public class class_name {
public final Object handleRestReturnType(Mono<HttpDecodedResponse> asyncHttpDecodedResponse, final SwaggerMethodParser methodParser, final Type returnType) {
final Mono<HttpDecodedResponse> asyncExpectedResponse = ensureExpectedStatus(asyncHttpDecodedResponse, methodParser);
final Object result;
if (TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class)) {
final Type monoTypeParam = TypeUtil.getTypeArgument(returnType);
if (TypeUtil.isTypeOrSubTypeOf(monoTypeParam, Void.class)) {
// ProxyMethod ReturnType: Mono<Void>
result = asyncExpectedResponse.then(); // depends on control dependency: [if], data = [none]
} else {
// ProxyMethod ReturnType: Mono<? extends RestResponseBase<?, ?>>
result = asyncExpectedResponse.flatMap(response ->
handleRestResponseReturnType(response, methodParser, monoTypeParam)); // depends on control dependency: [if], data = [none]
}
} else if (FluxUtil.isFluxByteBuf(returnType)) {
// ProxyMethod ReturnType: Flux<ByteBuf>
result = asyncExpectedResponse.flatMapMany(ar -> ar.sourceResponse().body()); // depends on control dependency: [if], data = [none]
} else if (TypeUtil.isTypeOrSubTypeOf(returnType, void.class) || TypeUtil.isTypeOrSubTypeOf(returnType, Void.class)) {
// ProxyMethod ReturnType: Void
asyncExpectedResponse.block(); // depends on control dependency: [if], data = [none]
result = null; // depends on control dependency: [if], data = [none]
} else {
// ProxyMethod ReturnType: T where T != async (Mono, Flux) or sync Void
// Block the deserialization until a value T is received
result = asyncExpectedResponse
.flatMap(httpResponse -> handleRestResponseReturnType(httpResponse, methodParser, returnType))
.block(); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static Vec numericToCategorical(Vec src) {
if (src.isInt()) {
int min = (int) src.min(), max = (int) src.max();
// try to do the fast domain collection
long dom[] = (min >= 0 && max < Integer.MAX_VALUE - 4) ? new CollectDomainFast(max).doAll(src).domain() : new CollectIntegerDomain().doAll(src).domain();
if (dom.length > Categorical.MAX_CATEGORICAL_COUNT)
throw new H2OIllegalArgumentException("Column domain is too large to be represented as an categorical: " + dom.length + " > " + Categorical.MAX_CATEGORICAL_COUNT);
return copyOver(src, Vec.T_CAT, dom);
} else if(src.isNumeric()){
final double [] dom = new CollectDoubleDomain(null,10000).doAll(src).domain();
String [] strDom = new String[dom.length];
for(int i = 0; i < dom.length; ++i)
strDom[i] = String.valueOf(dom[i]);
Vec dst = src.makeZero(strDom);
new MRTask(){
@Override public void map(Chunk c0, Chunk c1){
for(int r = 0; r < c0._len; ++r){
double d = c0.atd(r);
if(Double.isNaN(d))
c1.setNA(r);
else
c1.set(r,Arrays.binarySearch(dom,d));
}
}
}.doAll(new Vec[]{src,dst});
assert dst.min() == 0;
assert dst.max() == dom.length-1;
return dst;
} else throw new IllegalArgumentException("calling numericToCategorical conversion on a non numeric column");
} } | public class class_name {
public static Vec numericToCategorical(Vec src) {
if (src.isInt()) {
int min = (int) src.min(), max = (int) src.max();
// try to do the fast domain collection
long dom[] = (min >= 0 && max < Integer.MAX_VALUE - 4) ? new CollectDomainFast(max).doAll(src).domain() : new CollectIntegerDomain().doAll(src).domain();
if (dom.length > Categorical.MAX_CATEGORICAL_COUNT)
throw new H2OIllegalArgumentException("Column domain is too large to be represented as an categorical: " + dom.length + " > " + Categorical.MAX_CATEGORICAL_COUNT);
return copyOver(src, Vec.T_CAT, dom); // depends on control dependency: [if], data = [none]
} else if(src.isNumeric()){
final double [] dom = new CollectDoubleDomain(null,10000).doAll(src).domain();
String [] strDom = new String[dom.length];
for(int i = 0; i < dom.length; ++i)
strDom[i] = String.valueOf(dom[i]);
Vec dst = src.makeZero(strDom);
new MRTask(){
@Override public void map(Chunk c0, Chunk c1){
for(int r = 0; r < c0._len; ++r){
double d = c0.atd(r);
if(Double.isNaN(d))
c1.setNA(r);
else
c1.set(r,Arrays.binarySearch(dom,d));
}
}
}.doAll(new Vec[]{src,dst}); // depends on control dependency: [if], data = [none]
assert dst.min() == 0;
assert dst.max() == dom.length-1; // depends on control dependency: [if], data = [none]
return dst; // depends on control dependency: [if], data = [none]
} else throw new IllegalArgumentException("calling numericToCategorical conversion on a non numeric column");
} } |
public class class_name {
public String getDisplayName() {
StringBuilder name = new StringBuilder();
// add indentation representing tree structure of tasks
for (int i = 0; i < this.getSubtaskLevel() -1; i++) {
if (this.isLastSubtaskOnLevel[i]) {
name.append(" ");
}
else {
name.append("│ ");
}
}
if (this.getSubtaskLevel() > 0) {
if (this.isLastSubtaskOnLevel[this.getSubtaskLevel() - 1])
{
name.append("└──");
}
else {
name.append("├──");
}
}
// append class name
name.append(this.getClass().getSimpleName());
// append optional suffix
name.append(" ").append(this.nameSuffix);
return name.toString();
} } | public class class_name {
public String getDisplayName() {
StringBuilder name = new StringBuilder();
// add indentation representing tree structure of tasks
for (int i = 0; i < this.getSubtaskLevel() -1; i++) {
if (this.isLastSubtaskOnLevel[i]) {
name.append(" "); // depends on control dependency: [if], data = [none]
}
else {
name.append("│ "); // depends on control dependency: [if], data = [none]
}
}
if (this.getSubtaskLevel() > 0) {
if (this.isLastSubtaskOnLevel[this.getSubtaskLevel() - 1])
{
name.append("└──"); // depends on control dependency: [if], data = [none]
}
else {
name.append("├──"); // depends on control dependency: [if], data = [none]
}
}
// append class name
name.append(this.getClass().getSimpleName());
// append optional suffix
name.append(" ").append(this.nameSuffix);
return name.toString();
} } |
public class class_name {
public Object get(Map<String, Object> data, String name) {
Object value = data.get(name);
if (null == value) return null;
if (value.getClass().isArray()) {
Object[] values = (Object[]) value;
if (values.length == 1) { return values[0]; }
}
return value;
} } | public class class_name {
public Object get(Map<String, Object> data, String name) {
Object value = data.get(name);
if (null == value) return null;
if (value.getClass().isArray()) {
Object[] values = (Object[]) value;
if (values.length == 1) { return values[0]; } // depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
public static String getKeyList(Iterator<Key> it, String delimiter) {
StringBuilder sb = new StringBuilder(it.next().getString());
if (delimiter.length() == 1) {
char c = delimiter.charAt(0);
while (it.hasNext()) {
sb.append(c);
sb.append(it.next().getString());
}
}
else {
while (it.hasNext()) {
sb.append(delimiter);
sb.append(it.next().getString());
}
}
return sb.toString();
} } | public class class_name {
public static String getKeyList(Iterator<Key> it, String delimiter) {
StringBuilder sb = new StringBuilder(it.next().getString());
if (delimiter.length() == 1) {
char c = delimiter.charAt(0);
while (it.hasNext()) {
sb.append(c); // depends on control dependency: [while], data = [none]
sb.append(it.next().getString()); // depends on control dependency: [while], data = [none]
}
}
else {
while (it.hasNext()) {
sb.append(delimiter); // depends on control dependency: [while], data = [none]
sb.append(it.next().getString()); // depends on control dependency: [while], data = [none]
}
}
return sb.toString();
} } |
public class class_name {
public void marshall(GetAppRequest getAppRequest, ProtocolMarshaller protocolMarshaller) {
if (getAppRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getAppRequest.getApplicationId(), APPLICATIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetAppRequest getAppRequest, ProtocolMarshaller protocolMarshaller) {
if (getAppRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getAppRequest.getApplicationId(), APPLICATIONID_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 Features getFeaturesFromRequest(HttpServletRequest request, boolean versionError) throws IOException {
final String sourceMethod = "getFeaturesFromRequest"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request, versionError});
}
StringBuffer sb = request.getRequestURL();
if (sb != null && request.getQueryString() != null) {
sb.append("?").append(request.getQueryString()); //$NON-NLS-1$
}
Features defaultFeatures = getAggregator().getConfig().getDefaultFeatures(sb != null ? sb.toString() : null);
Features features = null;
if (!versionError) { // don't trust feature encoding if version changed
features = getFeaturesFromRequestEncoded(request, defaultFeatures);
}
if (features == null) {
features = new Features(defaultFeatures);
String has = getHasConditionsFromRequest(request);
if (has != null) {
for (String s : has.split("[;,*]")) { //$NON-NLS-1$
boolean value = true;
if (s.startsWith("!")) { //$NON-NLS-1$
s = s.substring(1);
value = false;
}
features.put(s, value);
}
}
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, features);
}
return features.unmodifiableFeatures();
} } | public class class_name {
protected Features getFeaturesFromRequest(HttpServletRequest request, boolean versionError) throws IOException {
final String sourceMethod = "getFeaturesFromRequest"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request, versionError});
}
StringBuffer sb = request.getRequestURL();
if (sb != null && request.getQueryString() != null) {
sb.append("?").append(request.getQueryString()); //$NON-NLS-1$
}
Features defaultFeatures = getAggregator().getConfig().getDefaultFeatures(sb != null ? sb.toString() : null);
Features features = null;
if (!versionError) { // don't trust feature encoding if version changed
features = getFeaturesFromRequestEncoded(request, defaultFeatures);
}
if (features == null) {
features = new Features(defaultFeatures);
String has = getHasConditionsFromRequest(request);
if (has != null) {
for (String s : has.split("[;,*]")) { //$NON-NLS-1$
boolean value = true;
if (s.startsWith("!")) { //$NON-NLS-1$
s = s.substring(1);
// depends on control dependency: [if], data = [none]
value = false;
// depends on control dependency: [if], data = [none]
}
features.put(s, value);
}
}
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, features);
}
return features.unmodifiableFeatures();
} } |
public class class_name {
protected synchronized void stopService() {
if (deploymentMD != null) {
if (deploymentMD.getResourceAdapterKey() != null) {
try {
raRepository.getValue().unregisterResourceAdapter(deploymentMD.getResourceAdapterKey());
} catch (org.jboss.jca.core.spi.rar.NotFoundException nfe) {
ConnectorLogger.ROOT_LOGGER.exceptionDuringUnregistering(nfe);
}
}
if (deploymentMD.getResourceAdapter() != null) {
deploymentMD.getResourceAdapter().stop();
if (BootstrapContextCoordinator.getInstance() != null && deploymentMD.getBootstrapContextIdentifier() != null) {
BootstrapContextCoordinator.getInstance().removeBootstrapContext(deploymentMD.getBootstrapContextIdentifier());
}
}
if (deploymentMD.getDataSources() != null && managementRepositoryValue.getValue() != null) {
for (org.jboss.jca.core.api.management.DataSource mgtDs : deploymentMD.getDataSources()) {
managementRepositoryValue.getValue().getDataSources().remove(mgtDs);
}
}
if (deploymentMD.getConnectionManagers() != null) {
for (ConnectionManager cm : deploymentMD.getConnectionManagers()) {
cm.shutdown();
}
}
}
sqlDataSource = null;
} } | public class class_name {
protected synchronized void stopService() {
if (deploymentMD != null) {
if (deploymentMD.getResourceAdapterKey() != null) {
try {
raRepository.getValue().unregisterResourceAdapter(deploymentMD.getResourceAdapterKey()); // depends on control dependency: [try], data = [none]
} catch (org.jboss.jca.core.spi.rar.NotFoundException nfe) {
ConnectorLogger.ROOT_LOGGER.exceptionDuringUnregistering(nfe);
} // depends on control dependency: [catch], data = [none]
}
if (deploymentMD.getResourceAdapter() != null) {
deploymentMD.getResourceAdapter().stop(); // depends on control dependency: [if], data = [none]
if (BootstrapContextCoordinator.getInstance() != null && deploymentMD.getBootstrapContextIdentifier() != null) {
BootstrapContextCoordinator.getInstance().removeBootstrapContext(deploymentMD.getBootstrapContextIdentifier()); // depends on control dependency: [if], data = [none]
}
}
if (deploymentMD.getDataSources() != null && managementRepositoryValue.getValue() != null) {
for (org.jboss.jca.core.api.management.DataSource mgtDs : deploymentMD.getDataSources()) {
managementRepositoryValue.getValue().getDataSources().remove(mgtDs); // depends on control dependency: [for], data = [mgtDs]
}
}
if (deploymentMD.getConnectionManagers() != null) {
for (ConnectionManager cm : deploymentMD.getConnectionManagers()) {
cm.shutdown(); // depends on control dependency: [for], data = [cm]
}
}
}
sqlDataSource = null;
} } |
public class class_name {
RunnablePair takeAndClear() {
RunnablePair entries;
while ((entries = callbacks.get()) != END) {
if (callbacks.compareAndSet(entries, END)) {
return entries;
}
}
return null;
} } | public class class_name {
RunnablePair takeAndClear() {
RunnablePair entries;
while ((entries = callbacks.get()) != END) {
if (callbacks.compareAndSet(entries, END)) {
return entries; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private AuthorizationService getAuthorizationService(String id) {
AuthorizationService service = authorization.getService(id);
if (service == null) {
throwIllegalArgumentExceptionInvalidAttributeValue(SecurityConfiguration.CFG_KEY_AUTHORIZATION_REF, id);
}
return service;
} } | public class class_name {
private AuthorizationService getAuthorizationService(String id) {
AuthorizationService service = authorization.getService(id);
if (service == null) {
throwIllegalArgumentExceptionInvalidAttributeValue(SecurityConfiguration.CFG_KEY_AUTHORIZATION_REF, id); // depends on control dependency: [if], data = [none]
}
return service;
} } |
public class class_name {
public EClass getIfcProject() {
if (ifcProjectEClass == null) {
ifcProjectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(392);
}
return ifcProjectEClass;
} } | public class class_name {
public EClass getIfcProject() {
if (ifcProjectEClass == null) {
ifcProjectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(392);
// depends on control dependency: [if], data = [none]
}
return ifcProjectEClass;
} } |
public class class_name {
public static String pingJdbcEndpoint(MuleContext muleContext, String muleJdbcDataSourceName, String tableName) {
DataSource ds = JdbcUtil.lookupDataSource(muleContext, muleJdbcDataSourceName);
Connection c = null;
Statement s = null;
ResultSet rs = null;
try {
c = ds.getConnection();
s = c.createStatement();
rs = s.executeQuery("select 1 from " + tableName);
} catch (SQLException e) {
return ERROR_PREFIX + ": The table " + tableName + " was not found in the data source " + muleJdbcDataSourceName + ", reason: " + e.getMessage();
} finally {
try {if (rs != null) rs.close();} catch (SQLException e) {}
try {if ( s != null) s.close();} catch (SQLException e) {}
try {if ( c != null) c.close();} catch (SQLException e) {}
}
return OK_PREFIX + ": The table " + tableName + " was found in the data source " + muleJdbcDataSourceName;
} } | public class class_name {
public static String pingJdbcEndpoint(MuleContext muleContext, String muleJdbcDataSourceName, String tableName) {
DataSource ds = JdbcUtil.lookupDataSource(muleContext, muleJdbcDataSourceName);
Connection c = null;
Statement s = null;
ResultSet rs = null;
try {
c = ds.getConnection(); // depends on control dependency: [try], data = [none]
s = c.createStatement(); // depends on control dependency: [try], data = [none]
rs = s.executeQuery("select 1 from " + tableName); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
return ERROR_PREFIX + ": The table " + tableName + " was not found in the data source " + muleJdbcDataSourceName + ", reason: " + e.getMessage();
} finally { // depends on control dependency: [catch], data = [none]
try {if (rs != null) rs.close();} catch (SQLException e) {} // depends on control dependency: [catch], data = [none]
try {if ( s != null) s.close();} catch (SQLException e) {} // depends on control dependency: [catch], data = [none]
try {if ( c != null) c.close();} catch (SQLException e) {} // depends on control dependency: [catch], data = [none]
}
return OK_PREFIX + ": The table " + tableName + " was found in the data source " + muleJdbcDataSourceName;
} } |
public class class_name {
protected static LineAndColumn getLineAndColumn(String text, int[] lineBreaks, int offset) {
if (offset > text.length() || offset < 0) {
throw new IndexOutOfBoundsException();
}
int idx = Arrays.binarySearch(lineBreaks, offset);
if (idx >= 0) {
/*
* We found an entry in the array. The offset is a line break.
* The line number is the idx in the array, the column needs to be
* adjusted.
*/
return getLineAndColumnOfLineBreak(text, lineBreaks, idx, offset);
} else {
// if not found, the result of a binary search `-(insertion point) - 1`
int insertionPoint = -(idx + 1);
return getLineAndColumnNoExactLineBreak(text, lineBreaks, insertionPoint, offset);
}
} } | public class class_name {
protected static LineAndColumn getLineAndColumn(String text, int[] lineBreaks, int offset) {
if (offset > text.length() || offset < 0) {
throw new IndexOutOfBoundsException();
}
int idx = Arrays.binarySearch(lineBreaks, offset);
if (idx >= 0) {
/*
* We found an entry in the array. The offset is a line break.
* The line number is the idx in the array, the column needs to be
* adjusted.
*/
return getLineAndColumnOfLineBreak(text, lineBreaks, idx, offset); // depends on control dependency: [if], data = [none]
} else {
// if not found, the result of a binary search `-(insertion point) - 1`
int insertionPoint = -(idx + 1);
return getLineAndColumnNoExactLineBreak(text, lineBreaks, insertionPoint, offset); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Collection<String> getPropertiesNames(Stanza packet) {
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe == null) {
return Collections.emptyList();
}
return jpe.getPropertyNames();
} } | public class class_name {
public static Collection<String> getPropertiesNames(Stanza packet) {
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.NAMESPACE);
if (jpe == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return jpe.getPropertyNames();
} } |
public class class_name {
public LdapGroup getGroupTemplate(String cn) {
LdapGroup group = new LdapGroup(cn, this);
group.set("dn", getDNForNode(group));
for (String oc : groupObjectClasses) {
group.addObjectClass(oc.trim());
}
group = (LdapGroup) updateObjectClasses(group);
// TODO this needs to be cleaner :-/.
// for inetOrgPerson
if (group.getObjectClasses().contains("shadowAccount")) {
group.set("uid", cn);
}
// for groupOfNames
// First User is always the Principal
group.addUser((LdapUser) getPrincipal());
return group;
} } | public class class_name {
public LdapGroup getGroupTemplate(String cn) {
LdapGroup group = new LdapGroup(cn, this);
group.set("dn", getDNForNode(group));
for (String oc : groupObjectClasses) {
group.addObjectClass(oc.trim()); // depends on control dependency: [for], data = [oc]
}
group = (LdapGroup) updateObjectClasses(group);
// TODO this needs to be cleaner :-/.
// for inetOrgPerson
if (group.getObjectClasses().contains("shadowAccount")) {
group.set("uid", cn); // depends on control dependency: [if], data = [none]
}
// for groupOfNames
// First User is always the Principal
group.addUser((LdapUser) getPrincipal());
return group;
} } |
public class class_name {
public AbstractLongList times(int times) {
AbstractLongList newList = new LongArrayList(times*size());
for (int i=times; --i >= 0; ) {
newList.addAllOfFromTo(this,0,size()-1);
}
return newList;
} } | public class class_name {
public AbstractLongList times(int times) {
AbstractLongList newList = new LongArrayList(times*size());
for (int i=times; --i >= 0; ) {
newList.addAllOfFromTo(this,0,size()-1);
// depends on control dependency: [for], data = [none]
}
return newList;
} } |
public class class_name {
private String inClause(String field, Set<String> values) {
String separator = "";
StringBuffer sb = new StringBuffer(" and (");
for (String v : values) {
sb.append(separator);
sb.append(String.format("%s = '%s'", field, v));
separator = " or ";
}
sb.append(")");
return sb.toString();
} } | public class class_name {
private String inClause(String field, Set<String> values) {
String separator = "";
StringBuffer sb = new StringBuffer(" and (");
for (String v : values) {
sb.append(separator); // depends on control dependency: [for], data = [none]
sb.append(String.format("%s = '%s'", field, v)); // depends on control dependency: [for], data = [v]
separator = " or "; // depends on control dependency: [for], data = [none]
}
sb.append(")");
return sb.toString();
} } |
public class class_name {
private void verifyTemplate(Template<?> template, LinkedHashSet<String> templates) {
String id = template.getKey();
// Sprawdzanie, czy w gałęzi wywołań szablonów nie ma zapętlenia:
if(templates.contains(id)) {
// Wyświetlanie gałęzi z zapętleniem i wyrzucanie wyjątku:
Iterator<String> t = templates.iterator();
System.out.print(t.next());
while(t.hasNext()) {
System.out.print("->" + t.next());
}
System.out.println("->" + id);
throw new IllegalStateException("Zapętlenie wywołań szablonu '" + id + "'");
}
// Szablon OK. Dodawanie do zbioru szablonów gałęzi:
templates.add(id);
// // Sprawdzanie każdego z podszablonów szablonu:
// if(template.getReferences() != null) {
// for(TemplateReference reference : template.getReferences()) {
// verifyTemplate(reference, templates);
// }
// }
} } | public class class_name {
private void verifyTemplate(Template<?> template, LinkedHashSet<String> templates) {
String id = template.getKey();
// Sprawdzanie, czy w gałęzi wywołań szablonów nie ma zapętlenia:
if(templates.contains(id)) {
// Wyświetlanie gałęzi z zapętleniem i wyrzucanie wyjątku:
Iterator<String> t = templates.iterator();
System.out.print(t.next()); // depends on control dependency: [if], data = [none]
while(t.hasNext()) {
System.out.print("->" + t.next()); // depends on control dependency: [while], data = [none]
}
System.out.println("->" + id); // depends on control dependency: [if], data = [none]
throw new IllegalStateException("Zapętlenie wywołań szablonu '" + id + "'");
}
// Szablon OK. Dodawanie do zbioru szablonów gałęzi:
templates.add(id);
// // Sprawdzanie każdego z podszablonów szablonu:
// if(template.getReferences() != null) {
// for(TemplateReference reference : template.getReferences()) {
// verifyTemplate(reference, templates);
// }
// }
} } |
public class class_name {
public void load() throws Exception {
// Get the resource name
String resourceName = System.getProperty(CONFIG_FILENAME_KEY);
if (resourceName == null) {
throw new IllegalStateException("No value set for system property: "
+ CONFIG_FILENAME_KEY);
}
// Load the resource
InputStream in = null;
try {
in = ClassLoader.getSystemResourceAsStream(resourceName);
if (in == null) {
throw new IllegalStateException(resourceName +
" loaded as system resource is null");
}
//Do the XML parsing
parse(in);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ioe) {
//Nothing to do at this point.
}
}
}
} } | public class class_name {
public void load() throws Exception {
// Get the resource name
String resourceName = System.getProperty(CONFIG_FILENAME_KEY);
if (resourceName == null) {
throw new IllegalStateException("No value set for system property: "
+ CONFIG_FILENAME_KEY);
}
// Load the resource
InputStream in = null;
try {
in = ClassLoader.getSystemResourceAsStream(resourceName);
if (in == null) {
throw new IllegalStateException(resourceName +
" loaded as system resource is null");
}
//Do the XML parsing
parse(in);
} finally {
if (in != null) {
try {
in.close(); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
//Nothing to do at this point.
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public String messageLogFormat(GenericData genData) {
// This is a very light trace format, based on enhanced:
StringBuilder sb = new StringBuilder(256);
String name = null;
KeyValuePair[] pairs = genData.getPairs();
KeyValuePair kvp = null;
String message = null;
Long datetime = null;
String level = "";
String loggerName = null;
String srcClassName = null;
String throwable = null;
for (KeyValuePair p : pairs) {
if (p != null && !p.isList()) {
kvp = p;
if (kvp.getKey().equals(LogFieldConstants.MESSAGE)) {
message = kvp.getStringValue();
} else if (kvp.getKey().equals(LogFieldConstants.IBM_DATETIME)) {
datetime = kvp.getLongValue();
} else if (kvp.getKey().equals(LogFieldConstants.SEVERITY)) {
level = kvp.getStringValue();
} else if (kvp.getKey().equals(LogFieldConstants.MODULE)) {
loggerName = kvp.getStringValue();
} else if (kvp.getKey().equals(LogFieldConstants.IBM_CLASSNAME)) {
srcClassName = kvp.getStringValue();
} else if (kvp.getKey().equals(LogFieldConstants.THROWABLE)) {
throwable = kvp.getStringValue();
}
}
}
name = nonNullString(loggerName, srcClassName);
sb.append('[').append(DateFormatHelper.formatTime(datetime, useIsoDateFormat)).append("] ");
sb.append(DataFormatHelper.getThreadId()).append(' ');
formatFixedString(sb, name, enhancedNameLength);
sb.append(" " + level + " "); // sym has built-in padding
sb.append(message);
if (throwable != null) {
sb.append(LoggingConstants.nl).append(throwable);
}
return sb.toString();
} } | public class class_name {
public String messageLogFormat(GenericData genData) {
// This is a very light trace format, based on enhanced:
StringBuilder sb = new StringBuilder(256);
String name = null;
KeyValuePair[] pairs = genData.getPairs();
KeyValuePair kvp = null;
String message = null;
Long datetime = null;
String level = "";
String loggerName = null;
String srcClassName = null;
String throwable = null;
for (KeyValuePair p : pairs) {
if (p != null && !p.isList()) {
kvp = p; // depends on control dependency: [if], data = [none]
if (kvp.getKey().equals(LogFieldConstants.MESSAGE)) {
message = kvp.getStringValue(); // depends on control dependency: [if], data = [none]
} else if (kvp.getKey().equals(LogFieldConstants.IBM_DATETIME)) {
datetime = kvp.getLongValue(); // depends on control dependency: [if], data = [none]
} else if (kvp.getKey().equals(LogFieldConstants.SEVERITY)) {
level = kvp.getStringValue(); // depends on control dependency: [if], data = [none]
} else if (kvp.getKey().equals(LogFieldConstants.MODULE)) {
loggerName = kvp.getStringValue(); // depends on control dependency: [if], data = [none]
} else if (kvp.getKey().equals(LogFieldConstants.IBM_CLASSNAME)) {
srcClassName = kvp.getStringValue(); // depends on control dependency: [if], data = [none]
} else if (kvp.getKey().equals(LogFieldConstants.THROWABLE)) {
throwable = kvp.getStringValue(); // depends on control dependency: [if], data = [none]
}
}
}
name = nonNullString(loggerName, srcClassName);
sb.append('[').append(DateFormatHelper.formatTime(datetime, useIsoDateFormat)).append("] ");
sb.append(DataFormatHelper.getThreadId()).append(' ');
formatFixedString(sb, name, enhancedNameLength);
sb.append(" " + level + " "); // sym has built-in padding
sb.append(message);
if (throwable != null) {
sb.append(LoggingConstants.nl).append(throwable); // depends on control dependency: [if], data = [(throwable]
}
return sb.toString();
} } |
public class class_name {
public static List<Parameter<String>> decodeForms(String queryStr, Charset charset) {
String[] queries = queryStr.split("&");
List<Parameter<String>> list = new ArrayList<>(queries.length);
for (String query : queries) {
list.add(decodeForm(query, charset));
}
return list;
} } | public class class_name {
public static List<Parameter<String>> decodeForms(String queryStr, Charset charset) {
String[] queries = queryStr.split("&");
List<Parameter<String>> list = new ArrayList<>(queries.length);
for (String query : queries) {
list.add(decodeForm(query, charset)); // depends on control dependency: [for], data = [query]
}
return list;
} } |
public class class_name {
public QueryBuilder<GeometryIndex, GeometryIndexKey> queryBuilder() {
QueryBuilder<GeometryIndex, GeometryIndexKey> qb = geometryIndexDao
.queryBuilder();
try {
qb.where().eq(GeometryIndex.COLUMN_TABLE_NAME, tableName);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to build query for all Geometry Indices. GeoPackage: "
+ geoPackage.getName() + ", Table Name: "
+ tableName + ", Column Name: " + columnName, e);
}
return qb;
} } | public class class_name {
public QueryBuilder<GeometryIndex, GeometryIndexKey> queryBuilder() {
QueryBuilder<GeometryIndex, GeometryIndexKey> qb = geometryIndexDao
.queryBuilder();
try {
qb.where().eq(GeometryIndex.COLUMN_TABLE_NAME, tableName); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to build query for all Geometry Indices. GeoPackage: "
+ geoPackage.getName() + ", Table Name: "
+ tableName + ", Column Name: " + columnName, e);
} // depends on control dependency: [catch], data = [none]
return qb;
} } |
public class class_name {
protected void reloadNodes() {
Hello hello = HelloParser.parse(disqueConnection.sync().hello());
Collections.sort(hello.nodes, new Comparator<PrioritizedDisqueNode>() {
@Override
public int compare(PrioritizedDisqueNode o1, PrioritizedDisqueNode o2) {
if (o1.priority == o2.priority) {
return o1.disqueNode.getPort() - o2.disqueNode.getPort();
}
return o1.priority - o2.priority;
}
});
this.nodes.clear();
for (PrioritizedDisqueNode node : hello.nodes) {
if (isFiltered(node)) {
continue;
}
this.nodes.add(node.disqueNode);
}
} } | public class class_name {
protected void reloadNodes() {
Hello hello = HelloParser.parse(disqueConnection.sync().hello());
Collections.sort(hello.nodes, new Comparator<PrioritizedDisqueNode>() {
@Override
public int compare(PrioritizedDisqueNode o1, PrioritizedDisqueNode o2) {
if (o1.priority == o2.priority) {
return o1.disqueNode.getPort() - o2.disqueNode.getPort(); // depends on control dependency: [if], data = [none]
}
return o1.priority - o2.priority;
}
});
this.nodes.clear();
for (PrioritizedDisqueNode node : hello.nodes) {
if (isFiltered(node)) {
continue;
}
this.nodes.add(node.disqueNode); // depends on control dependency: [for], data = [node]
}
} } |
public class class_name {
private static <F> ReportXmlFormatter createInternal(final LintReport<F> lintReport,
final FormatterType formatterType, final Function<F, LintItem> adapter) {
Validate.notNull(lintReport);
final LintReport<LintItem> report = new LintReport<LintItem>();
for (final ResourceLintReport<F> reportItem : lintReport.getReports()) {
final Collection<LintItem> lintItems = new ArrayList<LintItem>();
for (final F lint : reportItem.getLints()) {
try {
LOG.debug("Adding lint: {}", lint);
lintItems.add(adapter.apply(lint));
} catch (final Exception e) {
throw WroRuntimeException.wrap(e, "Problem while adapting lint item");
}
}
report.addReport(ResourceLintReport.create(reportItem.getResourcePath(), lintItems));
}
return new ReportXmlFormatter(report, formatterType);
} } | public class class_name {
private static <F> ReportXmlFormatter createInternal(final LintReport<F> lintReport,
final FormatterType formatterType, final Function<F, LintItem> adapter) {
Validate.notNull(lintReport);
final LintReport<LintItem> report = new LintReport<LintItem>();
for (final ResourceLintReport<F> reportItem : lintReport.getReports()) {
final Collection<LintItem> lintItems = new ArrayList<LintItem>();
for (final F lint : reportItem.getLints()) {
try {
LOG.debug("Adding lint: {}", lint); // depends on control dependency: [try], data = [none]
lintItems.add(adapter.apply(lint)); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
throw WroRuntimeException.wrap(e, "Problem while adapting lint item");
} // depends on control dependency: [catch], data = [none]
}
report.addReport(ResourceLintReport.create(reportItem.getResourcePath(), lintItems)); // depends on control dependency: [for], data = [reportItem]
}
return new ReportXmlFormatter(report, formatterType);
} } |
public class class_name {
public boolean offer(E o)
{
if (transactional)
{
// Delegate the offer operation to the wrapped queue.
txMethod.requestWriteOperation(new EnqueueRecord(o));
// return success;
return true;
}
else
{
boolean success = queue.offer(o);
// Update the queue size if the offer was succesfull.
if (success)
{
incrementSizeAndCount(o);
}
return success;
}
} } | public class class_name {
public boolean offer(E o)
{
if (transactional)
{
// Delegate the offer operation to the wrapped queue.
txMethod.requestWriteOperation(new EnqueueRecord(o)); // depends on control dependency: [if], data = [none]
// return success;
return true; // depends on control dependency: [if], data = [none]
}
else
{
boolean success = queue.offer(o);
// Update the queue size if the offer was succesfull.
if (success)
{
incrementSizeAndCount(o); // depends on control dependency: [if], data = [none]
}
return success; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String parseNext() {
StringBuilder result = new StringBuilder();
if (signature.startsWith("[")) {
int dimensions = 0;
do {
++dimensions;
signature = signature.substring(1);
} while (signature.charAt(0) == '[');
result.append(parseNext());
while (dimensions-- > 0) {
result.append("[]");
}
} else if (signature.startsWith("L")) {
int semi = signature.indexOf(';');
if (semi < 0) {
throw new IllegalStateException("missing semicolon in signature " + signature);
}
result.append(signature.substring(1, semi).replace('/', '.'));
signature = signature.substring(semi + 1);
} else {
switch (signature.charAt(0)) {
case 'B':
result.append("byte");
break;
case 'C':
result.append("char");
break;
case 'D':
result.append("double");
break;
case 'F':
result.append("float");
break;
case 'I':
result.append("int");
break;
case 'J':
result.append("long");
break;
case 'S':
result.append("short");
break;
case 'Z':
result.append("boolean");
break;
case 'V':
result.append("void");
break;
default:
throw new IllegalArgumentException("bad signature " + signature);
}
skip();
}
return result.toString();
} } | public class class_name {
public String parseNext() {
StringBuilder result = new StringBuilder();
if (signature.startsWith("[")) {
int dimensions = 0;
do {
++dimensions;
signature = signature.substring(1);
} while (signature.charAt(0) == '[');
result.append(parseNext()); // depends on control dependency: [if], data = [none]
while (dimensions-- > 0) {
result.append("[]"); // depends on control dependency: [while], data = [none]
}
} else if (signature.startsWith("L")) {
int semi = signature.indexOf(';');
if (semi < 0) {
throw new IllegalStateException("missing semicolon in signature " + signature);
}
result.append(signature.substring(1, semi).replace('/', '.')); // depends on control dependency: [if], data = [none]
signature = signature.substring(semi + 1); // depends on control dependency: [if], data = [none]
} else {
switch (signature.charAt(0)) {
case 'B':
result.append("byte");
break;
case 'C':
result.append("char");
break;
case 'D':
result.append("double");
break;
case 'F':
result.append("float");
break;
case 'I':
result.append("int");
break;
case 'J':
result.append("long");
break;
case 'S':
result.append("short");
break;
case 'Z':
result.append("boolean");
break;
case 'V':
result.append("void");
break;
default:
throw new IllegalArgumentException("bad signature " + signature);
}
skip(); // depends on control dependency: [if], data = [none]
}
return result.toString();
} } |
public class class_name {
private static DateFormatSymbols getCachedInstance(Locale locale) {
SoftReference<DateFormatSymbols> ref = cachedInstances.get(locale);
DateFormatSymbols dfs = null;
if (ref == null || (dfs = ref.get()) == null) {
dfs = new DateFormatSymbols(locale);
ref = new SoftReference<DateFormatSymbols>(dfs);
SoftReference<DateFormatSymbols> x = cachedInstances.putIfAbsent(locale, ref);
if (x != null) {
DateFormatSymbols y = x.get();
if (y != null) {
dfs = y;
} else {
// Replace the empty SoftReference with ref.
cachedInstances.put(locale, ref);
}
}
}
return dfs;
} } | public class class_name {
private static DateFormatSymbols getCachedInstance(Locale locale) {
SoftReference<DateFormatSymbols> ref = cachedInstances.get(locale);
DateFormatSymbols dfs = null;
if (ref == null || (dfs = ref.get()) == null) {
dfs = new DateFormatSymbols(locale); // depends on control dependency: [if], data = [none]
ref = new SoftReference<DateFormatSymbols>(dfs); // depends on control dependency: [if], data = [none]
SoftReference<DateFormatSymbols> x = cachedInstances.putIfAbsent(locale, ref);
if (x != null) {
DateFormatSymbols y = x.get();
if (y != null) {
dfs = y; // depends on control dependency: [if], data = [none]
} else {
// Replace the empty SoftReference with ref.
cachedInstances.put(locale, ref); // depends on control dependency: [if], data = [none]
}
}
}
return dfs;
} } |
public class class_name {
public DetectLabelsResult withLabels(Label... labels) {
if (this.labels == null) {
setLabels(new java.util.ArrayList<Label>(labels.length));
}
for (Label ele : labels) {
this.labels.add(ele);
}
return this;
} } | public class class_name {
public DetectLabelsResult withLabels(Label... labels) {
if (this.labels == null) {
setLabels(new java.util.ArrayList<Label>(labels.length)); // depends on control dependency: [if], data = [none]
}
for (Label ele : labels) {
this.labels.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private void addCommaSeparatedChildren(Template template){
LazyNode next=child;
boolean first=true;
while(next!=null){
if(first){
first=false;
}else{
template.addConstant(",");
}
next.addSegments(template);
next=next.next;
}
} } | public class class_name {
private void addCommaSeparatedChildren(Template template){
LazyNode next=child;
boolean first=true;
while(next!=null){
if(first){
first=false; // depends on control dependency: [if], data = [none]
}else{
template.addConstant(","); // depends on control dependency: [if], data = [none]
}
next.addSegments(template); // depends on control dependency: [while], data = [none]
next=next.next; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public void setAutoDiscoveryDataCenter(String dataCenter) {
if (StringUtils.isNotBlank(dataCenter)) {
this.autoDiscoveryDataCenters = Arrays.asList(dataCenter);
}
} } | public class class_name {
public void setAutoDiscoveryDataCenter(String dataCenter) {
if (StringUtils.isNotBlank(dataCenter)) {
this.autoDiscoveryDataCenters = Arrays.asList(dataCenter); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Vector3d transform(final Quat4d quat4d) {
Vector3d result = new Vector3d();
double test = quat4d.x * quat4d.z + quat4d.y * quat4d.w;
if (test >= 0.5) { // singularity at north pole
result.x = 0;
result.y = Math.PI / 2;
result.z = 2 * Math.atan2(quat4d.x, quat4d.w);
return result;
}
if (test <= -0.5) { // singularity at south pole
result.x = 0;
result.y = -Math.PI / 2;
result.z = -2 * Math.atan2(quat4d.x, quat4d.w);
return result;
}
double sqx = quat4d.x * quat4d.x;
double sqz = quat4d.y * quat4d.y;
double sqy = quat4d.z * quat4d.z;
result.x = Math.atan2(2 * quat4d.x * quat4d.w - 2 * quat4d.z * quat4d.y, 1 - 2 * sqx - 2 * sqz);
result.y = Math.asin(2 * test);
result.z = Math.atan2(2 * quat4d.z * quat4d.w - 2 * quat4d.x * quat4d.y, 1 - 2 * sqy - 2 * sqz);
return result;
} } | public class class_name {
public static Vector3d transform(final Quat4d quat4d) {
Vector3d result = new Vector3d();
double test = quat4d.x * quat4d.z + quat4d.y * quat4d.w;
if (test >= 0.5) { // singularity at north pole
result.x = 0; // depends on control dependency: [if], data = [none]
result.y = Math.PI / 2; // depends on control dependency: [if], data = [none]
result.z = 2 * Math.atan2(quat4d.x, quat4d.w); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
if (test <= -0.5) { // singularity at south pole
result.x = 0; // depends on control dependency: [if], data = [none]
result.y = -Math.PI / 2; // depends on control dependency: [if], data = [none]
result.z = -2 * Math.atan2(quat4d.x, quat4d.w); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
double sqx = quat4d.x * quat4d.x;
double sqz = quat4d.y * quat4d.y;
double sqy = quat4d.z * quat4d.z;
result.x = Math.atan2(2 * quat4d.x * quat4d.w - 2 * quat4d.z * quat4d.y, 1 - 2 * sqx - 2 * sqz);
result.y = Math.asin(2 * test);
result.z = Math.atan2(2 * quat4d.z * quat4d.w - 2 * quat4d.x * quat4d.y, 1 - 2 * sqy - 2 * sqz);
return result;
} } |
public class class_name {
public void marshall(UpdateChannelRequest updateChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (updateChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateChannelRequest.getChannelName(), CHANNELNAME_BINDING);
protocolMarshaller.marshall(updateChannelRequest.getRetentionPeriod(), RETENTIONPERIOD_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateChannelRequest updateChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (updateChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateChannelRequest.getChannelName(), CHANNELNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateChannelRequest.getRetentionPeriod(), RETENTIONPERIOD_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 {
@Implementation
protected static void getMyMemoryState(ActivityManager.RunningAppProcessInfo inState) {
fillInProcessInfo(inState);
for (ActivityManager.RunningAppProcessInfo info : processes) {
if (info.pid == Process.myPid()) {
inState.importance = info.importance;
inState.lru = info.lru;
inState.importanceReasonCode = info.importanceReasonCode;
inState.importanceReasonPid = info.importanceReasonPid;
inState.lastTrimLevel = info.lastTrimLevel;
inState.pkgList = info.pkgList;
inState.processName = info.processName;
}
}
} } | public class class_name {
@Implementation
protected static void getMyMemoryState(ActivityManager.RunningAppProcessInfo inState) {
fillInProcessInfo(inState);
for (ActivityManager.RunningAppProcessInfo info : processes) {
if (info.pid == Process.myPid()) {
inState.importance = info.importance; // depends on control dependency: [if], data = [none]
inState.lru = info.lru; // depends on control dependency: [if], data = [none]
inState.importanceReasonCode = info.importanceReasonCode; // depends on control dependency: [if], data = [none]
inState.importanceReasonPid = info.importanceReasonPid; // depends on control dependency: [if], data = [none]
inState.lastTrimLevel = info.lastTrimLevel; // depends on control dependency: [if], data = [none]
inState.pkgList = info.pkgList; // depends on control dependency: [if], data = [none]
inState.processName = info.processName; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public Object getPropertyValue(Object propertyId) {
if ( XPOS_PROP.equals( propertyId ) ) {
return Integer.toString( location.x );
}
if ( YPOS_PROP.equals( propertyId ) ) {
return Integer.toString( location.y );
}
if ( HEIGHT_PROP.equals( propertyId ) ) {
return Integer.toString( size.height );
}
if ( WIDTH_PROP.equals( propertyId ) ) {
return Integer.toString( size.width );
}
return null;
} } | public class class_name {
public Object getPropertyValue(Object propertyId) {
if ( XPOS_PROP.equals( propertyId ) ) {
return Integer.toString( location.x ); // depends on control dependency: [if], data = [none]
}
if ( YPOS_PROP.equals( propertyId ) ) {
return Integer.toString( location.y ); // depends on control dependency: [if], data = [none]
}
if ( HEIGHT_PROP.equals( propertyId ) ) {
return Integer.toString( size.height ); // depends on control dependency: [if], data = [none]
}
if ( WIDTH_PROP.equals( propertyId ) ) {
return Integer.toString( size.width ); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public Collection<String> getPeerNames() {
if (peers == null) {
return Collections.EMPTY_SET;
} else {
return new HashSet<>(peers.keySet());
}
} } | public class class_name {
public Collection<String> getPeerNames() {
if (peers == null) {
return Collections.EMPTY_SET; // depends on control dependency: [if], data = [none]
} else {
return new HashSet<>(peers.keySet()); // depends on control dependency: [if], data = [(peers]
}
} } |
public class class_name {
private CellFormatResult getErrorCellValue(final byte errorValue, final Locale locale) {
final FormulaError error = FormulaError.forInt(errorValue);
final CellFormatResult result = new CellFormatResult();
result.setCellType(FormatCellType.Error);
result.setValue(error.getCode());
if(isErrorCellAsEmpty()) {
result.setText("");
} else {
result.setText(error.getString());
}
return result;
} } | public class class_name {
private CellFormatResult getErrorCellValue(final byte errorValue, final Locale locale) {
final FormulaError error = FormulaError.forInt(errorValue);
final CellFormatResult result = new CellFormatResult();
result.setCellType(FormatCellType.Error);
result.setValue(error.getCode());
if(isErrorCellAsEmpty()) {
result.setText("");
// depends on control dependency: [if], data = [none]
} else {
result.setText(error.getString());
// depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static <E> Counter<E> toCounter(Map<Integer, ? extends Number> counts, Index<E> index) {
Counter<E> counter = new ClassicCounter<E>();
for (Map.Entry<Integer, ? extends Number> entry : counts.entrySet()) {
counter.setCount(index.get(entry.getKey()), entry.getValue().doubleValue());
}
return counter;
} } | public class class_name {
public static <E> Counter<E> toCounter(Map<Integer, ? extends Number> counts, Index<E> index) {
Counter<E> counter = new ClassicCounter<E>();
for (Map.Entry<Integer, ? extends Number> entry : counts.entrySet()) {
counter.setCount(index.get(entry.getKey()), entry.getValue().doubleValue());
// depends on control dependency: [for], data = [entry]
}
return counter;
} } |
public class class_name {
static int adjustConfidence(int codeUnit, int confidence) {
if (codeUnit == 0) {
confidence -= 10;
} else if ((codeUnit >= 0x20 && codeUnit <= 0xff) || codeUnit == 0x0a) {
confidence += 10;
}
if (confidence < 0) {
confidence = 0;
} else if (confidence > 100) {
confidence = 100;
}
return confidence;
} } | public class class_name {
static int adjustConfidence(int codeUnit, int confidence) {
if (codeUnit == 0) {
confidence -= 10; // depends on control dependency: [if], data = [none]
} else if ((codeUnit >= 0x20 && codeUnit <= 0xff) || codeUnit == 0x0a) {
confidence += 10; // depends on control dependency: [if], data = [none]
}
if (confidence < 0) {
confidence = 0; // depends on control dependency: [if], data = [none]
} else if (confidence > 100) {
confidence = 100; // depends on control dependency: [if], data = [none]
}
return confidence;
} } |
public class class_name {
public boolean isPersistentProperty(String propName) {
if (transientProperties == null) {
setTransientPropertyNames();
}
if (transientProperties.contains(propName)) {
return false;
} else {
return true;
}
} } | public class class_name {
public boolean isPersistentProperty(String propName) {
if (transientProperties == null) {
setTransientPropertyNames(); // depends on control dependency: [if], data = [none]
}
if (transientProperties.contains(propName)) {
return false; // depends on control dependency: [if], data = [none]
} else {
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@FFDCIgnore(IllegalArgumentException.class)
private String evaluateCallerNameAttribute(boolean immediateOnly) {
try {
return elHelper.processString("callerNameAttribute", this.idStoreDefinition.callerNameAttribute(), immediateOnly);
} catch (IllegalArgumentException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) {
Tr.warning(tc, "JAVAEESEC_WARNING_IDSTORE_CONFIG", new Object[] { "callerNameAttribute", "uid" });
}
return "uid"; /* Default value from spec. */
}
} } | public class class_name {
@FFDCIgnore(IllegalArgumentException.class)
private String evaluateCallerNameAttribute(boolean immediateOnly) {
try {
return elHelper.processString("callerNameAttribute", this.idStoreDefinition.callerNameAttribute(), immediateOnly); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) {
Tr.warning(tc, "JAVAEESEC_WARNING_IDSTORE_CONFIG", new Object[] { "callerNameAttribute", "uid" }); // depends on control dependency: [if], data = [none]
}
return "uid"; /* Default value from spec. */
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public synchronized void update(double sample) {
long now = System.currentTimeMillis();
if (lastMillis == 0) { // first sample
average = sample;
lastMillis = now;
return;
}
long deltaTime = now - lastMillis;
double coeff = Math.exp(-1.0 * ((double)deltaTime / windowMillis));
average = (1.0 - coeff) * sample + coeff * average;
lastMillis = now;
} } | public class class_name {
public synchronized void update(double sample) {
long now = System.currentTimeMillis();
if (lastMillis == 0) { // first sample
average = sample; // depends on control dependency: [if], data = [none]
lastMillis = now; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
long deltaTime = now - lastMillis;
double coeff = Math.exp(-1.0 * ((double)deltaTime / windowMillis));
average = (1.0 - coeff) * sample + coeff * average;
lastMillis = now;
} } |
public class class_name {
public static SortedMap<String, Object> getMaskedBeanProperties(Object beanObject, String[] maskProperties) {
try {
SortedMap<String, Object> configProperties = new TreeMap<String, Object>(BeanUtils.describe(beanObject));
// always ignore "class" properties which is added by BeanUtils.describe by default
configProperties.remove("class");
// Mask some properties with confidential information (if set to any value)
if (maskProperties != null) {
for (String propertyName : maskProperties) {
if (configProperties.containsKey(propertyName) && configProperties.get(propertyName) != null) {
configProperties.put(propertyName, "***");
}
}
}
return configProperties;
}
catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
throw new IllegalArgumentException("Unable to get properties from: " + beanObject, ex);
}
} } | public class class_name {
public static SortedMap<String, Object> getMaskedBeanProperties(Object beanObject, String[] maskProperties) {
try {
SortedMap<String, Object> configProperties = new TreeMap<String, Object>(BeanUtils.describe(beanObject));
// always ignore "class" properties which is added by BeanUtils.describe by default
configProperties.remove("class"); // depends on control dependency: [try], data = [none]
// Mask some properties with confidential information (if set to any value)
if (maskProperties != null) {
for (String propertyName : maskProperties) {
if (configProperties.containsKey(propertyName) && configProperties.get(propertyName) != null) {
configProperties.put(propertyName, "***"); // depends on control dependency: [if], data = [none]
}
}
}
return configProperties; // depends on control dependency: [try], data = [none]
}
catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ex) {
throw new IllegalArgumentException("Unable to get properties from: " + beanObject, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public GetDocumentationVersionsResult withItems(DocumentationVersion... items) {
if (this.items == null) {
setItems(new java.util.ArrayList<DocumentationVersion>(items.length));
}
for (DocumentationVersion ele : items) {
this.items.add(ele);
}
return this;
} } | public class class_name {
public GetDocumentationVersionsResult withItems(DocumentationVersion... items) {
if (this.items == null) {
setItems(new java.util.ArrayList<DocumentationVersion>(items.length)); // depends on control dependency: [if], data = [none]
}
for (DocumentationVersion ele : items) {
this.items.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public ImportDescr importStatement( PackageDescrBuilder pkg ) throws RecognitionException {
ImportDescrBuilder imp = null;
try {
imp = helper.start( pkg,
ImportDescrBuilder.class,
null );
// import
match( input,
DRL5Lexer.ID,
DroolsSoftKeywords.IMPORT,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
String kwd;
if ( helper.validateIdentifierKey( kwd = DroolsSoftKeywords.FUNCTION ) ||
helper.validateIdentifierKey( kwd = DroolsSoftKeywords.STATIC ) ) {
// function
match( input,
DRL5Lexer.ID,
kwd,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
}
// qualifiedIdentifier
String target = qualifiedIdentifier();
if ( state.failed ) return null;
if ( input.LA( 1 ) == DRL5Lexer.DOT && input.LA( 2 ) == DRL5Lexer.STAR ) {
// .*
match( input,
DRL5Lexer.DOT,
null,
null,
DroolsEditorType.IDENTIFIER );
if ( state.failed ) return null;
match( input,
DRL5Lexer.STAR,
null,
null,
DroolsEditorType.IDENTIFIER );
if ( state.failed ) return null;
target += ".*";
}
if ( state.backtracking == 0 ) imp.target( target );
} catch ( RecognitionException re ) {
reportError( re );
} finally {
helper.end( ImportDescrBuilder.class,
imp );
}
return (imp != null) ? imp.getDescr() : null;
} } | public class class_name {
public ImportDescr importStatement( PackageDescrBuilder pkg ) throws RecognitionException {
ImportDescrBuilder imp = null;
try {
imp = helper.start( pkg,
ImportDescrBuilder.class,
null );
// import
match( input,
DRL5Lexer.ID,
DroolsSoftKeywords.IMPORT,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
String kwd;
if ( helper.validateIdentifierKey( kwd = DroolsSoftKeywords.FUNCTION ) ||
helper.validateIdentifierKey( kwd = DroolsSoftKeywords.STATIC ) ) {
// function
match( input,
DRL5Lexer.ID,
kwd,
null,
DroolsEditorType.KEYWORD ); // depends on control dependency: [if], data = [none]
if ( state.failed ) return null;
}
// qualifiedIdentifier
String target = qualifiedIdentifier();
if ( state.failed ) return null;
if ( input.LA( 1 ) == DRL5Lexer.DOT && input.LA( 2 ) == DRL5Lexer.STAR ) {
// .*
match( input,
DRL5Lexer.DOT,
null,
null,
DroolsEditorType.IDENTIFIER ); // depends on control dependency: [if], data = [none]
if ( state.failed ) return null;
match( input,
DRL5Lexer.STAR,
null,
null,
DroolsEditorType.IDENTIFIER ); // depends on control dependency: [if], data = [none]
if ( state.failed ) return null;
target += ".*"; // depends on control dependency: [if], data = [none]
}
if ( state.backtracking == 0 ) imp.target( target );
} catch ( RecognitionException re ) {
reportError( re );
} finally {
helper.end( ImportDescrBuilder.class,
imp );
}
return (imp != null) ? imp.getDescr() : null;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.