code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public ComputeNodeEnableSchedulingOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} } | public class class_name {
public ComputeNodeEnableSchedulingOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null; // depends on control dependency: [if], data = [none]
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return this;
} } |
public class class_name {
@RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="oauth_token")
public RedirectView oauth1Callback(@PathVariable String providerId, NativeWebRequest request) {
try {
OAuth1ConnectionFactory<?> connectionFactory = (OAuth1ConnectionFactory<?>) connectionFactoryLocator.getConnectionFactory(providerId);
Connection<?> connection = connectSupport.completeConnection(connectionFactory, request);
addConnection(connection, connectionFactory, request);
} catch (Exception e) {
sessionStrategy.setAttribute(request, PROVIDER_ERROR_ATTRIBUTE, e);
logger.warn("Exception while handling OAuth1 callback (" + e.getMessage() + "). Redirecting to " + providerId +" connection status page.");
}
return connectionStatusRedirect(providerId, request);
} } | public class class_name {
@RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="oauth_token")
public RedirectView oauth1Callback(@PathVariable String providerId, NativeWebRequest request) {
try {
OAuth1ConnectionFactory<?> connectionFactory = (OAuth1ConnectionFactory<?>) connectionFactoryLocator.getConnectionFactory(providerId);
Connection<?> connection = connectSupport.completeConnection(connectionFactory, request);
addConnection(connection, connectionFactory, request); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
sessionStrategy.setAttribute(request, PROVIDER_ERROR_ATTRIBUTE, e);
logger.warn("Exception while handling OAuth1 callback (" + e.getMessage() + "). Redirecting to " + providerId +" connection status page.");
} // depends on control dependency: [catch], data = [none]
return connectionStatusRedirect(providerId, request);
} } |
public class class_name {
public UpdateParameterGroupRequest withParameterNameValues(ParameterNameValue... parameterNameValues) {
if (this.parameterNameValues == null) {
setParameterNameValues(new java.util.ArrayList<ParameterNameValue>(parameterNameValues.length));
}
for (ParameterNameValue ele : parameterNameValues) {
this.parameterNameValues.add(ele);
}
return this;
} } | public class class_name {
public UpdateParameterGroupRequest withParameterNameValues(ParameterNameValue... parameterNameValues) {
if (this.parameterNameValues == null) {
setParameterNameValues(new java.util.ArrayList<ParameterNameValue>(parameterNameValues.length)); // depends on control dependency: [if], data = [none]
}
for (ParameterNameValue ele : parameterNameValues) {
this.parameterNameValues.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@SuppressWarnings("resource")
public static <R> Stream<R> zip(final Collection<? extends FloatStream> c, final FloatNFunction<R> zipFunction) {
if (N.isNullOrEmpty(c)) {
return Stream.empty();
}
final int len = c.size();
final FloatIterator[] iters = new FloatIterator[len];
int i = 0;
for (FloatStream s : c) {
iters[i++] = s.iteratorEx();
}
return new IteratorStream<>(new ObjIteratorEx<R>() {
@Override
public boolean hasNext() {
for (int i = 0; i < len; i++) {
if (iters[i].hasNext() == false) {
return false;
}
}
return true;
}
@Override
public R next() {
final float[] args = new float[len];
for (int i = 0; i < len; i++) {
args[i] = iters[i].nextFloat();
}
return zipFunction.apply(args);
}
}).onClose(newCloseHandler(c));
} } | public class class_name {
@SuppressWarnings("resource")
public static <R> Stream<R> zip(final Collection<? extends FloatStream> c, final FloatNFunction<R> zipFunction) {
if (N.isNullOrEmpty(c)) {
return Stream.empty();
// depends on control dependency: [if], data = [none]
}
final int len = c.size();
final FloatIterator[] iters = new FloatIterator[len];
int i = 0;
for (FloatStream s : c) {
iters[i++] = s.iteratorEx();
// depends on control dependency: [for], data = [s]
}
return new IteratorStream<>(new ObjIteratorEx<R>() {
@Override
public boolean hasNext() {
for (int i = 0; i < len; i++) {
if (iters[i].hasNext() == false) {
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
}
@Override
public R next() {
final float[] args = new float[len];
for (int i = 0; i < len; i++) {
args[i] = iters[i].nextFloat();
// depends on control dependency: [for], data = [i]
}
return zipFunction.apply(args);
}
}).onClose(newCloseHandler(c));
} } |
public class class_name {
public void marshall(DescribeScalingPoliciesRequest describeScalingPoliciesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeScalingPoliciesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeScalingPoliciesRequest.getFleetId(), FLEETID_BINDING);
protocolMarshaller.marshall(describeScalingPoliciesRequest.getStatusFilter(), STATUSFILTER_BINDING);
protocolMarshaller.marshall(describeScalingPoliciesRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(describeScalingPoliciesRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeScalingPoliciesRequest describeScalingPoliciesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeScalingPoliciesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeScalingPoliciesRequest.getFleetId(), FLEETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeScalingPoliciesRequest.getStatusFilter(), STATUSFILTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeScalingPoliciesRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeScalingPoliciesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void enter(@NonNull ViewPosition fromPos, boolean withAnimation) {
if (GestureDebug.isDebugAnimator()) {
Log.d(TAG, "Entering from view position, with animation = " + withAnimation);
}
enterInternal(withAnimation);
updateInternal(fromPos);
} } | public class class_name {
public void enter(@NonNull ViewPosition fromPos, boolean withAnimation) {
if (GestureDebug.isDebugAnimator()) {
Log.d(TAG, "Entering from view position, with animation = " + withAnimation); // depends on control dependency: [if], data = [none]
}
enterInternal(withAnimation);
updateInternal(fromPos);
} } |
public class class_name {
@Override
protected boolean doHandleRequest(final Request request) {
// Valid date entered by the user
String dateValue = getRequestValue(request);
// Text entered by the user (An empty string is treated as null)
String value = request.getParameter(getId());
String text = (Util.empty(value)) ? null : value;
// Current date value
String currentDate = getValue();
boolean changed = false;
// If a "valid" date value has not been entered, then check if the "user text" has changed
if (dateValue == null) {
// User entered text
changed = !Util.equals(text, getText()) || currentDate != null;
} else {
// Valid Date
changed = !Util.equals(dateValue, currentDate);
}
if (changed) {
boolean valid = dateValue != null || text == null;
handleRequestValue(dateValue, valid, text);
}
return changed;
} } | public class class_name {
@Override
protected boolean doHandleRequest(final Request request) {
// Valid date entered by the user
String dateValue = getRequestValue(request);
// Text entered by the user (An empty string is treated as null)
String value = request.getParameter(getId());
String text = (Util.empty(value)) ? null : value;
// Current date value
String currentDate = getValue();
boolean changed = false;
// If a "valid" date value has not been entered, then check if the "user text" has changed
if (dateValue == null) {
// User entered text
changed = !Util.equals(text, getText()) || currentDate != null; // depends on control dependency: [if], data = [none]
} else {
// Valid Date
changed = !Util.equals(dateValue, currentDate); // depends on control dependency: [if], data = [(dateValue]
}
if (changed) {
boolean valid = dateValue != null || text == null;
handleRequestValue(dateValue, valid, text); // depends on control dependency: [if], data = [none]
}
return changed;
} } |
public class class_name {
public final BELScriptWalker.document_return document() throws RecognitionException {
BELScriptWalker.document_return retval = new BELScriptWalker.document_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
CommonTree _first_0 = null;
CommonTree _last = null;
CommonTree NEWLINE1=null;
CommonTree DOCUMENT_COMMENT2=null;
CommonTree EOF4=null;
BELScriptWalker.record_return record3 = null;
CommonTree NEWLINE1_tree=null;
CommonTree DOCUMENT_COMMENT2_tree=null;
CommonTree EOF4_tree=null;
try {
// BELScriptWalker.g:96:35: ( ( NEWLINE | DOCUMENT_COMMENT | record )+ EOF )
// BELScriptWalker.g:97:5: ( NEWLINE | DOCUMENT_COMMENT | record )+ EOF
{
root_0 = (CommonTree)adaptor.nil();
// BELScriptWalker.g:97:5: ( NEWLINE | DOCUMENT_COMMENT | record )+
int cnt1=0;
loop1:
do {
int alt1=4;
switch ( input.LA(1) ) {
case NEWLINE:
{
alt1=1;
}
break;
case DOCUMENT_COMMENT:
{
alt1=2;
}
break;
case 24:
case 26:
case 27:
case 44:
case 45:
case 46:
case 47:
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
case 64:
case 65:
case 66:
case 67:
case 68:
case 69:
case 70:
case 71:
case 72:
case 73:
case 74:
case 75:
case 76:
case 77:
case 78:
case 79:
case 80:
case 81:
case 82:
case 83:
case 84:
case 85:
case 86:
case 87:
case 88:
case 89:
case 90:
case 91:
case 92:
case 93:
case 94:
case 95:
case 96:
case 97:
case 98:
case 99:
case 100:
case 101:
case 102:
{
alt1=3;
}
break;
}
switch (alt1) {
case 1 :
// BELScriptWalker.g:97:6: NEWLINE
{
_last = (CommonTree)input.LT(1);
NEWLINE1=(CommonTree)match(input,NEWLINE,FOLLOW_NEWLINE_in_document67);
NEWLINE1_tree = (CommonTree)adaptor.dupNode(NEWLINE1);
adaptor.addChild(root_0, NEWLINE1_tree);
}
break;
case 2 :
// BELScriptWalker.g:97:16: DOCUMENT_COMMENT
{
_last = (CommonTree)input.LT(1);
DOCUMENT_COMMENT2=(CommonTree)match(input,DOCUMENT_COMMENT,FOLLOW_DOCUMENT_COMMENT_in_document71);
DOCUMENT_COMMENT2_tree = (CommonTree)adaptor.dupNode(DOCUMENT_COMMENT2);
adaptor.addChild(root_0, DOCUMENT_COMMENT2_tree);
}
break;
case 3 :
// BELScriptWalker.g:97:35: record
{
_last = (CommonTree)input.LT(1);
pushFollow(FOLLOW_record_in_document75);
record3=record();
state._fsp--;
adaptor.addChild(root_0, record3.getTree());
}
break;
default :
if ( cnt1 >= 1 ) break loop1;
EarlyExitException eee =
new EarlyExitException(1, input);
throw eee;
}
cnt1++;
} while (true);
_last = (CommonTree)input.LT(1);
EOF4=(CommonTree)match(input,EOF,FOLLOW_EOF_in_document79);
EOF4_tree = (CommonTree)adaptor.dupNode(EOF4);
adaptor.addChild(root_0, EOF4_tree);
if (!docprop.containsKey(BELDocumentProperty.NAME)) {
addError(new DocumentNameException(lastDocumentPropertyLocation, 0));
} else if (!docprop.containsKey(BELDocumentProperty.DESCRIPTION)) {
addError(new DocumentDescriptionException(lastDocumentPropertyLocation, 0));
} else if (!docprop.containsKey(BELDocumentProperty.VERSION)) {
addError(new DocumentVersionException(lastDocumentPropertyLocation, 0));
} else {
if (documentStatementGroup.getStatements().isEmpty()) {
// statements are only contained in explicitly-defined statement groups
retval.doc = new BELDocument(BELDocumentHeader.create(docprop), adlist, nslist, statementGroups);
} else {
// statements are defined in the implicit document statement group and possibly child statement groups
documentStatementGroup.setChildStatementGroups(statementGroups);
retval.doc = new BELDocument(BELDocumentHeader.create(docprop), adlist, nslist, Arrays.asList(documentStatementGroup));
}
}
}
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return retval;
} } | public class class_name {
public final BELScriptWalker.document_return document() throws RecognitionException {
BELScriptWalker.document_return retval = new BELScriptWalker.document_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
CommonTree _first_0 = null;
CommonTree _last = null;
CommonTree NEWLINE1=null;
CommonTree DOCUMENT_COMMENT2=null;
CommonTree EOF4=null;
BELScriptWalker.record_return record3 = null;
CommonTree NEWLINE1_tree=null;
CommonTree DOCUMENT_COMMENT2_tree=null;
CommonTree EOF4_tree=null;
try {
// BELScriptWalker.g:96:35: ( ( NEWLINE | DOCUMENT_COMMENT | record )+ EOF )
// BELScriptWalker.g:97:5: ( NEWLINE | DOCUMENT_COMMENT | record )+ EOF
{
root_0 = (CommonTree)adaptor.nil();
// BELScriptWalker.g:97:5: ( NEWLINE | DOCUMENT_COMMENT | record )+
int cnt1=0;
loop1:
do {
int alt1=4;
switch ( input.LA(1) ) {
case NEWLINE:
{
alt1=1;
}
break;
case DOCUMENT_COMMENT:
{
alt1=2;
}
break;
case 24:
case 26:
case 27:
case 44:
case 45:
case 46:
case 47:
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
case 64:
case 65:
case 66:
case 67:
case 68:
case 69:
case 70:
case 71:
case 72:
case 73:
case 74:
case 75:
case 76:
case 77:
case 78:
case 79:
case 80:
case 81:
case 82:
case 83:
case 84:
case 85:
case 86:
case 87:
case 88:
case 89:
case 90:
case 91:
case 92:
case 93:
case 94:
case 95:
case 96:
case 97:
case 98:
case 99:
case 100:
case 101:
case 102:
{
alt1=3;
}
break;
}
switch (alt1) {
case 1 :
// BELScriptWalker.g:97:6: NEWLINE
{
_last = (CommonTree)input.LT(1);
NEWLINE1=(CommonTree)match(input,NEWLINE,FOLLOW_NEWLINE_in_document67);
NEWLINE1_tree = (CommonTree)adaptor.dupNode(NEWLINE1);
adaptor.addChild(root_0, NEWLINE1_tree);
}
break;
case 2 :
// BELScriptWalker.g:97:16: DOCUMENT_COMMENT
{
_last = (CommonTree)input.LT(1);
DOCUMENT_COMMENT2=(CommonTree)match(input,DOCUMENT_COMMENT,FOLLOW_DOCUMENT_COMMENT_in_document71);
DOCUMENT_COMMENT2_tree = (CommonTree)adaptor.dupNode(DOCUMENT_COMMENT2);
adaptor.addChild(root_0, DOCUMENT_COMMENT2_tree);
}
break;
case 3 :
// BELScriptWalker.g:97:35: record
{
_last = (CommonTree)input.LT(1);
pushFollow(FOLLOW_record_in_document75);
record3=record();
state._fsp--;
adaptor.addChild(root_0, record3.getTree());
}
break;
default :
if ( cnt1 >= 1 ) break loop1;
EarlyExitException eee =
new EarlyExitException(1, input);
throw eee;
}
cnt1++;
} while (true);
_last = (CommonTree)input.LT(1);
EOF4=(CommonTree)match(input,EOF,FOLLOW_EOF_in_document79);
EOF4_tree = (CommonTree)adaptor.dupNode(EOF4);
adaptor.addChild(root_0, EOF4_tree);
if (!docprop.containsKey(BELDocumentProperty.NAME)) {
addError(new DocumentNameException(lastDocumentPropertyLocation, 0)); // depends on control dependency: [if], data = [none]
} else if (!docprop.containsKey(BELDocumentProperty.DESCRIPTION)) {
addError(new DocumentDescriptionException(lastDocumentPropertyLocation, 0)); // depends on control dependency: [if], data = [none]
} else if (!docprop.containsKey(BELDocumentProperty.VERSION)) {
addError(new DocumentVersionException(lastDocumentPropertyLocation, 0)); // depends on control dependency: [if], data = [none]
} else {
if (documentStatementGroup.getStatements().isEmpty()) {
// statements are only contained in explicitly-defined statement groups
retval.doc = new BELDocument(BELDocumentHeader.create(docprop), adlist, nslist, statementGroups); // depends on control dependency: [if], data = [none]
} else {
// statements are defined in the implicit document statement group and possibly child statement groups
documentStatementGroup.setChildStatementGroups(statementGroups); // depends on control dependency: [if], data = [none]
retval.doc = new BELDocument(BELDocumentHeader.create(docprop), adlist, nslist, Arrays.asList(documentStatementGroup)); // depends on control dependency: [if], data = [none]
}
}
}
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return retval;
} } |
public class class_name {
public String getPath()
{
final StringBuilder path = new StringBuilder();
if (getPrevious() != null) {
path.append(getPrevious().getPath());
}
return path.toString();
} } | public class class_name {
public String getPath()
{
final StringBuilder path = new StringBuilder();
if (getPrevious() != null) {
path.append(getPrevious().getPath()); // depends on control dependency: [if], data = [(getPrevious()]
}
return path.toString();
} } |
public class class_name {
public String getLinkUrl(JSONObject jsonObject){
if(jsonObject == null) return null;
try {
JSONObject urlObject = jsonObject.has("url") ? jsonObject.getJSONObject("url") : null;
if(urlObject == null) return null;
JSONObject androidObject = urlObject.has("android") ? urlObject.getJSONObject("android") : null;
if(androidObject != null){
return androidObject.has("text") ? androidObject.getString("text") : "";
}else{
return "";
}
} catch (JSONException e) {
Logger.v("Unable to get Link URL with JSON - "+e.getLocalizedMessage());
return null;
}
} } | public class class_name {
public String getLinkUrl(JSONObject jsonObject){
if(jsonObject == null) return null;
try {
JSONObject urlObject = jsonObject.has("url") ? jsonObject.getJSONObject("url") : null;
if(urlObject == null) return null;
JSONObject androidObject = urlObject.has("android") ? urlObject.getJSONObject("android") : null;
if(androidObject != null){
return androidObject.has("text") ? androidObject.getString("text") : ""; // depends on control dependency: [if], data = [none]
}else{
return ""; // depends on control dependency: [if], data = [none]
}
} catch (JSONException e) {
Logger.v("Unable to get Link URL with JSON - "+e.getLocalizedMessage());
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static Schema mergeOrUnion(Schema left, Schema right) {
Schema merged = mergeOnly(left, right);
if (merged != null) {
return merged;
}
return union(left, right);
} } | public class class_name {
private static Schema mergeOrUnion(Schema left, Schema right) {
Schema merged = mergeOnly(left, right);
if (merged != null) {
return merged; // depends on control dependency: [if], data = [none]
}
return union(left, right);
} } |
public class class_name {
public static void multTransA(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c )
{
if( b.numCols == 1 ) {
// todo check a.numCols == 1 and do inner product?
// there are significantly faster algorithms when dealing with vectors
if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) {
MatrixVectorMult_DDRM.multTransA_reorder(a,b,c);
} else {
MatrixVectorMult_DDRM.multTransA_small(a,b,c);
}
} else if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ||
b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) {
MatrixMatrixMult_DDRM.multTransA_reorder(a, b, c);
} else {
MatrixMatrixMult_DDRM.multTransA_small(a, b, c);
}
} } | public class class_name {
public static void multTransA(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c )
{
if( b.numCols == 1 ) {
// todo check a.numCols == 1 and do inner product?
// there are significantly faster algorithms when dealing with vectors
if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) {
MatrixVectorMult_DDRM.multTransA_reorder(a,b,c); // depends on control dependency: [if], data = [none]
} else {
MatrixVectorMult_DDRM.multTransA_small(a,b,c); // depends on control dependency: [if], data = [none]
}
} else if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ||
b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) {
MatrixMatrixMult_DDRM.multTransA_reorder(a, b, c); // depends on control dependency: [if], data = [none]
} else {
MatrixMatrixMult_DDRM.multTransA_small(a, b, c); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Optional<Condition> createInCondition(final PredicateInRightValue inRightValue, final Column column) {
List<SQLExpression> sqlExpressions = new LinkedList<>();
for (ExpressionSegment each : inRightValue.getSqlExpressions()) {
if (!(each instanceof SimpleExpressionSegment)) {
sqlExpressions.clear();
break;
} else {
sqlExpressions.add(((SimpleExpressionSegment) each).getSQLExpression());
}
}
return sqlExpressions.isEmpty() ? Optional.<Condition>absent() : Optional.of(new Condition(column, sqlExpressions));
} } | public class class_name {
public static Optional<Condition> createInCondition(final PredicateInRightValue inRightValue, final Column column) {
List<SQLExpression> sqlExpressions = new LinkedList<>();
for (ExpressionSegment each : inRightValue.getSqlExpressions()) {
if (!(each instanceof SimpleExpressionSegment)) {
sqlExpressions.clear(); // depends on control dependency: [if], data = [none]
break;
} else {
sqlExpressions.add(((SimpleExpressionSegment) each).getSQLExpression()); // depends on control dependency: [if], data = [none]
}
}
return sqlExpressions.isEmpty() ? Optional.<Condition>absent() : Optional.of(new Condition(column, sqlExpressions));
} } |
public class class_name {
public void finalizeConfig() {
// See if not set by configuration, if there are defaults
// in order from the Endpoint, Service, or Bus.
configureConduitFromEndpointInfo(this, endpointInfo);
logConfig();
if (getClient().getDecoupledEndpoint() != null) {
this.endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto",
getClient().getDecoupledEndpoint());
}
} } | public class class_name {
public void finalizeConfig() {
// See if not set by configuration, if there are defaults
// in order from the Endpoint, Service, or Bus.
configureConduitFromEndpointInfo(this, endpointInfo);
logConfig();
if (getClient().getDecoupledEndpoint() != null) {
this.endpointInfo.setProperty("org.apache.cxf.ws.addressing.replyto",
getClient().getDecoupledEndpoint()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void validateIndexSearchersForQuery(List<IndexExpression> clause) throws InvalidRequestException
{
// Group by index type
Map<String, Set<IndexExpression>> expressionsByIndexType = new HashMap<>();
Map<String, Set<ByteBuffer>> columnsByIndexType = new HashMap<>();
for (IndexExpression indexExpression : clause)
{
SecondaryIndex index = getIndexForColumn(indexExpression.column);
if (index == null)
continue;
String canonicalIndexName = index.getClass().getCanonicalName();
Set<IndexExpression> expressions = expressionsByIndexType.get(canonicalIndexName);
Set<ByteBuffer> columns = columnsByIndexType.get(canonicalIndexName);
if (expressions == null)
{
expressions = new HashSet<>();
columns = new HashSet<>();
expressionsByIndexType.put(canonicalIndexName, expressions);
columnsByIndexType.put(canonicalIndexName, columns);
}
expressions.add(indexExpression);
columns.add(indexExpression.column);
}
// Validate
boolean haveSupportedIndexLookup = false;
for (Map.Entry<String, Set<IndexExpression>> expressions : expressionsByIndexType.entrySet())
{
Set<ByteBuffer> columns = columnsByIndexType.get(expressions.getKey());
SecondaryIndex secondaryIndex = getIndexForColumn(columns.iterator().next());
SecondaryIndexSearcher searcher = secondaryIndex.createSecondaryIndexSearcher(columns);
for (IndexExpression expression : expressions.getValue())
{
searcher.validate(expression);
haveSupportedIndexLookup |= secondaryIndex.supportsOperator(expression.operator);
}
}
if (!haveSupportedIndexLookup)
{
// build the error message
int i = 0;
StringBuilder sb = new StringBuilder("No secondary indexes on the restricted columns support the provided operators: ");
for (Map.Entry<String, Set<IndexExpression>> expressions : expressionsByIndexType.entrySet())
{
for (IndexExpression expression : expressions.getValue())
{
if (i++ > 0)
sb.append(", ");
sb.append("'");
String columnName;
try
{
columnName = ByteBufferUtil.string(expression.column);
}
catch (CharacterCodingException ex)
{
columnName = "<unprintable>";
}
sb.append(columnName).append(" ").append(expression.operator).append(" <value>").append("'");
}
}
throw new InvalidRequestException(sb.toString());
}
} } | public class class_name {
public void validateIndexSearchersForQuery(List<IndexExpression> clause) throws InvalidRequestException
{
// Group by index type
Map<String, Set<IndexExpression>> expressionsByIndexType = new HashMap<>();
Map<String, Set<ByteBuffer>> columnsByIndexType = new HashMap<>();
for (IndexExpression indexExpression : clause)
{
SecondaryIndex index = getIndexForColumn(indexExpression.column);
if (index == null)
continue;
String canonicalIndexName = index.getClass().getCanonicalName();
Set<IndexExpression> expressions = expressionsByIndexType.get(canonicalIndexName);
Set<ByteBuffer> columns = columnsByIndexType.get(canonicalIndexName);
if (expressions == null)
{
expressions = new HashSet<>(); // depends on control dependency: [if], data = [none]
columns = new HashSet<>(); // depends on control dependency: [if], data = [none]
expressionsByIndexType.put(canonicalIndexName, expressions); // depends on control dependency: [if], data = [none]
columnsByIndexType.put(canonicalIndexName, columns); // depends on control dependency: [if], data = [none]
}
expressions.add(indexExpression);
columns.add(indexExpression.column);
}
// Validate
boolean haveSupportedIndexLookup = false;
for (Map.Entry<String, Set<IndexExpression>> expressions : expressionsByIndexType.entrySet())
{
Set<ByteBuffer> columns = columnsByIndexType.get(expressions.getKey());
SecondaryIndex secondaryIndex = getIndexForColumn(columns.iterator().next());
SecondaryIndexSearcher searcher = secondaryIndex.createSecondaryIndexSearcher(columns);
for (IndexExpression expression : expressions.getValue())
{
searcher.validate(expression);
haveSupportedIndexLookup |= secondaryIndex.supportsOperator(expression.operator);
}
}
if (!haveSupportedIndexLookup)
{
// build the error message
int i = 0;
StringBuilder sb = new StringBuilder("No secondary indexes on the restricted columns support the provided operators: ");
for (Map.Entry<String, Set<IndexExpression>> expressions : expressionsByIndexType.entrySet())
{
for (IndexExpression expression : expressions.getValue())
{
if (i++ > 0)
sb.append(", ");
sb.append("'"); // depends on control dependency: [for], data = [none]
String columnName;
try
{
columnName = ByteBufferUtil.string(expression.column); // depends on control dependency: [try], data = [none]
}
catch (CharacterCodingException ex)
{
columnName = "<unprintable>";
} // depends on control dependency: [catch], data = [none]
sb.append(columnName).append(" ").append(expression.operator).append(" <value>").append("'"); // depends on control dependency: [for], data = [expression]
}
}
throw new InvalidRequestException(sb.toString());
}
} } |
public class class_name {
@Override
public EClass getIfcCostItem() {
if (ifcCostItemEClass == null) {
ifcCostItemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(149);
}
return ifcCostItemEClass;
} } | public class class_name {
@Override
public EClass getIfcCostItem() {
if (ifcCostItemEClass == null) {
ifcCostItemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(149);
// depends on control dependency: [if], data = [none]
}
return ifcCostItemEClass;
} } |
public class class_name {
public static ByteArrayInputStream toStream(ByteBuffer byteBuffer) {
if (byteBuffer == null) {
return new ByteArrayInputStream(new byte[0]);
}
return new ByteArrayInputStream(copyBytesFrom(byteBuffer));
} } | public class class_name {
public static ByteArrayInputStream toStream(ByteBuffer byteBuffer) {
if (byteBuffer == null) {
return new ByteArrayInputStream(new byte[0]); // depends on control dependency: [if], data = [none]
}
return new ByteArrayInputStream(copyBytesFrom(byteBuffer));
} } |
public class class_name {
public static BufferedWriter newWriter(Path self, String charset, boolean append, boolean writeBom) throws IOException {
boolean shouldWriteBom = writeBom && !self.toFile().exists();
if (append) {
BufferedWriter writer = Files.newBufferedWriter(self, Charset.forName(charset), CREATE, APPEND);
if (shouldWriteBom) {
IOGroovyMethods.writeUTF16BomIfRequired(writer, charset);
}
return writer;
} else {
OutputStream out = Files.newOutputStream(self);
if (shouldWriteBom) {
IOGroovyMethods.writeUTF16BomIfRequired(out, charset);
}
return new BufferedWriter(new OutputStreamWriter(out, Charset.forName(charset)));
}
} } | public class class_name {
public static BufferedWriter newWriter(Path self, String charset, boolean append, boolean writeBom) throws IOException {
boolean shouldWriteBom = writeBom && !self.toFile().exists();
if (append) {
BufferedWriter writer = Files.newBufferedWriter(self, Charset.forName(charset), CREATE, APPEND);
if (shouldWriteBom) {
IOGroovyMethods.writeUTF16BomIfRequired(writer, charset); // depends on control dependency: [if], data = [none]
}
return writer;
} else {
OutputStream out = Files.newOutputStream(self);
if (shouldWriteBom) {
IOGroovyMethods.writeUTF16BomIfRequired(out, charset); // depends on control dependency: [if], data = [none]
}
return new BufferedWriter(new OutputStreamWriter(out, Charset.forName(charset)));
}
} } |
public class class_name {
private final JSRemoteConsumerPoint findOrCreateJSRemoteConsumerPoint(String[] discriminators, int[] selectorDomains,
String[] selectors)
throws ClosedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "findOrCreateJSRemoteConsumerPoint",
new Object[]{Arrays.toString(discriminators),
Arrays.toString(selectorDomains),
Arrays.toString(selectors)});
String selectionCriteriasAsString = parent.convertSelectionCriteriasToString(
discriminators, selectorDomains, selectors);
JSRemoteConsumerPoint aock = (JSRemoteConsumerPoint) consumerKeyTable.get(selectionCriteriasAsString);
if (aock == null)
{
try
{
// create an JSRemoteConsumerPoint
aock = new JSRemoteConsumerPoint();
SelectionCriteria[] criterias = new SelectionCriteria[discriminators.length];
ConsumableKey[] consumerKeys = new ConsumableKey[discriminators.length];
OrderingContextImpl ocontext = null;
SIBUuid12 connectionUuid = new SIBUuid12();
if (discriminators.length > 1)
ocontext = new OrderingContextImpl(); // create a new ordering context
for (int i=0; i < discriminators.length; i++)
{
SelectorDomain domain = SelectorDomain.getSelectorDomain(selectorDomains[i]);
criterias[i] = parent.createSelectionCriteria(discriminators[i], selectors[i], domain);
// attach as many times as necessary
consumerKeys[i] =
(ConsumableKey) consumerDispatcher.attachConsumerPoint(
aock,
criterias[i],
connectionUuid,
false,
false,
null);
if (ocontext != null)
consumerDispatcher.joinKeyGroup(consumerKeys[i], ocontext);
consumerKeys[i].start(); // in case we use a ConsumerKeyGroup, this is essential
}
if (parent.getCardinalityOne() || consumerDispatcher.isPubSub())
{
// effectively infinite timeout, since don't want to close the ConsumerKey if RME is inactive for
// a while. Only close this ConsumerKey when start flushing this stream.
// NOTE shared durable subs might not be cardinality one but we still do not want the streams
// to flush on timeout
//
// Defect 516583, set the idleTimeout parameter to 0, not to Long.MAX_VALUE in order to have an
// "infinite timeout".
aock.init(this, selectionCriteriasAsString, consumerKeys, 0, am, criterias);
}
else
{
aock.init(
this,
selectionCriteriasAsString,
consumerKeys,
mp.getCustomProperties().get_ck_idle_timeout(),
am,
criterias);
}
consumerKeyTable.put(selectionCriteriasAsString, aock);
}
catch (Exception e)
{
// should not occur!
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AOStream.findOrCreateJSRemoteConsumerPoint",
"1:2942:1.80.3.24",
this);
SibTr.exception(tc, e);
aock = null;
ClosedException e2 = new ClosedException(e.getMessage());
// just using the ClosedException as a convenience
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "findOrCreateJSRemoteConsumerPoint", e2);
throw e2;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "findOrCreateJSRemoteConsumerPoint", aock);
return aock;
} } | public class class_name {
private final JSRemoteConsumerPoint findOrCreateJSRemoteConsumerPoint(String[] discriminators, int[] selectorDomains,
String[] selectors)
throws ClosedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "findOrCreateJSRemoteConsumerPoint",
new Object[]{Arrays.toString(discriminators),
Arrays.toString(selectorDomains),
Arrays.toString(selectors)});
String selectionCriteriasAsString = parent.convertSelectionCriteriasToString(
discriminators, selectorDomains, selectors);
JSRemoteConsumerPoint aock = (JSRemoteConsumerPoint) consumerKeyTable.get(selectionCriteriasAsString);
if (aock == null)
{
try
{
// create an JSRemoteConsumerPoint
aock = new JSRemoteConsumerPoint(); // depends on control dependency: [try], data = [none]
SelectionCriteria[] criterias = new SelectionCriteria[discriminators.length];
ConsumableKey[] consumerKeys = new ConsumableKey[discriminators.length];
OrderingContextImpl ocontext = null;
SIBUuid12 connectionUuid = new SIBUuid12();
if (discriminators.length > 1)
ocontext = new OrderingContextImpl(); // create a new ordering context
for (int i=0; i < discriminators.length; i++)
{
SelectorDomain domain = SelectorDomain.getSelectorDomain(selectorDomains[i]);
criterias[i] = parent.createSelectionCriteria(discriminators[i], selectors[i], domain); // depends on control dependency: [for], data = [i]
// attach as many times as necessary
consumerKeys[i] =
(ConsumableKey) consumerDispatcher.attachConsumerPoint(
aock,
criterias[i],
connectionUuid,
false,
false,
null); // depends on control dependency: [for], data = [none]
if (ocontext != null)
consumerDispatcher.joinKeyGroup(consumerKeys[i], ocontext);
consumerKeys[i].start(); // in case we use a ConsumerKeyGroup, this is essential // depends on control dependency: [for], data = [i]
}
if (parent.getCardinalityOne() || consumerDispatcher.isPubSub())
{
// effectively infinite timeout, since don't want to close the ConsumerKey if RME is inactive for
// a while. Only close this ConsumerKey when start flushing this stream.
// NOTE shared durable subs might not be cardinality one but we still do not want the streams
// to flush on timeout
//
// Defect 516583, set the idleTimeout parameter to 0, not to Long.MAX_VALUE in order to have an
// "infinite timeout".
aock.init(this, selectionCriteriasAsString, consumerKeys, 0, am, criterias); // depends on control dependency: [if], data = [none]
}
else
{
aock.init(
this,
selectionCriteriasAsString,
consumerKeys,
mp.getCustomProperties().get_ck_idle_timeout(),
am,
criterias); // depends on control dependency: [if], data = [none]
}
consumerKeyTable.put(selectionCriteriasAsString, aock); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
// should not occur!
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AOStream.findOrCreateJSRemoteConsumerPoint",
"1:2942:1.80.3.24",
this);
SibTr.exception(tc, e);
aock = null;
ClosedException e2 = new ClosedException(e.getMessage());
// just using the ClosedException as a convenience
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "findOrCreateJSRemoteConsumerPoint", e2);
throw e2;
} // depends on control dependency: [catch], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "findOrCreateJSRemoteConsumerPoint", aock);
return aock;
} } |
public class class_name {
@Override
public final String getNamespaceURI(String prefix)
{
if (prefix.length() == 0) { //default NS
return mDefaultNsURI;
}
if (mNsMapping != null) {
String uri = mNsMapping.findUriByPrefix(prefix);
if (uri != null) {
return uri;
}
}
return (mRootNsContext != null) ?
mRootNsContext.getNamespaceURI(prefix) : null;
} } | public class class_name {
@Override
public final String getNamespaceURI(String prefix)
{
if (prefix.length() == 0) { //default NS
return mDefaultNsURI; // depends on control dependency: [if], data = [none]
}
if (mNsMapping != null) {
String uri = mNsMapping.findUriByPrefix(prefix);
if (uri != null) {
return uri; // depends on control dependency: [if], data = [none]
}
}
return (mRootNsContext != null) ?
mRootNsContext.getNamespaceURI(prefix) : null;
} } |
public class class_name {
private static void mergeBins(
int mergedBinCount,
float[] mergedPositions,
long[] mergedBins,
float[] deltas,
int numMerge,
int[] next,
int[] prev
)
{
// repeatedly search for two closest bins, merge them and update the corresponding deltas
// maintain index to the last valid bin
int lastValidIndex = mergedBinCount - 1;
// initialize prev / next lookup arrays
for (int i = 0; i < mergedBinCount; ++i) {
next[i] = i + 1;
}
for (int i = 0; i < mergedBinCount; ++i) {
prev[i] = i - 1;
}
// initialize min-heap of deltas and the reverse index into the heap
int heapSize = mergedBinCount - 1;
int[] heap = new int[heapSize];
int[] reverseIndex = new int[heapSize];
for (int i = 0; i < heapSize; ++i) {
heap[i] = i;
}
for (int i = 0; i < heapSize; ++i) {
reverseIndex[i] = i;
}
heapify(heap, reverseIndex, heapSize, deltas);
{
int i = 0;
while (i < numMerge) {
// find the smallest delta within the range used for bins
// pick minimum delta index using min-heap
int currentIndex = heap[0];
final int nextIndex = next[currentIndex];
final int prevIndex = prev[currentIndex];
final long k0 = mergedBins[currentIndex] & COUNT_BITS;
final long k1 = mergedBins[nextIndex] & COUNT_BITS;
final float m0 = mergedPositions[currentIndex];
final float m1 = mergedPositions[nextIndex];
final float d1 = deltas[nextIndex];
final long sum = k0 + k1;
final float w = (float) k0 / (float) sum;
// merge bin at given position with the next bin
final float mm0 = (m0 - m1) * w + m1;
mergedPositions[currentIndex] = mm0;
mergedBins[currentIndex] = sum | APPROX_FLAG_BIT;
// update deltas and min-heap
if (nextIndex == lastValidIndex) {
// merged bin is the last => remove the current bin delta from the heap
heapSize = heapDelete(heap, reverseIndex, heapSize, reverseIndex[currentIndex], deltas);
} else {
// merged bin is not the last => remove the merged bin delta from the heap
heapSize = heapDelete(heap, reverseIndex, heapSize, reverseIndex[nextIndex], deltas);
// updated current delta
deltas[currentIndex] = m1 - mm0 + d1;
// updated delta is necessarily larger than existing one, therefore we only need to push it down the heap
siftDown(heap, reverseIndex, reverseIndex[currentIndex], heapSize - 1, deltas);
}
if (prevIndex >= 0) {
// current bin is not the first, therefore update the previous bin delta
deltas[prevIndex] = mm0 - mergedPositions[prevIndex];
// updated previous bin delta is necessarily larger than its existing value => push down the heap
siftDown(heap, reverseIndex, reverseIndex[prevIndex], heapSize - 1, deltas);
}
// update last valid index if we merged the last bin
if (nextIndex == lastValidIndex) {
lastValidIndex = currentIndex;
}
next[currentIndex] = next[nextIndex];
if (nextIndex < lastValidIndex) {
prev[next[nextIndex]] = currentIndex;
}
++i;
}
}
} } | public class class_name {
private static void mergeBins(
int mergedBinCount,
float[] mergedPositions,
long[] mergedBins,
float[] deltas,
int numMerge,
int[] next,
int[] prev
)
{
// repeatedly search for two closest bins, merge them and update the corresponding deltas
// maintain index to the last valid bin
int lastValidIndex = mergedBinCount - 1;
// initialize prev / next lookup arrays
for (int i = 0; i < mergedBinCount; ++i) {
next[i] = i + 1; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < mergedBinCount; ++i) {
prev[i] = i - 1; // depends on control dependency: [for], data = [i]
}
// initialize min-heap of deltas and the reverse index into the heap
int heapSize = mergedBinCount - 1;
int[] heap = new int[heapSize];
int[] reverseIndex = new int[heapSize];
for (int i = 0; i < heapSize; ++i) {
heap[i] = i; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < heapSize; ++i) {
reverseIndex[i] = i; // depends on control dependency: [for], data = [i]
}
heapify(heap, reverseIndex, heapSize, deltas);
{
int i = 0;
while (i < numMerge) {
// find the smallest delta within the range used for bins
// pick minimum delta index using min-heap
int currentIndex = heap[0];
final int nextIndex = next[currentIndex];
final int prevIndex = prev[currentIndex];
final long k0 = mergedBins[currentIndex] & COUNT_BITS;
final long k1 = mergedBins[nextIndex] & COUNT_BITS;
final float m0 = mergedPositions[currentIndex];
final float m1 = mergedPositions[nextIndex];
final float d1 = deltas[nextIndex];
final long sum = k0 + k1;
final float w = (float) k0 / (float) sum;
// merge bin at given position with the next bin
final float mm0 = (m0 - m1) * w + m1;
mergedPositions[currentIndex] = mm0; // depends on control dependency: [while], data = [none]
mergedBins[currentIndex] = sum | APPROX_FLAG_BIT; // depends on control dependency: [while], data = [none]
// update deltas and min-heap
if (nextIndex == lastValidIndex) {
// merged bin is the last => remove the current bin delta from the heap
heapSize = heapDelete(heap, reverseIndex, heapSize, reverseIndex[currentIndex], deltas); // depends on control dependency: [if], data = [none]
} else {
// merged bin is not the last => remove the merged bin delta from the heap
heapSize = heapDelete(heap, reverseIndex, heapSize, reverseIndex[nextIndex], deltas); // depends on control dependency: [if], data = [none]
// updated current delta
deltas[currentIndex] = m1 - mm0 + d1; // depends on control dependency: [if], data = [none]
// updated delta is necessarily larger than existing one, therefore we only need to push it down the heap
siftDown(heap, reverseIndex, reverseIndex[currentIndex], heapSize - 1, deltas); // depends on control dependency: [if], data = [none]
}
if (prevIndex >= 0) {
// current bin is not the first, therefore update the previous bin delta
deltas[prevIndex] = mm0 - mergedPositions[prevIndex]; // depends on control dependency: [if], data = [none]
// updated previous bin delta is necessarily larger than its existing value => push down the heap
siftDown(heap, reverseIndex, reverseIndex[prevIndex], heapSize - 1, deltas); // depends on control dependency: [if], data = [none]
}
// update last valid index if we merged the last bin
if (nextIndex == lastValidIndex) {
lastValidIndex = currentIndex; // depends on control dependency: [if], data = [none]
}
next[currentIndex] = next[nextIndex]; // depends on control dependency: [while], data = [none]
if (nextIndex < lastValidIndex) {
prev[next[nextIndex]] = currentIndex; // depends on control dependency: [if], data = [none]
}
++i; // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
public void remove() {
Thread thread = Thread.currentThread();
if (thread instanceof ThreadPool.Worker) {
Object[] wsLocals = getThreadLocals((ThreadPool.Worker) thread);
wsLocals[index] = null;
} else {
super.remove();
}
} } | public class class_name {
public void remove() {
Thread thread = Thread.currentThread();
if (thread instanceof ThreadPool.Worker) {
Object[] wsLocals = getThreadLocals((ThreadPool.Worker) thread);
wsLocals[index] = null; // depends on control dependency: [if], data = [none]
} else {
super.remove(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(SortCriterion sortCriterion, ProtocolMarshaller protocolMarshaller) {
if (sortCriterion == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sortCriterion.getField(), FIELD_BINDING);
protocolMarshaller.marshall(sortCriterion.getSortOrder(), SORTORDER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(SortCriterion sortCriterion, ProtocolMarshaller protocolMarshaller) {
if (sortCriterion == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sortCriterion.getField(), FIELD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sortCriterion.getSortOrder(), SORTORDER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public List<Server> getEligibleServers(List<Server> servers, Object loadBalancerKey) {
List<Server> result = super.getEligibleServers(servers, loadBalancerKey);
Iterator<AbstractServerPredicate> i = fallbacks.iterator();
while (!(result.size() >= minimalFilteredServers && result.size() > (int) (servers.size() * minimalFilteredPercentage))
&& i.hasNext()) {
AbstractServerPredicate predicate = i.next();
result = predicate.getEligibleServers(servers, loadBalancerKey);
}
return result;
} } | public class class_name {
@Override
public List<Server> getEligibleServers(List<Server> servers, Object loadBalancerKey) {
List<Server> result = super.getEligibleServers(servers, loadBalancerKey);
Iterator<AbstractServerPredicate> i = fallbacks.iterator();
while (!(result.size() >= minimalFilteredServers && result.size() > (int) (servers.size() * minimalFilteredPercentage))
&& i.hasNext()) {
AbstractServerPredicate predicate = i.next();
result = predicate.getEligibleServers(servers, loadBalancerKey); // depends on control dependency: [while], data = [none]
}
return result;
} } |
public class class_name {
@Override
protected void onBeforeRender()
{
if (isRequired())
{
getFormComponent().add(new AttributeModifier("required", "required"));
}
getFormComponent().setRequired(isRequired());
super.onBeforeRender();
} } | public class class_name {
@Override
protected void onBeforeRender()
{
if (isRequired())
{
getFormComponent().add(new AttributeModifier("required", "required"));
// depends on control dependency: [if], data = [none]
}
getFormComponent().setRequired(isRequired());
super.onBeforeRender();
} } |
public class class_name {
public void init(final FilterConfig filterConfig) {
final String allowParam = filterConfig.getInitParameter("allowUrls");
if (StringUtils.isNotBlank(allowParam)) {
this.allowUrls = allowParam.split(",");
}
} } | public class class_name {
public void init(final FilterConfig filterConfig) {
final String allowParam = filterConfig.getInitParameter("allowUrls");
if (StringUtils.isNotBlank(allowParam)) {
this.allowUrls = allowParam.split(","); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static public final String crypt(String password, String salt, String magic) {
byte finalState[];
long l;
/**
* Two MD5 hashes are used
*/
MessageDigest ctx, ctx1;
try {
ctx = MessageDigest.getInstance("md5");
ctx1 = MessageDigest.getInstance("md5");
} catch (NoSuchAlgorithmException ex) {
System.err.println(ex);
return null;
}
/* Refine the Salt first */
/* If it starts with the magic string, then skip that */
if (salt.startsWith(magic)) {
salt = salt.substring(magic.length());
}
/* It stops at the first '$', max 8 chars */
if (salt.indexOf('$') != -1) {
salt = salt.substring(0, salt.indexOf('$'));
}
if (salt.length() > 8) {
salt = salt.substring(0, 8);
}
/**
* Transformation set #1: The password first, since that is what is most
* unknown Magic string Raw salt
*/
ctx.update(password.getBytes());
ctx.update(magic.getBytes());
ctx.update(salt.getBytes());
/* Then just as many characters of the MD5(pw,salt,pw) */
ctx1.update(password.getBytes());
ctx1.update(salt.getBytes());
ctx1.update(password.getBytes());
finalState = ctx1.digest(); // ctx1.Final();
for (int pl = password.length(); pl > 0; pl -= 16) {
ctx.update(finalState, 0, pl > 16 ? 16 : pl);
}
/**
* the original code claimed that finalState was being cleared to keep
* dangerous bits out of memory, but doing this is also required in
* order to get the right output.
*/
clearbits(finalState);
/* Then something really weird... */
for (int i = password.length(); i != 0; i >>>= 1) {
if ((i & 1) != 0) {
ctx.update(finalState, 0, 1);
} else {
ctx.update(password.getBytes(), 0, 1);
}
}
finalState = ctx.digest();
/**
* and now, just to make sure things don't run too fast On a 60 Mhz
* Pentium this takes 34 msec, so you would need 30 seconds to build a
* 1000 entry dictionary... (The above timings from the C version)
*/
for (int i = 0; i < 1000; i++) {
try {
ctx1 = MessageDigest.getInstance("md5");
} catch (NoSuchAlgorithmException e0) {
return null;
}
if ((i & 1) != 0) {
ctx1.update(password.getBytes());
} else {
ctx1.update(finalState, 0, 16);
}
if ((i % 3) != 0) {
ctx1.update(salt.getBytes());
}
if ((i % 7) != 0) {
ctx1.update(password.getBytes());
}
if ((i & 1) != 0) {
ctx1.update(finalState, 0, 16);
} else {
ctx1.update(password.getBytes());
}
finalState = ctx1.digest(); // Final();
}
/* Now make the output string */
StringBuffer result = new StringBuffer();
result.append(magic);
result.append(salt);
result.append("$");
/**
* Build a 22 byte output string from the set: A-Za-z0-9./
*/
l = (bytes2u(finalState[0]) << 16) | (bytes2u(finalState[6]) << 8)
| bytes2u(finalState[12]);
result.append(to64(l, 4));
l = (bytes2u(finalState[1]) << 16) | (bytes2u(finalState[7]) << 8)
| bytes2u(finalState[13]);
result.append(to64(l, 4));
l = (bytes2u(finalState[2]) << 16) | (bytes2u(finalState[8]) << 8)
| bytes2u(finalState[14]);
result.append(to64(l, 4));
l = (bytes2u(finalState[3]) << 16) | (bytes2u(finalState[9]) << 8)
| bytes2u(finalState[15]);
result.append(to64(l, 4));
l = (bytes2u(finalState[4]) << 16) | (bytes2u(finalState[10]) << 8)
| bytes2u(finalState[5]);
result.append(to64(l, 4));
l = bytes2u(finalState[11]);
result.append(to64(l, 2));
/* Don't leave anything around in vm they could use. */
clearbits(finalState);
return result.toString();
} } | public class class_name {
static public final String crypt(String password, String salt, String magic) {
byte finalState[];
long l;
/**
* Two MD5 hashes are used
*/
MessageDigest ctx, ctx1;
try {
ctx = MessageDigest.getInstance("md5"); // depends on control dependency: [try], data = [none]
ctx1 = MessageDigest.getInstance("md5"); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException ex) {
System.err.println(ex);
return null;
} // depends on control dependency: [catch], data = [none]
/* Refine the Salt first */
/* If it starts with the magic string, then skip that */
if (salt.startsWith(magic)) {
salt = salt.substring(magic.length()); // depends on control dependency: [if], data = [none]
}
/* It stops at the first '$', max 8 chars */
if (salt.indexOf('$') != -1) {
salt = salt.substring(0, salt.indexOf('$')); // depends on control dependency: [if], data = [none]
}
if (salt.length() > 8) {
salt = salt.substring(0, 8); // depends on control dependency: [if], data = [8)]
}
/**
* Transformation set #1: The password first, since that is what is most
* unknown Magic string Raw salt
*/
ctx.update(password.getBytes());
ctx.update(magic.getBytes());
ctx.update(salt.getBytes());
/* Then just as many characters of the MD5(pw,salt,pw) */
ctx1.update(password.getBytes());
ctx1.update(salt.getBytes());
ctx1.update(password.getBytes());
finalState = ctx1.digest(); // ctx1.Final();
for (int pl = password.length(); pl > 0; pl -= 16) {
ctx.update(finalState, 0, pl > 16 ? 16 : pl); // depends on control dependency: [for], data = [pl]
}
/**
* the original code claimed that finalState was being cleared to keep
* dangerous bits out of memory, but doing this is also required in
* order to get the right output.
*/
clearbits(finalState);
/* Then something really weird... */
for (int i = password.length(); i != 0; i >>>= 1) {
if ((i & 1) != 0) {
ctx.update(finalState, 0, 1); // depends on control dependency: [if], data = [none]
} else {
ctx.update(password.getBytes(), 0, 1); // depends on control dependency: [if], data = [none]
}
}
finalState = ctx.digest();
/**
* and now, just to make sure things don't run too fast On a 60 Mhz
* Pentium this takes 34 msec, so you would need 30 seconds to build a
* 1000 entry dictionary... (The above timings from the C version)
*/
for (int i = 0; i < 1000; i++) {
try {
ctx1 = MessageDigest.getInstance("md5"); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e0) {
return null;
} // depends on control dependency: [catch], data = [none]
if ((i & 1) != 0) {
ctx1.update(password.getBytes()); // depends on control dependency: [if], data = [none]
} else {
ctx1.update(finalState, 0, 16); // depends on control dependency: [if], data = [none]
}
if ((i % 3) != 0) {
ctx1.update(salt.getBytes()); // depends on control dependency: [if], data = [none]
}
if ((i % 7) != 0) {
ctx1.update(password.getBytes()); // depends on control dependency: [if], data = [none]
}
if ((i & 1) != 0) {
ctx1.update(finalState, 0, 16); // depends on control dependency: [if], data = [none]
} else {
ctx1.update(password.getBytes()); // depends on control dependency: [if], data = [none]
}
finalState = ctx1.digest(); // Final(); // depends on control dependency: [for], data = [none]
}
/* Now make the output string */
StringBuffer result = new StringBuffer();
result.append(magic);
result.append(salt);
result.append("$");
/**
* Build a 22 byte output string from the set: A-Za-z0-9./
*/
l = (bytes2u(finalState[0]) << 16) | (bytes2u(finalState[6]) << 8)
| bytes2u(finalState[12]);
result.append(to64(l, 4));
l = (bytes2u(finalState[1]) << 16) | (bytes2u(finalState[7]) << 8)
| bytes2u(finalState[13]);
result.append(to64(l, 4));
l = (bytes2u(finalState[2]) << 16) | (bytes2u(finalState[8]) << 8)
| bytes2u(finalState[14]);
result.append(to64(l, 4));
l = (bytes2u(finalState[3]) << 16) | (bytes2u(finalState[9]) << 8)
| bytes2u(finalState[15]);
result.append(to64(l, 4));
l = (bytes2u(finalState[4]) << 16) | (bytes2u(finalState[10]) << 8)
| bytes2u(finalState[5]);
result.append(to64(l, 4));
l = bytes2u(finalState[11]);
result.append(to64(l, 2));
/* Don't leave anything around in vm they could use. */
clearbits(finalState);
return result.toString();
} } |
public class class_name {
protected void addClassList(Content contentTree) throws IOException {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
for (PackageDoc pkg : pkgSet) {
Content markerAnchor = getMarkerAnchor(getPackageAnchorName(pkg));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(markerAnchor)
: HtmlTree.LI(HtmlStyle.blockList, markerAnchor);
Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
classdoc)),
getPackageLink(pkg, utils.getPackageName(pkg)));
Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
htmlTree.addContent(heading);
addClassUse(pkg, htmlTree);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
} else {
ul.addContent(htmlTree);
}
}
Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
contentTree.addContent(li);
} } | public class class_name {
protected void addClassList(Content contentTree) throws IOException {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
for (PackageDoc pkg : pkgSet) {
Content markerAnchor = getMarkerAnchor(getPackageAnchorName(pkg));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION(markerAnchor)
: HtmlTree.LI(HtmlStyle.blockList, markerAnchor);
Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
classdoc)),
getPackageLink(pkg, utils.getPackageName(pkg)));
Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
htmlTree.addContent(heading);
addClassUse(pkg, htmlTree);
if (configuration.allowTag(HtmlTag.SECTION)) {
ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree)); // depends on control dependency: [if], data = [none]
} else {
ul.addContent(htmlTree); // depends on control dependency: [if], data = [none]
}
}
Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
contentTree.addContent(li);
} } |
public class class_name {
public void roundRectangle(float x, float y, float w, float h, float r) {
if (w < 0) {
x += w;
w = -w;
}
if (h < 0) {
y += h;
h = -h;
}
if (r < 0)
r = -r;
float b = 0.4477f;
moveTo(x + r, y);
lineTo(x + w - r, y);
curveTo(x + w - r * b, y, x + w, y + r * b, x + w, y + r);
lineTo(x + w, y + h - r);
curveTo(x + w, y + h - r * b, x + w - r * b, y + h, x + w - r, y + h);
lineTo(x + r, y + h);
curveTo(x + r * b, y + h, x, y + h - r * b, x, y + h - r);
lineTo(x, y + r);
curveTo(x, y + r * b, x + r * b, y, x + r, y);
} } | public class class_name {
public void roundRectangle(float x, float y, float w, float h, float r) {
if (w < 0) {
x += w; // depends on control dependency: [if], data = [none]
w = -w; // depends on control dependency: [if], data = [none]
}
if (h < 0) {
y += h; // depends on control dependency: [if], data = [none]
h = -h; // depends on control dependency: [if], data = [none]
}
if (r < 0)
r = -r;
float b = 0.4477f;
moveTo(x + r, y);
lineTo(x + w - r, y);
curveTo(x + w - r * b, y, x + w, y + r * b, x + w, y + r);
lineTo(x + w, y + h - r);
curveTo(x + w, y + h - r * b, x + w - r * b, y + h, x + w - r, y + h);
lineTo(x + r, y + h);
curveTo(x + r * b, y + h, x, y + h - r * b, x, y + h - r);
lineTo(x, y + r);
curveTo(x, y + r * b, x + r * b, y, x + r, y);
} } |
public class class_name {
private Object[] generateMethodParams(Object method, Object[] astParams) {
if (!"filter".equals(method)) {
return astParams; // We only change the signature method for filters
}
List<Object> args = new ArrayList<>();
Map<String, Object> kwargs = new LinkedHashMap<>();
// 2 -> Ignore the Left Value (0) and the JinjavaInterpreter (1)
for (Object param: Arrays.asList(astParams).subList(2, astParams.length)) {
if (param instanceof NamedParameter) {
NamedParameter namedParameter = (NamedParameter) param;
kwargs.put(namedParameter.getName(), namedParameter.getValue());
} else {
args.add(param);
}
}
return new Object[] {astParams[0], astParams[1], args.toArray(), kwargs};
} } | public class class_name {
private Object[] generateMethodParams(Object method, Object[] astParams) {
if (!"filter".equals(method)) {
return astParams; // We only change the signature method for filters // depends on control dependency: [if], data = [none]
}
List<Object> args = new ArrayList<>();
Map<String, Object> kwargs = new LinkedHashMap<>();
// 2 -> Ignore the Left Value (0) and the JinjavaInterpreter (1)
for (Object param: Arrays.asList(astParams).subList(2, astParams.length)) {
if (param instanceof NamedParameter) {
NamedParameter namedParameter = (NamedParameter) param;
kwargs.put(namedParameter.getName(), namedParameter.getValue()); // depends on control dependency: [if], data = [none]
} else {
args.add(param); // depends on control dependency: [if], data = [none]
}
}
return new Object[] {astParams[0], astParams[1], args.toArray(), kwargs};
} } |
public class class_name {
public static Method getAccessibleMethod(final Object obj, final String methodName, final Class<?>... parameterTypes) {
Asserts.notNull(obj, "object cannot be null.");
for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) {
try {
Method method = superClass.getDeclaredMethod(methodName, parameterTypes);
method.setAccessible(true);
return method;
} catch (NoSuchMethodException e) {//NOSONAR
// Method不在当前类定义,继续向上转型
}
}
return null;
} } | public class class_name {
public static Method getAccessibleMethod(final Object obj, final String methodName, final Class<?>... parameterTypes) {
Asserts.notNull(obj, "object cannot be null.");
for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) {
try {
Method method = superClass.getDeclaredMethod(methodName, parameterTypes);
method.setAccessible(true); // depends on control dependency: [try], data = [none]
return method; // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {//NOSONAR
// Method不在当前类定义,继续向上转型
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
public static double min( ImageBase input ) {
if( input instanceof ImageGray) {
if (GrayU8.class == input.getClass()) {
return ImageStatistics.min((GrayU8) input);
} else if (GrayS8.class == input.getClass()) {
return ImageStatistics.min((GrayS8) input);
} else if (GrayU16.class == input.getClass()) {
return ImageStatistics.min((GrayU16) input);
} else if (GrayS16.class == input.getClass()) {
return ImageStatistics.min((GrayS16) input);
} else if (GrayS32.class == input.getClass()) {
return ImageStatistics.min((GrayS32) input);
} else if (GrayS64.class == input.getClass()) {
return ImageStatistics.min((GrayS64) input);
} else if (GrayF32.class == input.getClass()) {
return ImageStatistics.min((GrayF32) input);
} else if (GrayF64.class == input.getClass()) {
return ImageStatistics.min((GrayF64) input);
} else {
throw new IllegalArgumentException("Unknown Image Type: " + input.getClass().getSimpleName());
}
} else if( input instanceof ImageInterleaved ) {
if (InterleavedU8.class == input.getClass()) {
return ImageStatistics.min((InterleavedU8) input);
} else if (InterleavedS8.class == input.getClass()) {
return ImageStatistics.min((InterleavedS8) input);
} else if (InterleavedU16.class == input.getClass()) {
return ImageStatistics.min((InterleavedU16) input);
} else if (InterleavedS16.class == input.getClass()) {
return ImageStatistics.min((InterleavedS16) input);
} else if (InterleavedS32.class == input.getClass()) {
return ImageStatistics.min((InterleavedS32) input);
} else if (InterleavedS64.class == input.getClass()) {
return ImageStatistics.min((InterleavedS64) input);
} else if (InterleavedF32.class == input.getClass()) {
return ImageStatistics.min((InterleavedF32) input);
} else if (InterleavedF64.class == input.getClass()) {
return ImageStatistics.min((InterleavedF64) input);
} else {
throw new IllegalArgumentException("Unknown Image Type: " + input.getClass().getSimpleName());
}
} else if( input instanceof Planar ){
Planar pl = (Planar)input;
int N = pl.getNumBands();
if( N == 0 )
throw new IllegalArgumentException("Must have at least one band");
double result = min(pl.bands[0]);
for (int i = 1; i < N; i++) {
result = Math.min(result,min(pl.bands[i]));
}
return result;
} else {
throw new IllegalArgumentException("Image type not yet supported "+input.getClass().getSimpleName());
}
} } | public class class_name {
public static double min( ImageBase input ) {
if( input instanceof ImageGray) {
if (GrayU8.class == input.getClass()) {
return ImageStatistics.min((GrayU8) input); // depends on control dependency: [if], data = [none]
} else if (GrayS8.class == input.getClass()) {
return ImageStatistics.min((GrayS8) input); // depends on control dependency: [if], data = [none]
} else if (GrayU16.class == input.getClass()) {
return ImageStatistics.min((GrayU16) input); // depends on control dependency: [if], data = [none]
} else if (GrayS16.class == input.getClass()) {
return ImageStatistics.min((GrayS16) input); // depends on control dependency: [if], data = [none]
} else if (GrayS32.class == input.getClass()) {
return ImageStatistics.min((GrayS32) input); // depends on control dependency: [if], data = [none]
} else if (GrayS64.class == input.getClass()) {
return ImageStatistics.min((GrayS64) input); // depends on control dependency: [if], data = [none]
} else if (GrayF32.class == input.getClass()) {
return ImageStatistics.min((GrayF32) input); // depends on control dependency: [if], data = [none]
} else if (GrayF64.class == input.getClass()) {
return ImageStatistics.min((GrayF64) input); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown Image Type: " + input.getClass().getSimpleName());
}
} else if( input instanceof ImageInterleaved ) {
if (InterleavedU8.class == input.getClass()) {
return ImageStatistics.min((InterleavedU8) input); // depends on control dependency: [if], data = [none]
} else if (InterleavedS8.class == input.getClass()) {
return ImageStatistics.min((InterleavedS8) input); // depends on control dependency: [if], data = [none]
} else if (InterleavedU16.class == input.getClass()) {
return ImageStatistics.min((InterleavedU16) input); // depends on control dependency: [if], data = [none]
} else if (InterleavedS16.class == input.getClass()) {
return ImageStatistics.min((InterleavedS16) input); // depends on control dependency: [if], data = [none]
} else if (InterleavedS32.class == input.getClass()) {
return ImageStatistics.min((InterleavedS32) input); // depends on control dependency: [if], data = [none]
} else if (InterleavedS64.class == input.getClass()) {
return ImageStatistics.min((InterleavedS64) input); // depends on control dependency: [if], data = [none]
} else if (InterleavedF32.class == input.getClass()) {
return ImageStatistics.min((InterleavedF32) input); // depends on control dependency: [if], data = [none]
} else if (InterleavedF64.class == input.getClass()) {
return ImageStatistics.min((InterleavedF64) input); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown Image Type: " + input.getClass().getSimpleName());
}
} else if( input instanceof Planar ){
Planar pl = (Planar)input;
int N = pl.getNumBands();
if( N == 0 )
throw new IllegalArgumentException("Must have at least one band");
double result = min(pl.bands[0]);
for (int i = 1; i < N; i++) {
result = Math.min(result,min(pl.bands[i])); // depends on control dependency: [for], data = [i]
}
return result; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Image type not yet supported "+input.getClass().getSimpleName());
}
} } |
public class class_name {
public void marshall(DescribeChannelRequest describeChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (describeChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeChannelRequest.getId(), ID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeChannelRequest describeChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (describeChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeChannelRequest.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Object getFieldValue(Object instance, String fieldName) {
try {
return PropertyUtils.getProperty(instance, fieldName);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
JK.throww(e);
return null;
}
} } | public class class_name {
public static Object getFieldValue(Object instance, String fieldName) {
try {
return PropertyUtils.getProperty(instance, fieldName);
// depends on control dependency: [try], data = [none]
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
JK.throww(e);
return null;
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void _createNotification(final Context context, final Bundle extras, final int notificationId) {
//noinspection ConstantConditions
if (extras == null || extras.get(Constants.NOTIFICATION_TAG) == null) {
return;
}
if (config.isAnalyticsOnly()) {
getConfigLogger().debug(getAccountId(), "Instance is set for Analytics only, cannot create notification");
return;
}
try {
postAsyncSafely("CleverTapAPI#_createNotification", new Runnable() {
@Override
public void run() {
try {
getConfigLogger().debug(getAccountId(), "Handling notification: " + extras.toString());
dbAdapter = loadDBAdapter(context);
if(extras.getString("wzrk_pid") != null) {
if (dbAdapter.doesPushNotificationIdExist(extras.getString("wzrk_pid"))){
getConfigLogger().debug(getAccountId(),"Push Notification Already rendered, not showing again");
return;
}
}
// Check if this is a test notification
if (extras.containsKey(Constants.DEBUG_KEY)
&& "y".equals(extras.getString(Constants.DEBUG_KEY))) {
int r = (int) (Math.random() * 10);
if (r != 8) {
// Discard acknowledging this notif
return;
}
JSONObject event = new JSONObject();
try {
JSONObject actions = new JSONObject();
for (String x : extras.keySet()) {
Object value = extras.get(x);
actions.put(x, value);
}
event.put("evtName", "wzrk_d");
event.put("evtData", actions);
queueEvent(context, event, Constants.RAISED_EVENT);
} catch (JSONException ignored) {
// Won't happen
}
// Drop further processing
return;
}
String notifMessage = extras.getString("nm");
notifMessage = (notifMessage != null) ? notifMessage : "";
if (notifMessage.isEmpty()) {
getConfigLogger().verbose(getAccountId(),"Push notification message is empty, not rendering");
loadDBAdapter(context).storeUninstallTimestamp();
return;
}
String notifTitle = extras.getString("nt", "");
notifTitle = notifTitle.isEmpty() ? context.getApplicationInfo().name : notifTitle;
triggerNotification(context, extras, notifMessage, notifTitle, notificationId);
} catch (Throwable t) {
// Occurs if the notification image was null
// Let's return, as we couldn't get a handle on the app's icon
// Some devices throw a PackageManager* exception too
getConfigLogger().debug(getAccountId(),"Couldn't render notification: ", t);
}
}
});
} catch (Throwable t) {
getConfigLogger().debug(getAccountId(), "Failed to process push notification", t);
}
} } | public class class_name {
private void _createNotification(final Context context, final Bundle extras, final int notificationId) {
//noinspection ConstantConditions
if (extras == null || extras.get(Constants.NOTIFICATION_TAG) == null) {
return; // depends on control dependency: [if], data = [none]
}
if (config.isAnalyticsOnly()) {
getConfigLogger().debug(getAccountId(), "Instance is set for Analytics only, cannot create notification"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try {
postAsyncSafely("CleverTapAPI#_createNotification", new Runnable() {
@Override
public void run() {
try {
getConfigLogger().debug(getAccountId(), "Handling notification: " + extras.toString()); // depends on control dependency: [try], data = [none]
dbAdapter = loadDBAdapter(context); // depends on control dependency: [try], data = [none]
if(extras.getString("wzrk_pid") != null) {
if (dbAdapter.doesPushNotificationIdExist(extras.getString("wzrk_pid"))){
getConfigLogger().debug(getAccountId(),"Push Notification Already rendered, not showing again"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
// Check if this is a test notification
if (extras.containsKey(Constants.DEBUG_KEY)
&& "y".equals(extras.getString(Constants.DEBUG_KEY))) {
int r = (int) (Math.random() * 10);
if (r != 8) {
// Discard acknowledging this notif
return; // depends on control dependency: [if], data = [none]
}
JSONObject event = new JSONObject();
try {
JSONObject actions = new JSONObject();
for (String x : extras.keySet()) {
Object value = extras.get(x);
actions.put(x, value); // depends on control dependency: [for], data = [x]
}
event.put("evtName", "wzrk_d"); // depends on control dependency: [try], data = [none]
event.put("evtData", actions); // depends on control dependency: [try], data = [none]
queueEvent(context, event, Constants.RAISED_EVENT); // depends on control dependency: [try], data = [none]
} catch (JSONException ignored) {
// Won't happen
} // depends on control dependency: [catch], data = [none]
// Drop further processing
return; // depends on control dependency: [if], data = [none]
}
String notifMessage = extras.getString("nm");
notifMessage = (notifMessage != null) ? notifMessage : ""; // depends on control dependency: [try], data = [none]
if (notifMessage.isEmpty()) {
getConfigLogger().verbose(getAccountId(),"Push notification message is empty, not rendering"); // depends on control dependency: [if], data = [none]
loadDBAdapter(context).storeUninstallTimestamp(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
String notifTitle = extras.getString("nt", "");
notifTitle = notifTitle.isEmpty() ? context.getApplicationInfo().name : notifTitle; // depends on control dependency: [try], data = [none]
triggerNotification(context, extras, notifMessage, notifTitle, notificationId); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// Occurs if the notification image was null
// Let's return, as we couldn't get a handle on the app's icon
// Some devices throw a PackageManager* exception too
getConfigLogger().debug(getAccountId(),"Couldn't render notification: ", t);
} // depends on control dependency: [catch], data = [none]
}
}); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
getConfigLogger().debug(getAccountId(), "Failed to process push notification", t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String toHTML() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, "toHTML");
}
StringBuffer strbuf = new StringBuffer();
String appName = _sap.getJ2EEName();
String globalScopeComment;
MemoryStore ms = (MemoryStore) _coreHttpSessionManager.getIStore();
int size = 0;
if (ms._sessions != null) {
size = ms._sessions.size();
}
globalScopeComment = "<b> (for this webapp) : </b> ";
strbuf.append("<center><h3>J2EE NAME(AppName#WebModuleName):: " + appName + " </h3></center>" + "<UL>\n");
strbuf.append("<b> cloneId</b> : ");
strbuf.append(((SessionAffinityManager) _sam).getCloneId());
strbuf.append("<BR>");
strbuf.append("<BR>");
strbuf.append("<b> Number of sessions in memory: </b>");
strbuf.append(globalScopeComment);
strbuf.append(size);
strbuf.append("<BR>");
if (_smc.isUsingMemory()) {
strbuf.append("<b> use overflow</b> : ");
strbuf.append(_smc.getEnableOverflow());
strbuf.append("<BR>");
if (_smc.getEnableOverflow()) {
strbuf.append("<b> overflow size</b> ");
strbuf.append(globalScopeComment);
strbuf.append(((SessionSimpleHashMap) ms._sessions).getOverflowSize());
strbuf.append("<BR>");
}
}
strbuf.append("<b> Invalidation alarm poll interval (for this webapp) </b> : ");
strbuf.append(_smc.getInvalidationCheckInterval());
strbuf.append("<BR>");
strbuf.append("<b> Max invalidation timeout (for this webapp) </b> : ");
strbuf.append(_smc.getSessionInvalidationTime());
strbuf.append("<BR>");
strbuf.append("<b> Using Cookies </b> : ");
strbuf.append(_smc.getEnableCookies());
strbuf.append("<BR>");
strbuf.append("<b> Using URL Rewriting </b> : ");
strbuf.append(_smc.getEnableUrlRewriting());
strbuf.append("<BR>");
strbuf.append("<b> use SSLId </b> : ");
strbuf.append(_smc.useSSLId());
strbuf.append("<BR>");
strbuf.append("<b> URL Protocol Switch Rewriting </b> : ");
strbuf.append(_smc.getEnableUrlProtocolSwitchRewriting());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Name </b> : ");
strbuf.append(_smc.getSessionCookieName());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Comment </b> : ");
strbuf.append(_smc.getSessionCookieComment());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Domain </b> : ");
strbuf.append(_smc.getSessionCookieDomain());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Path </b> : ");
strbuf.append(_smc.getSessionCookiePath());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie MaxAge </b> : ");
strbuf.append(_smc.getSessionCookieMaxAge());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Secure </b> : ");
strbuf.append(_smc.getSessionCookieSecure());
strbuf.append("<BR>");
strbuf.append("<b> Maximum in memory table size </b> : ");
strbuf.append(_smc.getInMemorySize());
strbuf.append("<BR>");
strbuf.append("<b> current time </b> : ");
strbuf.append(new Date(System.currentTimeMillis()).toString());
strbuf.append("<BR>");
strbuf.append("<b> integrateWASSec</b> :");
strbuf.append(_smc.getIntegrateSecurity());
strbuf.append("<BR><b>Session locking </b>: ");
strbuf.append(_smc.getAllowSerializedSessionAccess());
if (_smc.getAllowSerializedSessionAccess()) {
strbuf.append("<BR><b>Session locking timeout</b>: ");
strbuf.append(_smc.getSerializedSessionAccessMaxWaitTime());
strbuf.append("<BR><b>Allow access on lock timeout</b>:");
strbuf.append(_smc.getAccessSessionOnTimeout());
}
if (ms.getSessionStatistics() != null) {
strbuf.append(ms.getSessionStatistics().toHTML());
}
strbuf.append(ms.toHTML());
// .append(this.scPmiData.toHTML())
// .append(this.mbeanAdapter.toHTML()); //done in WsSessionContext
return (strbuf.toString());
} } | public class class_name {
public String toHTML() {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, "toHTML"); // depends on control dependency: [if], data = [none]
}
StringBuffer strbuf = new StringBuffer();
String appName = _sap.getJ2EEName();
String globalScopeComment;
MemoryStore ms = (MemoryStore) _coreHttpSessionManager.getIStore();
int size = 0;
if (ms._sessions != null) {
size = ms._sessions.size(); // depends on control dependency: [if], data = [none]
}
globalScopeComment = "<b> (for this webapp) : </b> ";
strbuf.append("<center><h3>J2EE NAME(AppName#WebModuleName):: " + appName + " </h3></center>" + "<UL>\n");
strbuf.append("<b> cloneId</b> : ");
strbuf.append(((SessionAffinityManager) _sam).getCloneId());
strbuf.append("<BR>");
strbuf.append("<BR>");
strbuf.append("<b> Number of sessions in memory: </b>");
strbuf.append(globalScopeComment);
strbuf.append(size);
strbuf.append("<BR>");
if (_smc.isUsingMemory()) {
strbuf.append("<b> use overflow</b> : "); // depends on control dependency: [if], data = [none]
strbuf.append(_smc.getEnableOverflow()); // depends on control dependency: [if], data = [none]
strbuf.append("<BR>"); // depends on control dependency: [if], data = [none]
if (_smc.getEnableOverflow()) {
strbuf.append("<b> overflow size</b> "); // depends on control dependency: [if], data = [none]
strbuf.append(globalScopeComment); // depends on control dependency: [if], data = [none]
strbuf.append(((SessionSimpleHashMap) ms._sessions).getOverflowSize()); // depends on control dependency: [if], data = [none]
strbuf.append("<BR>"); // depends on control dependency: [if], data = [none]
}
}
strbuf.append("<b> Invalidation alarm poll interval (for this webapp) </b> : ");
strbuf.append(_smc.getInvalidationCheckInterval());
strbuf.append("<BR>");
strbuf.append("<b> Max invalidation timeout (for this webapp) </b> : ");
strbuf.append(_smc.getSessionInvalidationTime());
strbuf.append("<BR>");
strbuf.append("<b> Using Cookies </b> : ");
strbuf.append(_smc.getEnableCookies());
strbuf.append("<BR>");
strbuf.append("<b> Using URL Rewriting </b> : ");
strbuf.append(_smc.getEnableUrlRewriting());
strbuf.append("<BR>");
strbuf.append("<b> use SSLId </b> : ");
strbuf.append(_smc.useSSLId());
strbuf.append("<BR>");
strbuf.append("<b> URL Protocol Switch Rewriting </b> : ");
strbuf.append(_smc.getEnableUrlProtocolSwitchRewriting());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Name </b> : ");
strbuf.append(_smc.getSessionCookieName());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Comment </b> : ");
strbuf.append(_smc.getSessionCookieComment());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Domain </b> : ");
strbuf.append(_smc.getSessionCookieDomain());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Path </b> : ");
strbuf.append(_smc.getSessionCookiePath());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie MaxAge </b> : ");
strbuf.append(_smc.getSessionCookieMaxAge());
strbuf.append("<BR>");
strbuf.append("<b> Session Cookie Secure </b> : ");
strbuf.append(_smc.getSessionCookieSecure());
strbuf.append("<BR>");
strbuf.append("<b> Maximum in memory table size </b> : ");
strbuf.append(_smc.getInMemorySize());
strbuf.append("<BR>");
strbuf.append("<b> current time </b> : ");
strbuf.append(new Date(System.currentTimeMillis()).toString());
strbuf.append("<BR>");
strbuf.append("<b> integrateWASSec</b> :");
strbuf.append(_smc.getIntegrateSecurity());
strbuf.append("<BR><b>Session locking </b>: ");
strbuf.append(_smc.getAllowSerializedSessionAccess());
if (_smc.getAllowSerializedSessionAccess()) {
strbuf.append("<BR><b>Session locking timeout</b>: "); // depends on control dependency: [if], data = [none]
strbuf.append(_smc.getSerializedSessionAccessMaxWaitTime()); // depends on control dependency: [if], data = [none]
strbuf.append("<BR><b>Allow access on lock timeout</b>:"); // depends on control dependency: [if], data = [none]
strbuf.append(_smc.getAccessSessionOnTimeout()); // depends on control dependency: [if], data = [none]
}
if (ms.getSessionStatistics() != null) {
strbuf.append(ms.getSessionStatistics().toHTML()); // depends on control dependency: [if], data = [(ms.getSessionStatistics()]
}
strbuf.append(ms.toHTML());
// .append(this.scPmiData.toHTML())
// .append(this.mbeanAdapter.toHTML()); //done in WsSessionContext
return (strbuf.toString());
} } |
public class class_name {
public void deleteResource(
CmsRequestContext context,
CmsResource resource,
CmsResource.CmsResourceDeleteMode siblingMode)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(context);
final CmsUUID forbiddenFolderId = OpenCms.getPublishManager().getPublishListVerifier().addForbiddenParentFolder(
resource.getRootPath(),
Messages.get().getBundle(locale).key(Messages.ERR_FORBIDDEN_PARENT_CURRENTLY_DELETING_0));
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL);
checkSystemLocks(dbc, resource);
// check write permissions for subresources in case of deleting a folder
if (resource.isFolder()) {
dbc.getRequestContext().setAttribute(I_CmsVfsDriver.REQ_ATTR_CHECK_PERMISSIONS, Boolean.TRUE);
try {
m_driverManager.getVfsDriver(dbc).removeFolder(dbc, dbc.currentProject(), resource);
} catch (CmsDataAccessException e) {
// unwrap the permission violation exception
if (e.getCause() instanceof CmsPermissionViolationException) {
throw (CmsPermissionViolationException)e.getCause();
} else {
throw e;
}
}
dbc.getRequestContext().removeAttribute(I_CmsVfsDriver.REQ_ATTR_CHECK_PERMISSIONS);
}
deleteResource(dbc, resource, siblingMode);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_DELETE_RESOURCE_1, context.getSitePath(resource)),
e);
} finally {
OpenCms.getPublishManager().getPublishListVerifier().removeForbiddenParentFolder(forbiddenFolderId);
dbc.clear();
}
} } | public class class_name {
public void deleteResource(
CmsRequestContext context,
CmsResource resource,
CmsResource.CmsResourceDeleteMode siblingMode)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(context);
final CmsUUID forbiddenFolderId = OpenCms.getPublishManager().getPublishListVerifier().addForbiddenParentFolder(
resource.getRootPath(),
Messages.get().getBundle(locale).key(Messages.ERR_FORBIDDEN_PARENT_CURRENTLY_DELETING_0));
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL);
checkSystemLocks(dbc, resource);
// check write permissions for subresources in case of deleting a folder
if (resource.isFolder()) {
dbc.getRequestContext().setAttribute(I_CmsVfsDriver.REQ_ATTR_CHECK_PERMISSIONS, Boolean.TRUE); // depends on control dependency: [if], data = [none]
try {
m_driverManager.getVfsDriver(dbc).removeFolder(dbc, dbc.currentProject(), resource); // depends on control dependency: [try], data = [none]
} catch (CmsDataAccessException e) {
// unwrap the permission violation exception
if (e.getCause() instanceof CmsPermissionViolationException) {
throw (CmsPermissionViolationException)e.getCause();
} else {
throw e;
}
} // depends on control dependency: [catch], data = [none]
dbc.getRequestContext().removeAttribute(I_CmsVfsDriver.REQ_ATTR_CHECK_PERMISSIONS); // depends on control dependency: [if], data = [none]
}
deleteResource(dbc, resource, siblingMode);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_DELETE_RESOURCE_1, context.getSitePath(resource)),
e);
} finally {
OpenCms.getPublishManager().getPublishListVerifier().removeForbiddenParentFolder(forbiddenFolderId);
dbc.clear();
}
} } |
public class class_name {
public TaskGetOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} } | public class class_name {
public TaskGetOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null; // depends on control dependency: [if], data = [none]
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return this;
} } |
public class class_name {
public DTM getGlobalRTFDTM()
{
// We probably should _NOT_ be applying whitespace filtering at this stage!
//
// Some magic has been applied in DTMManagerDefault to recognize this set of options
// and generate an instance of DTM which can contain multiple documents
// (SAX2RTFDTM). Perhaps not the optimal way of achieving that result, but
// I didn't want to change the manager API at this time, or expose
// too many dependencies on its internals. (Ideally, I'd like to move
// isTreeIncomplete all the way up to DTM, so we wouldn't need to explicitly
// specify the subclass here.)
// If it doesn't exist, or if the one already existing is in the middle of
// being constructed, we need to obtain a new DTM to write into. I'm not sure
// the latter will ever arise, but I'd rather be just a bit paranoid..
if( m_global_rtfdtm==null || m_global_rtfdtm.isTreeIncomplete() )
{
m_global_rtfdtm=(SAX2RTFDTM)m_dtmManager.getDTM(null,true,null,false,false);
}
return m_global_rtfdtm;
} } | public class class_name {
public DTM getGlobalRTFDTM()
{
// We probably should _NOT_ be applying whitespace filtering at this stage!
//
// Some magic has been applied in DTMManagerDefault to recognize this set of options
// and generate an instance of DTM which can contain multiple documents
// (SAX2RTFDTM). Perhaps not the optimal way of achieving that result, but
// I didn't want to change the manager API at this time, or expose
// too many dependencies on its internals. (Ideally, I'd like to move
// isTreeIncomplete all the way up to DTM, so we wouldn't need to explicitly
// specify the subclass here.)
// If it doesn't exist, or if the one already existing is in the middle of
// being constructed, we need to obtain a new DTM to write into. I'm not sure
// the latter will ever arise, but I'd rather be just a bit paranoid..
if( m_global_rtfdtm==null || m_global_rtfdtm.isTreeIncomplete() )
{
m_global_rtfdtm=(SAX2RTFDTM)m_dtmManager.getDTM(null,true,null,false,false); // depends on control dependency: [if], data = [none]
}
return m_global_rtfdtm;
} } |
public class class_name {
@Override
public Path toAbsolutePath() {
// Already absolute?
if (this.isAbsolute()) {
return this;
}
// Else construct a new absolute path and normalize it
final Path absolutePath = new ShrinkWrapPath(ArchivePath.SEPARATOR + this.path, this.fileSystem);
final Path normalized = absolutePath.normalize();
return normalized;
} } | public class class_name {
@Override
public Path toAbsolutePath() {
// Already absolute?
if (this.isAbsolute()) {
return this; // depends on control dependency: [if], data = [none]
}
// Else construct a new absolute path and normalize it
final Path absolutePath = new ShrinkWrapPath(ArchivePath.SEPARATOR + this.path, this.fileSystem);
final Path normalized = absolutePath.normalize();
return normalized;
} } |
public class class_name {
public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred) throws RepositoryException {
try {
if (isQuadMode()) {
TupleQuery tupleQuery = prepareTupleQuery(GET_STATEMENTS);
setBindings(tupleQuery, subj, pred, obj);
tupleQuery.setIncludeInferred(includeInferred);
TupleQueryResult qRes = tupleQuery.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(
toStatementIteration(qRes, subj, pred, obj)) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} else if (subj != null && pred != null && obj != null) {
if (hasStatement(subj, pred, obj, includeInferred)) {
Statement st = new StatementImpl(subj, pred, obj);
CloseableIteration<Statement, RepositoryException> cursor;
cursor = new SingletonIteration<Statement, RepositoryException>(st);
return new RepositoryResult<Statement>(cursor);
} else {
return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>());
}
}
GraphQuery query = prepareGraphQuery(EVERYTHING);
setBindings(query, subj, pred, obj);
GraphQueryResult result = query.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(result) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} catch (MalformedQueryException e) {
throw new RepositoryException(e);
} catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
} } | public class class_name {
public RepositoryResult<Statement> getStatements(Resource subj, URI pred, Value obj, boolean includeInferred) throws RepositoryException {
try {
if (isQuadMode()) {
TupleQuery tupleQuery = prepareTupleQuery(GET_STATEMENTS);
setBindings(tupleQuery, subj, pred, obj);
tupleQuery.setIncludeInferred(includeInferred);
TupleQueryResult qRes = tupleQuery.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(
toStatementIteration(qRes, subj, pred, obj)) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} else if (subj != null && pred != null && obj != null) {
if (hasStatement(subj, pred, obj, includeInferred)) {
Statement st = new StatementImpl(subj, pred, obj);
CloseableIteration<Statement, RepositoryException> cursor;
cursor = new SingletonIteration<Statement, RepositoryException>(st); // depends on control dependency: [if], data = [none]
return new RepositoryResult<Statement>(cursor); // depends on control dependency: [if], data = [none]
} else {
return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>()); // depends on control dependency: [if], data = [none]
}
}
GraphQuery query = prepareGraphQuery(EVERYTHING);
setBindings(query, subj, pred, obj);
GraphQueryResult result = query.evaluate();
return new RepositoryResult<Statement>(
new ExceptionConvertingIteration<Statement, RepositoryException>(result) {
@Override
protected RepositoryException convert(Exception e) {
return new RepositoryException(e);
}
});
} catch (MalformedQueryException e) {
throw new RepositoryException(e);
} catch (QueryEvaluationException e) {
throw new RepositoryException(e);
}
} } |
public class class_name {
public static String objectJsonBody(Object body) {
if (body instanceof String)
return (String) body;
String txt = "";
try {
txt = mapper.writeValueAsString(body);
} catch (JsonProcessingException e) {
log.error("objectJsonBody", e);
}
return txt;
} } | public class class_name {
public static String objectJsonBody(Object body) {
if (body instanceof String)
return (String) body;
String txt = "";
try {
txt = mapper.writeValueAsString(body); // depends on control dependency: [try], data = [none]
} catch (JsonProcessingException e) {
log.error("objectJsonBody", e);
} // depends on control dependency: [catch], data = [none]
return txt;
} } |
public class class_name {
private void setPowerSaveSettings() {
long minRest = Long.MAX_VALUE, minScan = Long.MAX_VALUE;
synchronized (wrappers) {
for (final ScanCallbackWrapper wrapper : wrappers.values()) {
final ScanSettings settings = wrapper.scanSettings;
if (settings.hasPowerSaveMode()) {
if (minRest > settings.getPowerSaveRest()) {
minRest = settings.getPowerSaveRest();
}
if (minScan > settings.getPowerSaveScan()) {
minScan = settings.getPowerSaveScan();
}
}
}
}
if (minRest < Long.MAX_VALUE && minScan < Long.MAX_VALUE) {
powerSaveRestInterval = minRest;
powerSaveScanInterval = minScan;
if (powerSaveHandler != null) {
powerSaveHandler.removeCallbacks(powerSaveScanTask);
powerSaveHandler.removeCallbacks(powerSaveSleepTask);
powerSaveHandler.postDelayed(powerSaveSleepTask, powerSaveScanInterval);
}
} else {
powerSaveRestInterval = powerSaveScanInterval = 0;
if (powerSaveHandler != null) {
powerSaveHandler.removeCallbacks(powerSaveScanTask);
powerSaveHandler.removeCallbacks(powerSaveSleepTask);
}
}
} } | public class class_name {
private void setPowerSaveSettings() {
long minRest = Long.MAX_VALUE, minScan = Long.MAX_VALUE;
synchronized (wrappers) {
for (final ScanCallbackWrapper wrapper : wrappers.values()) {
final ScanSettings settings = wrapper.scanSettings;
if (settings.hasPowerSaveMode()) {
if (minRest > settings.getPowerSaveRest()) {
minRest = settings.getPowerSaveRest(); // depends on control dependency: [if], data = [none]
}
if (minScan > settings.getPowerSaveScan()) {
minScan = settings.getPowerSaveScan(); // depends on control dependency: [if], data = [none]
}
}
}
}
if (minRest < Long.MAX_VALUE && minScan < Long.MAX_VALUE) {
powerSaveRestInterval = minRest; // depends on control dependency: [if], data = [none]
powerSaveScanInterval = minScan; // depends on control dependency: [if], data = [none]
if (powerSaveHandler != null) {
powerSaveHandler.removeCallbacks(powerSaveScanTask); // depends on control dependency: [if], data = [none]
powerSaveHandler.removeCallbacks(powerSaveSleepTask); // depends on control dependency: [if], data = [none]
powerSaveHandler.postDelayed(powerSaveSleepTask, powerSaveScanInterval); // depends on control dependency: [if], data = [none]
}
} else {
powerSaveRestInterval = powerSaveScanInterval = 0; // depends on control dependency: [if], data = [none]
if (powerSaveHandler != null) {
powerSaveHandler.removeCallbacks(powerSaveScanTask); // depends on control dependency: [if], data = [none]
powerSaveHandler.removeCallbacks(powerSaveSleepTask); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private static LogAdapterFactory getAdapterFactory()
{
// double-checked locking
if (_adapterFactory == null)
{
synchronized (Logger.class)
{
if (_adapterFactory == null)
{
_adapterFactory = createAdapterFactory();
}
}
}
return _adapterFactory;
} } | public class class_name {
private static LogAdapterFactory getAdapterFactory()
{
// double-checked locking
if (_adapterFactory == null)
{
synchronized (Logger.class) // depends on control dependency: [if], data = [none]
{
if (_adapterFactory == null)
{
_adapterFactory = createAdapterFactory(); // depends on control dependency: [if], data = [none]
}
}
}
return _adapterFactory;
} } |
public class class_name {
protected void initJobExecutor() {
if (jobExecutor == null) {
jobExecutor = new DefaultJobExecutor();
}
jobHandlers = new HashMap<String, JobHandler>();
TimerExecuteNestedActivityJobHandler timerExecuteNestedActivityJobHandler = new TimerExecuteNestedActivityJobHandler();
jobHandlers.put(timerExecuteNestedActivityJobHandler.getType(), timerExecuteNestedActivityJobHandler);
TimerCatchIntermediateEventJobHandler timerCatchIntermediateEvent = new TimerCatchIntermediateEventJobHandler();
jobHandlers.put(timerCatchIntermediateEvent.getType(), timerCatchIntermediateEvent);
TimerStartEventJobHandler timerStartEvent = new TimerStartEventJobHandler();
jobHandlers.put(timerStartEvent.getType(), timerStartEvent);
TimerStartEventSubprocessJobHandler timerStartEventSubprocess = new TimerStartEventSubprocessJobHandler();
jobHandlers.put(timerStartEventSubprocess.getType(), timerStartEventSubprocess);
AsyncContinuationJobHandler asyncContinuationJobHandler = new AsyncContinuationJobHandler();
jobHandlers.put(asyncContinuationJobHandler.getType(), asyncContinuationJobHandler);
ProcessEventJobHandler processEventJobHandler = new ProcessEventJobHandler();
jobHandlers.put(processEventJobHandler.getType(), processEventJobHandler);
TimerSuspendProcessDefinitionHandler suspendProcessDefinitionHandler = new TimerSuspendProcessDefinitionHandler();
jobHandlers.put(suspendProcessDefinitionHandler.getType(), suspendProcessDefinitionHandler);
TimerActivateProcessDefinitionHandler activateProcessDefinitionHandler = new TimerActivateProcessDefinitionHandler();
jobHandlers.put(activateProcessDefinitionHandler.getType(), activateProcessDefinitionHandler);
TimerSuspendJobDefinitionHandler suspendJobDefinitionHandler = new TimerSuspendJobDefinitionHandler();
jobHandlers.put(suspendJobDefinitionHandler.getType(), suspendJobDefinitionHandler);
TimerActivateJobDefinitionHandler activateJobDefinitionHandler = new TimerActivateJobDefinitionHandler();
jobHandlers.put(activateJobDefinitionHandler.getType(), activateJobDefinitionHandler);
BatchSeedJobHandler batchSeedJobHandler = new BatchSeedJobHandler();
jobHandlers.put(batchSeedJobHandler.getType(), batchSeedJobHandler);
BatchMonitorJobHandler batchMonitorJobHandler = new BatchMonitorJobHandler();
jobHandlers.put(batchMonitorJobHandler.getType(), batchMonitorJobHandler);
HistoryCleanupJobHandler historyCleanupJobHandler = new HistoryCleanupJobHandler();
jobHandlers.put(historyCleanupJobHandler.getType(), historyCleanupJobHandler);
for (JobHandler batchHandler : batchHandlers.values()) {
jobHandlers.put(batchHandler.getType(), batchHandler);
}
// if we have custom job handlers, register them
if (getCustomJobHandlers() != null) {
for (JobHandler customJobHandler : getCustomJobHandlers()) {
jobHandlers.put(customJobHandler.getType(), customJobHandler);
}
}
jobExecutor.setAutoActivate(jobExecutorActivate);
if (jobExecutor.getRejectedJobsHandler() == null) {
if (customRejectedJobsHandler != null) {
jobExecutor.setRejectedJobsHandler(customRejectedJobsHandler);
} else {
jobExecutor.setRejectedJobsHandler(new NotifyAcquisitionRejectedJobsHandler());
}
}
} } | public class class_name {
protected void initJobExecutor() {
if (jobExecutor == null) {
jobExecutor = new DefaultJobExecutor(); // depends on control dependency: [if], data = [none]
}
jobHandlers = new HashMap<String, JobHandler>();
TimerExecuteNestedActivityJobHandler timerExecuteNestedActivityJobHandler = new TimerExecuteNestedActivityJobHandler();
jobHandlers.put(timerExecuteNestedActivityJobHandler.getType(), timerExecuteNestedActivityJobHandler);
TimerCatchIntermediateEventJobHandler timerCatchIntermediateEvent = new TimerCatchIntermediateEventJobHandler();
jobHandlers.put(timerCatchIntermediateEvent.getType(), timerCatchIntermediateEvent);
TimerStartEventJobHandler timerStartEvent = new TimerStartEventJobHandler();
jobHandlers.put(timerStartEvent.getType(), timerStartEvent);
TimerStartEventSubprocessJobHandler timerStartEventSubprocess = new TimerStartEventSubprocessJobHandler();
jobHandlers.put(timerStartEventSubprocess.getType(), timerStartEventSubprocess);
AsyncContinuationJobHandler asyncContinuationJobHandler = new AsyncContinuationJobHandler();
jobHandlers.put(asyncContinuationJobHandler.getType(), asyncContinuationJobHandler);
ProcessEventJobHandler processEventJobHandler = new ProcessEventJobHandler();
jobHandlers.put(processEventJobHandler.getType(), processEventJobHandler);
TimerSuspendProcessDefinitionHandler suspendProcessDefinitionHandler = new TimerSuspendProcessDefinitionHandler();
jobHandlers.put(suspendProcessDefinitionHandler.getType(), suspendProcessDefinitionHandler);
TimerActivateProcessDefinitionHandler activateProcessDefinitionHandler = new TimerActivateProcessDefinitionHandler();
jobHandlers.put(activateProcessDefinitionHandler.getType(), activateProcessDefinitionHandler);
TimerSuspendJobDefinitionHandler suspendJobDefinitionHandler = new TimerSuspendJobDefinitionHandler();
jobHandlers.put(suspendJobDefinitionHandler.getType(), suspendJobDefinitionHandler);
TimerActivateJobDefinitionHandler activateJobDefinitionHandler = new TimerActivateJobDefinitionHandler();
jobHandlers.put(activateJobDefinitionHandler.getType(), activateJobDefinitionHandler);
BatchSeedJobHandler batchSeedJobHandler = new BatchSeedJobHandler();
jobHandlers.put(batchSeedJobHandler.getType(), batchSeedJobHandler);
BatchMonitorJobHandler batchMonitorJobHandler = new BatchMonitorJobHandler();
jobHandlers.put(batchMonitorJobHandler.getType(), batchMonitorJobHandler);
HistoryCleanupJobHandler historyCleanupJobHandler = new HistoryCleanupJobHandler();
jobHandlers.put(historyCleanupJobHandler.getType(), historyCleanupJobHandler);
for (JobHandler batchHandler : batchHandlers.values()) {
jobHandlers.put(batchHandler.getType(), batchHandler); // depends on control dependency: [for], data = [batchHandler]
}
// if we have custom job handlers, register them
if (getCustomJobHandlers() != null) {
for (JobHandler customJobHandler : getCustomJobHandlers()) {
jobHandlers.put(customJobHandler.getType(), customJobHandler); // depends on control dependency: [for], data = [customJobHandler]
}
}
jobExecutor.setAutoActivate(jobExecutorActivate);
if (jobExecutor.getRejectedJobsHandler() == null) {
if (customRejectedJobsHandler != null) {
jobExecutor.setRejectedJobsHandler(customRejectedJobsHandler); // depends on control dependency: [if], data = [(customRejectedJobsHandler]
} else {
jobExecutor.setRejectedJobsHandler(new NotifyAcquisitionRejectedJobsHandler()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void onContainerStarted(final ContainerId containerId, final Map<String, ByteBuffer> stringByteBufferMap) {
final Optional<Container> container = this.containers.getOptional(containerId.toString());
if (container.isPresent()) {
this.nodeManager.getContainerStatusAsync(containerId, container.get().getNodeId());
}
} } | public class class_name {
@Override
public void onContainerStarted(final ContainerId containerId, final Map<String, ByteBuffer> stringByteBufferMap) {
final Optional<Container> container = this.containers.getOptional(containerId.toString());
if (container.isPresent()) {
this.nodeManager.getContainerStatusAsync(containerId, container.get().getNodeId()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void setEnabled(boolean enabled) {
if (supportedAndroidVersion) {
ACRA.log.i(LOG_TAG, "ACRA is " + (enabled ? "enabled" : "disabled") + " for " + context.getPackageName());
reportExecutor.setEnabled(enabled);
} else {
ACRA.log.w(LOG_TAG, "ACRA requires ICS or greater. ACRA is disabled and will NOT catch crashes or send messages.");
}
} } | public class class_name {
@Override
public void setEnabled(boolean enabled) {
if (supportedAndroidVersion) {
ACRA.log.i(LOG_TAG, "ACRA is " + (enabled ? "enabled" : "disabled") + " for " + context.getPackageName()); // depends on control dependency: [if], data = [none]
reportExecutor.setEnabled(enabled); // depends on control dependency: [if], data = [none]
} else {
ACRA.log.w(LOG_TAG, "ACRA requires ICS or greater. ACRA is disabled and will NOT catch crashes or send messages."); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void incrementCounts(Collection<E> keys, int count) {
for (E key : keys) {
incrementCount(key, count);
}
} } | public class class_name {
public void incrementCounts(Collection<E> keys, int count) {
for (E key : keys) {
incrementCount(key, count);
// depends on control dependency: [for], data = [key]
}
} } |
public class class_name {
public boolean contains(Shape other) {
if (other.intersects(this)) {
return false;
}
for (int i=0;i<other.getPointCount();i++) {
float[] pt = other.getPoint(i);
if (!contains(pt[0], pt[1])) {
return false;
}
}
return true;
} } | public class class_name {
public boolean contains(Shape other) {
if (other.intersects(this)) {
return false;
// depends on control dependency: [if], data = [none]
}
for (int i=0;i<other.getPointCount();i++) {
float[] pt = other.getPoint(i);
if (!contains(pt[0], pt[1])) {
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public void setSingleSignOn(HttpRequest request,
HttpResponse response,
Principal principal,
Credential credential)
{
String ssoID=null;
synchronized(_ssoId2Principal)
{
// Create new SSO ID
while (true)
{
ssoID = Long.toString(Math.abs(_random.nextLong()),
30 + (int)(System.currentTimeMillis() % 7));
if (!_ssoId2Principal.containsKey(ssoID))
break;
}
if(log.isDebugEnabled())log.debug("set ssoID="+ssoID);
_ssoId2Principal.put(ssoID,principal);
_ssoPrincipal2Credential.put(principal,credential);
_ssoUsername2Id.put(principal.getName(),ssoID);
}
Cookie cookie = new Cookie(SSO_COOKIE_NAME, ssoID);
cookie.setPath("/");
response.addSetCookie(cookie);
} } | public class class_name {
public void setSingleSignOn(HttpRequest request,
HttpResponse response,
Principal principal,
Credential credential)
{
String ssoID=null;
synchronized(_ssoId2Principal)
{
// Create new SSO ID
while (true)
{
ssoID = Long.toString(Math.abs(_random.nextLong()),
30 + (int)(System.currentTimeMillis() % 7)); // depends on control dependency: [while], data = [none]
if (!_ssoId2Principal.containsKey(ssoID))
break;
}
if(log.isDebugEnabled())log.debug("set ssoID="+ssoID);
_ssoId2Principal.put(ssoID,principal);
_ssoPrincipal2Credential.put(principal,credential);
_ssoUsername2Id.put(principal.getName(),ssoID);
}
Cookie cookie = new Cookie(SSO_COOKIE_NAME, ssoID);
cookie.setPath("/");
response.addSetCookie(cookie);
} } |
public class class_name {
public void marshall(GetShardIteratorRequest getShardIteratorRequest, ProtocolMarshaller protocolMarshaller) {
if (getShardIteratorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getShardIteratorRequest.getStreamArn(), STREAMARN_BINDING);
protocolMarshaller.marshall(getShardIteratorRequest.getShardId(), SHARDID_BINDING);
protocolMarshaller.marshall(getShardIteratorRequest.getShardIteratorType(), SHARDITERATORTYPE_BINDING);
protocolMarshaller.marshall(getShardIteratorRequest.getSequenceNumber(), SEQUENCENUMBER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetShardIteratorRequest getShardIteratorRequest, ProtocolMarshaller protocolMarshaller) {
if (getShardIteratorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getShardIteratorRequest.getStreamArn(), STREAMARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getShardIteratorRequest.getShardId(), SHARDID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getShardIteratorRequest.getShardIteratorType(), SHARDITERATORTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getShardIteratorRequest.getSequenceNumber(), SEQUENCENUMBER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public <T> void apply(final Query<T> query) {
pathProperties.each(props -> {
String path = props.getPath();
String propsStr = props.getPropertiesAsString();
if (path == null || path.isEmpty()) {
query.select(propsStr);
} else {
query.fetch(path, propsStr);
}
});
} } | public class class_name {
@Override
public <T> void apply(final Query<T> query) {
pathProperties.each(props -> {
String path = props.getPath();
String propsStr = props.getPropertiesAsString();
if (path == null || path.isEmpty()) {
query.select(propsStr); // depends on control dependency: [if], data = [none]
} else {
query.fetch(path, propsStr); // depends on control dependency: [if], data = [(path]
}
});
} } |
public class class_name {
private EdgeScores getLogOddsRatios(VarTensor[] inMsgs) {
EdgeScores es = new EdgeScores(n, Double.NEGATIVE_INFINITY);
Algebra s = inMsgs[0].getAlgebra();
// Compute the odds ratios of the messages for each edge in the tree.
for (VarTensor inMsg : inMsgs) {
LinkVar link = (LinkVar) inMsg.getVars().get(0);
double logOdds = s.toLogProb(inMsg.getValue(LinkVar.TRUE)) - s.toLogProb(inMsg.getValue(LinkVar.FALSE));
if (link.getParent() == -1) {
es.root[link.getChild()] = logOdds;
} else {
es.child[link.getParent()][link.getChild()] = logOdds;
}
}
return es;
} } | public class class_name {
private EdgeScores getLogOddsRatios(VarTensor[] inMsgs) {
EdgeScores es = new EdgeScores(n, Double.NEGATIVE_INFINITY);
Algebra s = inMsgs[0].getAlgebra();
// Compute the odds ratios of the messages for each edge in the tree.
for (VarTensor inMsg : inMsgs) {
LinkVar link = (LinkVar) inMsg.getVars().get(0);
double logOdds = s.toLogProb(inMsg.getValue(LinkVar.TRUE)) - s.toLogProb(inMsg.getValue(LinkVar.FALSE));
if (link.getParent() == -1) {
es.root[link.getChild()] = logOdds; // depends on control dependency: [if], data = [none]
} else {
es.child[link.getParent()][link.getChild()] = logOdds; // depends on control dependency: [if], data = [none]
}
}
return es;
} } |
public class class_name {
public String getTypeName() {
String type = null;
if (dataType != null) {
type = dataType.name();
}
return type;
} } | public class class_name {
public String getTypeName() {
String type = null;
if (dataType != null) {
type = dataType.name(); // depends on control dependency: [if], data = [none]
}
return type;
} } |
public class class_name {
public void addTimerMeasurement(String name, long timing) {
if (monitorActive) {
String escapedName = keyHandler.handle(name);
for (MonitorPlugin p : getPlugins()) {
p.addTimerMeasurement(escapedName, timing);
}
}
} } | public class class_name {
public void addTimerMeasurement(String name, long timing) {
if (monitorActive) {
String escapedName = keyHandler.handle(name);
for (MonitorPlugin p : getPlugins()) {
p.addTimerMeasurement(escapedName, timing);
// depends on control dependency: [for], data = [p]
}
}
} } |
public class class_name {
void addBridge(DiagnosticPosition pos,
MethodSymbol meth,
MethodSymbol impl,
ClassSymbol origin,
boolean hypothetical,
ListBuffer<JCTree> bridges) {
make.at(pos);
Type origType = types.memberType(origin.type, meth);
Type origErasure = erasure(origType);
// Create a bridge method symbol and a bridge definition without a body.
Type bridgeType = meth.erasure(types);
long flags = impl.flags() & AccessFlags | SYNTHETIC | BRIDGE |
(origin.isInterface() ? DEFAULT : 0);
if (hypothetical) flags |= HYPOTHETICAL;
MethodSymbol bridge = new MethodSymbol(flags,
meth.name,
bridgeType,
origin);
/* once JDK-6996415 is solved it should be checked if this approach can
* be applied to method addOverrideBridgesIfNeeded
*/
bridge.params = createBridgeParams(impl, bridge, bridgeType);
bridge.setAttributes(impl);
if (!hypothetical) {
JCMethodDecl md = make.MethodDef(bridge, null);
// The bridge calls this.impl(..), if we have an implementation
// in the current class, super.impl(...) otherwise.
JCExpression receiver = (impl.owner == origin)
? make.This(origin.erasure(types))
: make.Super(types.supertype(origin.type).tsym.erasure(types), origin);
// The type returned from the original method.
Type calltype = erasure(impl.type.getReturnType());
// Construct a call of this.impl(params), or super.impl(params),
// casting params and possibly results as needed.
JCExpression call =
make.Apply(
null,
make.Select(receiver, impl).setType(calltype),
translateArgs(make.Idents(md.params), origErasure.getParameterTypes(), null))
.setType(calltype);
JCStatement stat = (origErasure.getReturnType().hasTag(VOID))
? make.Exec(call)
: make.Return(coerce(call, bridgeType.getReturnType()));
md.body = make.Block(0, List.of(stat));
// Add bridge to `bridges' buffer
bridges.append(md);
}
// Add bridge to scope of enclosing class and `overridden' table.
origin.members().enter(bridge);
overridden.put(bridge, meth);
} } | public class class_name {
void addBridge(DiagnosticPosition pos,
MethodSymbol meth,
MethodSymbol impl,
ClassSymbol origin,
boolean hypothetical,
ListBuffer<JCTree> bridges) {
make.at(pos);
Type origType = types.memberType(origin.type, meth);
Type origErasure = erasure(origType);
// Create a bridge method symbol and a bridge definition without a body.
Type bridgeType = meth.erasure(types);
long flags = impl.flags() & AccessFlags | SYNTHETIC | BRIDGE |
(origin.isInterface() ? DEFAULT : 0);
if (hypothetical) flags |= HYPOTHETICAL;
MethodSymbol bridge = new MethodSymbol(flags,
meth.name,
bridgeType,
origin);
/* once JDK-6996415 is solved it should be checked if this approach can
* be applied to method addOverrideBridgesIfNeeded
*/
bridge.params = createBridgeParams(impl, bridge, bridgeType);
bridge.setAttributes(impl);
if (!hypothetical) {
JCMethodDecl md = make.MethodDef(bridge, null);
// The bridge calls this.impl(..), if we have an implementation
// in the current class, super.impl(...) otherwise.
JCExpression receiver = (impl.owner == origin)
? make.This(origin.erasure(types))
: make.Super(types.supertype(origin.type).tsym.erasure(types), origin);
// The type returned from the original method.
Type calltype = erasure(impl.type.getReturnType());
// Construct a call of this.impl(params), or super.impl(params),
// casting params and possibly results as needed.
JCExpression call =
make.Apply(
null,
make.Select(receiver, impl).setType(calltype),
translateArgs(make.Idents(md.params), origErasure.getParameterTypes(), null))
.setType(calltype);
JCStatement stat = (origErasure.getReturnType().hasTag(VOID))
? make.Exec(call)
: make.Return(coerce(call, bridgeType.getReturnType()));
md.body = make.Block(0, List.of(stat)); // depends on control dependency: [if], data = [none]
// Add bridge to `bridges' buffer
bridges.append(md); // depends on control dependency: [if], data = [none]
}
// Add bridge to scope of enclosing class and `overridden' table.
origin.members().enter(bridge);
overridden.put(bridge, meth);
} } |
public class class_name {
public CsvWriter write(String[]... lines) throws IORuntimeException {
if (ArrayUtil.isNotEmpty(lines)) {
for (final String[] values : lines) {
appendLine(values);
}
flush();
}
return this;
} } | public class class_name {
public CsvWriter write(String[]... lines) throws IORuntimeException {
if (ArrayUtil.isNotEmpty(lines)) {
for (final String[] values : lines) {
appendLine(values); // depends on control dependency: [for], data = [values]
}
flush();
}
return this;
} } |
public class class_name {
public static String decode_escaped(String str) {
if(str.indexOf('\\')==-1)
return str;
StringBuilder sb=new StringBuilder(str.length());
for(int i=0; i<str.length(); ++i) {
char c=str.charAt(i);
if(c=='\\') {
// possible escape sequence
char c2=str.charAt(++i);
switch(c2) {
case '\\':
// double-escaped '\\'--> '\'
sb.append(c);
break;
case 'x':
// hex escaped "\x??"
char h1=str.charAt(++i);
char h2=str.charAt(++i);
c2=(char)Integer.parseInt(""+h1+h2, 16);
sb.append(c2);
break;
case 'n':
sb.append('\n');
break;
case 'r':
sb.append('\r');
break;
case 't':
sb.append('\t');
break;
case '\'':
sb.append('\''); // sometimes occurs in protocol level 0 strings
break;
default:
if(str.length()>80)
str=str.substring(0, 80);
throw new PickleException("invalid escape sequence char \'"+ (c2) + "\' in string \"" + str + " [...]\" (possibly truncated)");
}
} else {
sb.append(str.charAt(i));
}
}
return sb.toString();
} } | public class class_name {
public static String decode_escaped(String str) {
if(str.indexOf('\\')==-1)
return str;
StringBuilder sb=new StringBuilder(str.length());
for(int i=0; i<str.length(); ++i) {
char c=str.charAt(i);
if(c=='\\') {
// possible escape sequence
char c2=str.charAt(++i);
switch(c2) {
case '\\':
// double-escaped '\\'--> '\'
sb.append(c);
break;
case 'x':
// hex escaped "\x??"
char h1=str.charAt(++i);
char h2=str.charAt(++i);
c2=(char)Integer.parseInt(""+h1+h2, 16);
sb.append(c2);
break;
case 'n':
sb.append('\n');
break;
case 'r':
sb.append('\r');
break;
case 't':
sb.append('\t');
break;
case '\'':
sb.append('\''); // sometimes occurs in protocol level 0 strings
break;
default:
if(str.length()>80)
str=str.substring(0, 80);
throw new PickleException("invalid escape sequence char \'"+ (c2) + "\' in string \"" + str + " [...]\" (possibly truncated)");
}
} else {
sb.append(str.charAt(i));
}
}
return sb.toString();
// depends on control dependency: [for], data = [none]
} } |
public class class_name {
private void registerFieldMappingStrategy() {
if (!this.getConfiguration().getContextKeys().contains(OGlobalConfiguration.DOCUMENT_BINARY_MAPPING.getKey())) {
this.getConfiguration()
.setValue(OGlobalConfiguration.DOCUMENT_BINARY_MAPPING, OGlobalConfiguration.DOCUMENT_BINARY_MAPPING.getValueAsInteger());
}
} } | public class class_name {
private void registerFieldMappingStrategy() {
if (!this.getConfiguration().getContextKeys().contains(OGlobalConfiguration.DOCUMENT_BINARY_MAPPING.getKey())) {
this.getConfiguration()
.setValue(OGlobalConfiguration.DOCUMENT_BINARY_MAPPING, OGlobalConfiguration.DOCUMENT_BINARY_MAPPING.getValueAsInteger());
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void fireTaskReadEvent(Task task)
{
if (m_projectListeners != null)
{
for (ProjectListener listener : m_projectListeners)
{
listener.taskRead(task);
}
}
} } | public class class_name {
public void fireTaskReadEvent(Task task)
{
if (m_projectListeners != null)
{
for (ProjectListener listener : m_projectListeners)
{
listener.taskRead(task); // depends on control dependency: [for], data = [listener]
}
}
} } |
public class class_name {
protected StringBuffer renderOptions(StringBuffer sb, int width, Options options, int leftPad, int descPad)
{
final String lpad = createPadding(leftPad);
final String dpad = createPadding(descPad);
// first create list containing only <lpad>-a,--aaa where
// -a is opt and --aaa is long opt; in parallel look for
// the longest opt string this list will be then used to
// sort options ascending
int max = 0;
List<StringBuffer> prefixList = new ArrayList<StringBuffer>();
List<Option> optList = options.helpOptions();
if (getOptionComparator() != null)
{
Collections.sort(optList, getOptionComparator());
}
for (Option option : optList)
{
StringBuffer optBuf = new StringBuffer();
if (option.getOpt() == null)
{
optBuf.append(lpad).append(" ").append(getLongOptPrefix()).append(option.getLongOpt());
}
else
{
optBuf.append(lpad).append(getOptPrefix()).append(option.getOpt());
if (option.hasLongOpt())
{
optBuf.append(',').append(getLongOptPrefix()).append(option.getLongOpt());
}
}
if (option.hasArg())
{
String argName = option.getArgName();
if (argName != null && argName.length() == 0)
{
// if the option has a blank argname
optBuf.append(' ');
}
else
{
optBuf.append(option.hasLongOpt() ? longOptSeparator : " ");
optBuf.append("<").append(argName != null ? option.getArgName() : getArgName()).append(">");
}
}
prefixList.add(optBuf);
max = optBuf.length() > max ? optBuf.length() : max;
}
int x = 0;
for (Iterator<Option> it = optList.iterator(); it.hasNext();)
{
Option option = it.next();
StringBuilder optBuf = new StringBuilder(prefixList.get(x++).toString());
if (optBuf.length() < max)
{
optBuf.append(createPadding(max - optBuf.length()));
}
optBuf.append(dpad);
int nextLineTabStop = max + descPad;
if (option.getDescription() != null)
{
optBuf.append(option.getDescription());
}
renderWrappedText(sb, width, nextLineTabStop, optBuf.toString());
if (it.hasNext())
{
sb.append(getNewLine());
}
}
return sb;
} } | public class class_name {
protected StringBuffer renderOptions(StringBuffer sb, int width, Options options, int leftPad, int descPad)
{
final String lpad = createPadding(leftPad);
final String dpad = createPadding(descPad);
// first create list containing only <lpad>-a,--aaa where
// -a is opt and --aaa is long opt; in parallel look for
// the longest opt string this list will be then used to
// sort options ascending
int max = 0;
List<StringBuffer> prefixList = new ArrayList<StringBuffer>();
List<Option> optList = options.helpOptions();
if (getOptionComparator() != null)
{
Collections.sort(optList, getOptionComparator()); // depends on control dependency: [if], data = [none]
}
for (Option option : optList)
{
StringBuffer optBuf = new StringBuffer();
if (option.getOpt() == null)
{
optBuf.append(lpad).append(" ").append(getLongOptPrefix()).append(option.getLongOpt()); // depends on control dependency: [if], data = [none]
}
else
{
optBuf.append(lpad).append(getOptPrefix()).append(option.getOpt()); // depends on control dependency: [if], data = [(option.getOpt()]
if (option.hasLongOpt())
{
optBuf.append(',').append(getLongOptPrefix()).append(option.getLongOpt()); // depends on control dependency: [if], data = [none]
}
}
if (option.hasArg())
{
String argName = option.getArgName();
if (argName != null && argName.length() == 0)
{
// if the option has a blank argname
optBuf.append(' '); // depends on control dependency: [if], data = [none]
}
else
{
optBuf.append(option.hasLongOpt() ? longOptSeparator : " ");
optBuf.append("<").append(argName != null ? option.getArgName() : getArgName()).append(">"); // depends on control dependency: [if], data = [none]
}
}
prefixList.add(optBuf); // depends on control dependency: [for], data = [none]
max = optBuf.length() > max ? optBuf.length() : max; // depends on control dependency: [for], data = [none]
}
int x = 0;
for (Iterator<Option> it = optList.iterator(); it.hasNext();)
{
Option option = it.next();
StringBuilder optBuf = new StringBuilder(prefixList.get(x++).toString());
if (optBuf.length() < max)
{
optBuf.append(createPadding(max - optBuf.length())); // depends on control dependency: [if], data = [none]
}
optBuf.append(dpad); // depends on control dependency: [for], data = [none]
int nextLineTabStop = max + descPad;
if (option.getDescription() != null)
{
optBuf.append(option.getDescription()); // depends on control dependency: [if], data = [(option.getDescription()]
}
renderWrappedText(sb, width, nextLineTabStop, optBuf.toString()); // depends on control dependency: [for], data = [none]
if (it.hasNext())
{
sb.append(getNewLine()); // depends on control dependency: [if], data = [none]
}
}
return sb;
} } |
public class class_name {
public static Type newArrayType(Type componentType) {
if (componentType instanceof Class<?>) {
return newArrayType((Class<?>) componentType);
}
final TypeVariable<?> var = TypeVariableGenerator.freshTypeVariable("E");
return new TypeResolver().where(var, componentType).resolveType(new GenericArrayType() {
@Override public Type getGenericComponentType() { return var; }
});
} } | public class class_name {
public static Type newArrayType(Type componentType) {
if (componentType instanceof Class<?>) {
return newArrayType((Class<?>) componentType); // depends on control dependency: [if], data = [)]
}
final TypeVariable<?> var = TypeVariableGenerator.freshTypeVariable("E");
return new TypeResolver().where(var, componentType).resolveType(new GenericArrayType() {
@Override public Type getGenericComponentType() { return var; }
});
} } |
public class class_name {
public static boolean isValidateMethodString(final String str) {
if (str == null) {
return false;
}
return str.startsWith(TieConstants.METHOD_VALIDATE_PREFIX);
} } | public class class_name {
public static boolean isValidateMethodString(final String str) {
if (str == null) {
return false;
// depends on control dependency: [if], data = [none]
}
return str.startsWith(TieConstants.METHOD_VALIDATE_PREFIX);
} } |
public class class_name {
public boolean containsKey(K primaryKey, L secondaryKey)
{
// Check that the field exists in the table.
CircularArrayMap<E> field = fieldMap.get(secondaryKey);
if (field == null)
{
return false;
}
// Check that the symbol exists in the table.
CompositeKey<K> compositeKey = new CompositeKey<K>(parentSequenceKey, primaryKey);
SymbolTableImpl<K, L, E> nextParentScope = parentScope;
while (true)
{
if (hashFunction.containsKey(compositeKey))
{
break;
}
if (nextParentScope != null)
{
compositeKey = new CompositeKey(nextParentScope.parentSequenceKey, primaryKey);
nextParentScope = nextParentScope.parentScope;
}
else
{
return false;
}
}
// Calculate the symbols index in the table, and use it to check if a value for that field exists.
E value = field.get(hashFunction.apply(compositeKey));
return value != null;
} } | public class class_name {
public boolean containsKey(K primaryKey, L secondaryKey)
{
// Check that the field exists in the table.
CircularArrayMap<E> field = fieldMap.get(secondaryKey);
if (field == null)
{
return false; // depends on control dependency: [if], data = [none]
}
// Check that the symbol exists in the table.
CompositeKey<K> compositeKey = new CompositeKey<K>(parentSequenceKey, primaryKey);
SymbolTableImpl<K, L, E> nextParentScope = parentScope;
while (true)
{
if (hashFunction.containsKey(compositeKey))
{
break;
}
if (nextParentScope != null)
{
compositeKey = new CompositeKey(nextParentScope.parentSequenceKey, primaryKey); // depends on control dependency: [if], data = [(nextParentScope]
nextParentScope = nextParentScope.parentScope; // depends on control dependency: [if], data = [none]
}
else
{
return false; // depends on control dependency: [if], data = [none]
}
}
// Calculate the symbols index in the table, and use it to check if a value for that field exists.
E value = field.get(hashFunction.apply(compositeKey));
return value != null;
} } |
public class class_name {
@Override
public EEnum getIfcNullStyleEnum() {
if (ifcNullStyleEnumEEnum == null) {
ifcNullStyleEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1020);
}
return ifcNullStyleEnumEEnum;
} } | public class class_name {
@Override
public EEnum getIfcNullStyleEnum() {
if (ifcNullStyleEnumEEnum == null) {
ifcNullStyleEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1020);
// depends on control dependency: [if], data = [none]
}
return ifcNullStyleEnumEEnum;
} } |
public class class_name {
public void deleteAllCookies() {
String action = "Deleting all cookies";
String expected = "All cookies are removed";
try {
driver.manage().deleteAllCookies();
} catch (Exception e) {
reporter.fail(action, expected, "Unable to remove all cookies. " + e.getMessage());
log.warn(e);
return;
}
reporter.pass(action, expected, expected);
} } | public class class_name {
public void deleteAllCookies() {
String action = "Deleting all cookies";
String expected = "All cookies are removed";
try {
driver.manage().deleteAllCookies(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
reporter.fail(action, expected, "Unable to remove all cookies. " + e.getMessage());
log.warn(e);
return;
} // depends on control dependency: [catch], data = [none]
reporter.pass(action, expected, expected);
} } |
public class class_name {
private Map<Long, FeatureShape> getFeatureIds(Map<String, Map<Long, FeatureShape>> tables, String table) {
Map<Long, FeatureShape> featureIds = tables.get(table);
if (featureIds == null) {
featureIds = new HashMap<>();
tables.put(table, featureIds);
}
return featureIds;
} } | public class class_name {
private Map<Long, FeatureShape> getFeatureIds(Map<String, Map<Long, FeatureShape>> tables, String table) {
Map<Long, FeatureShape> featureIds = tables.get(table);
if (featureIds == null) {
featureIds = new HashMap<>(); // depends on control dependency: [if], data = [none]
tables.put(table, featureIds); // depends on control dependency: [if], data = [none]
}
return featureIds;
} } |
public class class_name {
public void addTaggedComponent(final String tag, final WComponent component) {
if (Util.empty(tag)) {
throw new IllegalArgumentException("A tag must be provided.");
}
if (component == null) {
throw new IllegalArgumentException("A component must be provided.");
}
TemplateModel model = getOrCreateComponentModel();
if (model.taggedComponents == null) {
model.taggedComponents = new HashMap<>();
} else {
if (model.taggedComponents.containsKey(tag)) {
throw new IllegalArgumentException("The tag [" + tag + "] has already been added.");
}
if (model.taggedComponents.containsValue(component)) {
throw new IllegalArgumentException("Component has already been added.");
}
}
model.taggedComponents.put(tag, component);
add(component);
} } | public class class_name {
public void addTaggedComponent(final String tag, final WComponent component) {
if (Util.empty(tag)) {
throw new IllegalArgumentException("A tag must be provided.");
}
if (component == null) {
throw new IllegalArgumentException("A component must be provided.");
}
TemplateModel model = getOrCreateComponentModel();
if (model.taggedComponents == null) {
model.taggedComponents = new HashMap<>(); // depends on control dependency: [if], data = [none]
} else {
if (model.taggedComponents.containsKey(tag)) {
throw new IllegalArgumentException("The tag [" + tag + "] has already been added.");
}
if (model.taggedComponents.containsValue(component)) {
throw new IllegalArgumentException("Component has already been added.");
}
}
model.taggedComponents.put(tag, component);
add(component);
} } |
public class class_name {
public int countOccupiedMapSlots() {
int mapSlotsCount = 0;
for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) {
TaskStatus ts = (TaskStatus) it.next();
if (ts.getIsMap() && isTaskRunning(ts)) {
mapSlotsCount += ts.getNumSlots();
}
}
return mapSlotsCount;
} } | public class class_name {
public int countOccupiedMapSlots() {
int mapSlotsCount = 0;
for (Iterator<TaskStatus> it = taskReports.iterator(); it.hasNext();) {
TaskStatus ts = (TaskStatus) it.next();
if (ts.getIsMap() && isTaskRunning(ts)) {
mapSlotsCount += ts.getNumSlots(); // depends on control dependency: [if], data = [none]
}
}
return mapSlotsCount;
} } |
public class class_name {
public T addAppArgs(String... args) {
for (String arg : args) {
checkNotNull(arg, "arg");
builder.appArgs.add(arg);
}
return self();
} } | public class class_name {
public T addAppArgs(String... args) {
for (String arg : args) {
checkNotNull(arg, "arg"); // depends on control dependency: [for], data = [arg]
builder.appArgs.add(arg); // depends on control dependency: [for], data = [arg]
}
return self();
} } |
public class class_name {
public EnvironmentPropertyDescriptions withPropertyGroupDescriptions(PropertyGroup... propertyGroupDescriptions) {
if (this.propertyGroupDescriptions == null) {
setPropertyGroupDescriptions(new java.util.ArrayList<PropertyGroup>(propertyGroupDescriptions.length));
}
for (PropertyGroup ele : propertyGroupDescriptions) {
this.propertyGroupDescriptions.add(ele);
}
return this;
} } | public class class_name {
public EnvironmentPropertyDescriptions withPropertyGroupDescriptions(PropertyGroup... propertyGroupDescriptions) {
if (this.propertyGroupDescriptions == null) {
setPropertyGroupDescriptions(new java.util.ArrayList<PropertyGroup>(propertyGroupDescriptions.length)); // depends on control dependency: [if], data = [none]
}
for (PropertyGroup ele : propertyGroupDescriptions) {
this.propertyGroupDescriptions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private Map<String, Object> initialize(EntityMetadata entityMetadata)
{
Map<String, Object> relationMap = null;
if (entityMetadata.getRelationNames() != null && !entityMetadata.getRelationNames().isEmpty())
{
relationMap = new HashMap<String, Object>();
}
return relationMap;
} } | public class class_name {
private Map<String, Object> initialize(EntityMetadata entityMetadata)
{
Map<String, Object> relationMap = null;
if (entityMetadata.getRelationNames() != null && !entityMetadata.getRelationNames().isEmpty())
{
relationMap = new HashMap<String, Object>(); // depends on control dependency: [if], data = [none]
}
return relationMap;
} } |
public class class_name {
@Override
public <T, U extends T> AutoCloseable registerHandler(
final Class<U> messageType, final EventHandler<RemoteMessage<T>> theHandler) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "RemoteManager: {0} messageType: {1} handler: {2}", new Object[] {
this.name, messageType.getCanonicalName(), theHandler.getClass().getCanonicalName()});
}
return this.handlerContainer.registerHandler(messageType, theHandler);
} } | public class class_name {
@Override
public <T, U extends T> AutoCloseable registerHandler(
final Class<U> messageType, final EventHandler<RemoteMessage<T>> theHandler) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "RemoteManager: {0} messageType: {1} handler: {2}", new Object[] {
this.name, messageType.getCanonicalName(), theHandler.getClass().getCanonicalName()}); // depends on control dependency: [if], data = [none]
}
return this.handlerContainer.registerHandler(messageType, theHandler);
} } |
public class class_name {
public OrMessageFilter add(IFeedbackMessageFilter... filters) {
for (IFeedbackMessageFilter filter : filters) {
this.filters.add(filter);
}
return this;
} } | public class class_name {
public OrMessageFilter add(IFeedbackMessageFilter... filters) {
for (IFeedbackMessageFilter filter : filters) {
this.filters.add(filter); // depends on control dependency: [for], data = [filter]
}
return this;
} } |
public class class_name {
private String utilDateToStr(Date pdt, String pstrFmt)
{
String strRet = null;
SimpleDateFormat dtFmt = null;
try
{
dtFmt = new SimpleDateFormat(pstrFmt);
strRet = dtFmt.format(pdt);
}
catch (Exception e)
{
strRet = null;
}
finally
{
if (dtFmt != null) dtFmt = null;
}
return strRet;
} } | public class class_name {
private String utilDateToStr(Date pdt, String pstrFmt)
{
String strRet = null;
SimpleDateFormat dtFmt = null;
try
{
dtFmt = new SimpleDateFormat(pstrFmt);
// depends on control dependency: [try], data = [none]
strRet = dtFmt.format(pdt);
// depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
strRet = null;
}
// depends on control dependency: [catch], data = [none]
finally
{
if (dtFmt != null) dtFmt = null;
}
return strRet;
} } |
public class class_name {
private Rectangle extendRect(Rectangle rect, boolean horizontal) {
if (rect == null) {
return rect;
}
if (horizontal) {
rect.x = 0;
rect.width = table.getWidth();
} else {
rect.y = 0;
if (table.getRowCount() != 0) {
Rectangle lastRect = table.getCellRect(table.getRowCount() - 1, 0, true);
rect.height = lastRect.y + lastRect.height;
} else {
rect.height = table.getHeight();
}
}
return rect;
} } | public class class_name {
private Rectangle extendRect(Rectangle rect, boolean horizontal) {
if (rect == null) {
return rect; // depends on control dependency: [if], data = [none]
}
if (horizontal) {
rect.x = 0; // depends on control dependency: [if], data = [none]
rect.width = table.getWidth(); // depends on control dependency: [if], data = [none]
} else {
rect.y = 0; // depends on control dependency: [if], data = [none]
if (table.getRowCount() != 0) {
Rectangle lastRect = table.getCellRect(table.getRowCount() - 1, 0, true);
rect.height = lastRect.y + lastRect.height; // depends on control dependency: [if], data = [none]
} else {
rect.height = table.getHeight(); // depends on control dependency: [if], data = [none]
}
}
return rect;
} } |
public class class_name {
private void addPkcs12ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPkcs12ButtonActionPerformed
if (fileTextField.getText().equals("")) {
return;
}
String kspass = new String(pkcs12PasswordField.getPassword());
if (kspass.equals("")){
//pcks#12 file with empty password is not supported by java
showCertError("options.cert.error.pkcs12nopass", Constant.messages.getString("options.cert.error.usepassfile"));
return;
}
int ksIndex;
try {
ksIndex = contextManager.loadPKCS12Certificate(fileTextField.getText(), kspass);
keyStoreListModel.insertElementAt(contextManager.getKeyStoreDescription(ksIndex), ksIndex);
} catch (Exception e) {
showKeyStoreCertError(Constant.messages.getString("options.cert.error.password"));
logger.error(e.getMessage(), e);
return;
}
certificatejTabbedPane.setSelectedIndex(0);
activateFirstOnlyAliasOfKeyStore(ksIndex);
fileTextField.setText("");
pkcs12PasswordField.setText("");
} } | public class class_name {
private void addPkcs12ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPkcs12ButtonActionPerformed
if (fileTextField.getText().equals("")) {
return;
// depends on control dependency: [if], data = [none]
}
String kspass = new String(pkcs12PasswordField.getPassword());
if (kspass.equals("")){
//pcks#12 file with empty password is not supported by java
showCertError("options.cert.error.pkcs12nopass", Constant.messages.getString("options.cert.error.usepassfile"));
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
int ksIndex;
try {
ksIndex = contextManager.loadPKCS12Certificate(fileTextField.getText(), kspass);
keyStoreListModel.insertElementAt(contextManager.getKeyStoreDescription(ksIndex), ksIndex);
} catch (Exception e) {
showKeyStoreCertError(Constant.messages.getString("options.cert.error.password"));
logger.error(e.getMessage(), e);
return;
}
certificatejTabbedPane.setSelectedIndex(0);
activateFirstOnlyAliasOfKeyStore(ksIndex);
fileTextField.setText("");
pkcs12PasswordField.setText("");
} } |
public class class_name {
@Override
public void processMessage(final WebSocketMessage webSocketData) {
setDoTransactionNotifications(true);
final SecurityContext securityContext = getWebSocket().getSecurityContext();
try {
final String uuid = webSocketData.getId();
int sequenceNumber = webSocketData.getNodeDataIntegerValue("chunkId");
int chunkSize = webSocketData.getNodeDataIntegerValue("chunkSize");
int chunks = webSocketData.getNodeDataIntegerValue("chunks");
Object rawData = webSocketData.getNodeData().get("chunk");
byte[] data = new byte[0];
if (rawData != null) {
if (rawData instanceof String) {
logger.debug("Raw data: {}", rawData);
// data = Base64.decodeBase64(((String)rawData).getBytes("UTF-8"));
data = Base64.decode(((String) rawData));
logger.debug("Decoded data: {}", data);
}
}
final File file = (File) getNode(uuid);
if (file.isTemplate()) {
logger.warn("No write permission, file is in template mode: {}", new Object[] {file.toString()});
getWebSocket().send(MessageBuilder.status().message("No write permission, file is in template mode").code(400).build(), true);
return;
}
if (!file.isGranted(Permission.write, securityContext)) {
logger.warn("No write permission for {} on {}", new Object[] {getWebSocket().getCurrentUser().toString(), file.toString()});
getWebSocket().send(MessageBuilder.status().message("No write permission").code(400).build(), true);
return;
}
getWebSocket().handleFileChunk(uuid, sequenceNumber, chunkSize, data, chunks);
if (sequenceNumber+1 == chunks) {
FileHelper.updateMetadata(file);
file.increaseVersion();
getWebSocket().removeFileUploadHandler(uuid);
logger.debug("File upload finished. Checksum: {}, size: {}", new Object[]{ file.getChecksum(), file.getSize() });
}
final long currentSize = (long)(sequenceNumber * chunkSize) + data.length;
// This should trigger setting of lastModifiedDate in any case
getWebSocket().send(MessageBuilder.status().code(200).message("{\"id\":\"" + file.getUuid() + "\", \"name\":\"" + file.getName() + "\",\"size\":" + currentSize + "}").build(), true);
} catch (IOException | FrameworkException ex) {
String msg = ex.toString();
// return error message
getWebSocket().send(MessageBuilder.status().code(400).message("Could not process chunk data: ".concat((msg != null)
? msg
: "")).build(), true);
}
} } | public class class_name {
@Override
public void processMessage(final WebSocketMessage webSocketData) {
setDoTransactionNotifications(true);
final SecurityContext securityContext = getWebSocket().getSecurityContext();
try {
final String uuid = webSocketData.getId();
int sequenceNumber = webSocketData.getNodeDataIntegerValue("chunkId");
int chunkSize = webSocketData.getNodeDataIntegerValue("chunkSize");
int chunks = webSocketData.getNodeDataIntegerValue("chunks");
Object rawData = webSocketData.getNodeData().get("chunk");
byte[] data = new byte[0];
if (rawData != null) {
if (rawData instanceof String) {
logger.debug("Raw data: {}", rawData); // depends on control dependency: [if], data = [none]
// data = Base64.decodeBase64(((String)rawData).getBytes("UTF-8"));
data = Base64.decode(((String) rawData)); // depends on control dependency: [if], data = [none]
logger.debug("Decoded data: {}", data); // depends on control dependency: [if], data = [none]
}
}
final File file = (File) getNode(uuid);
if (file.isTemplate()) {
logger.warn("No write permission, file is in template mode: {}", new Object[] {file.toString()}); // depends on control dependency: [if], data = [none]
getWebSocket().send(MessageBuilder.status().message("No write permission, file is in template mode").code(400).build(), true); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (!file.isGranted(Permission.write, securityContext)) {
logger.warn("No write permission for {} on {}", new Object[] {getWebSocket().getCurrentUser().toString(), file.toString()}); // depends on control dependency: [if], data = [none]
getWebSocket().send(MessageBuilder.status().message("No write permission").code(400).build(), true); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
getWebSocket().handleFileChunk(uuid, sequenceNumber, chunkSize, data, chunks); // depends on control dependency: [try], data = [none]
if (sequenceNumber+1 == chunks) {
FileHelper.updateMetadata(file); // depends on control dependency: [if], data = [none]
file.increaseVersion(); // depends on control dependency: [if], data = [none]
getWebSocket().removeFileUploadHandler(uuid); // depends on control dependency: [if], data = [none]
logger.debug("File upload finished. Checksum: {}, size: {}", new Object[]{ file.getChecksum(), file.getSize() }); // depends on control dependency: [if], data = [none]
}
final long currentSize = (long)(sequenceNumber * chunkSize) + data.length;
// This should trigger setting of lastModifiedDate in any case
getWebSocket().send(MessageBuilder.status().code(200).message("{\"id\":\"" + file.getUuid() + "\", \"name\":\"" + file.getName() + "\",\"size\":" + currentSize + "}").build(), true); // depends on control dependency: [try], data = [none]
} catch (IOException | FrameworkException ex) {
String msg = ex.toString();
// return error message
getWebSocket().send(MessageBuilder.status().code(400).message("Could not process chunk data: ".concat((msg != null)
? msg
: "")).build(), true);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
Mark skipUntil(String limit) throws JasperException {
Mark ret = null;
int limlen = limit.length();
int ch;
skip:
for (ret = mark(), ch = nextChar() ; ch != -1 ;
ret = mark(), ch = nextChar()) {
if (ch == limit.charAt(0)) {
Mark restart = mark();
for (int i = 1 ; i < limlen ; i++) {
if (peekChar() == limit.charAt(i))
nextChar();
else {
reset(restart);
continue skip;
}
}
return ret;
}
}
return null;
} } | public class class_name {
Mark skipUntil(String limit) throws JasperException {
Mark ret = null;
int limlen = limit.length();
int ch;
skip:
for (ret = mark(), ch = nextChar() ; ch != -1 ;
ret = mark(), ch = nextChar()) {
if (ch == limit.charAt(0)) {
Mark restart = mark();
for (int i = 1 ; i < limlen ; i++) {
if (peekChar() == limit.charAt(i))
nextChar();
else {
reset(restart); // depends on control dependency: [if], data = [none]
continue skip;
}
}
return ret; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public EClass getIfcLine() {
if (ifcLineEClass == null) {
ifcLineEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers()
.get(299);
}
return ifcLineEClass;
} } | public class class_name {
public EClass getIfcLine() {
if (ifcLineEClass == null) {
ifcLineEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers()
.get(299);
// depends on control dependency: [if], data = [none]
}
return ifcLineEClass;
} } |
public class class_name {
public long connectRenegotiate() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionConnectRenegotiate(context.ctx);
} finally {
readerLock.unlock();
}
} } | public class class_name {
public long connectRenegotiate() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionConnectRenegotiate(context.ctx); // depends on control dependency: [try], data = [none]
} finally {
readerLock.unlock();
}
} } |
public class class_name {
protected int findByte(byte value,
int pos) {
for (int i = pos; i < tail; i++) {
if (buffer[i] == value) {
return i;
}
}
return -1;
} } | public class class_name {
protected int findByte(byte value,
int pos) {
for (int i = pos; i < tail; i++) {
if (buffer[i] == value) {
return i; // depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
public String toWKS() {
StringBuilder sbuff = new StringBuilder();
sbuff.append("PROJCS[\"").append(getName()).append("\",");
if (true) {
sbuff.append("GEOGCS[\"Normal Sphere (r=6371007)\",");
sbuff.append("DATUM[\"unknown\",");
sbuff.append("SPHEROID[\"sphere\",6371007,0]],");
} else {
sbuff.append("GEOGCS[\"WGS 84\",");
sbuff.append("DATUM[\"WGS_1984\",");
sbuff.append("SPHEROID[\"WGS 84\",6378137,298.257223563],");
sbuff.append("TOWGS84[0,0,0,0,0,0,0]],");
}
sbuff.append("PRIMEM[\"Greenwich\",0],");
sbuff.append("UNIT[\"degree\",0.0174532925199433]],");
sbuff.append("PROJECTION[\"Lambert_Conformal_Conic_1SP\"],");
sbuff.append("PARAMETER[\"latitude_of_origin\",").append(getOriginLat()).append("],"); // LOOK assumes getOriginLat = getParellel
sbuff.append("PARAMETER[\"central_meridian\",").append(getOriginLon()).append("],");
sbuff.append("PARAMETER[\"scale_factor\",1],");
sbuff.append("PARAMETER[\"false_easting\",").append(falseEasting).append("],");
sbuff.append("PARAMETER[\"false_northing\",").append(falseNorthing).append("],");
return sbuff.toString();
} } | public class class_name {
public String toWKS() {
StringBuilder sbuff = new StringBuilder();
sbuff.append("PROJCS[\"").append(getName()).append("\",");
if (true) {
sbuff.append("GEOGCS[\"Normal Sphere (r=6371007)\",");
// depends on control dependency: [if], data = [none]
sbuff.append("DATUM[\"unknown\",");
// depends on control dependency: [if], data = [none]
sbuff.append("SPHEROID[\"sphere\",6371007,0]],");
// depends on control dependency: [if], data = [none]
} else {
sbuff.append("GEOGCS[\"WGS 84\",");
// depends on control dependency: [if], data = [none]
sbuff.append("DATUM[\"WGS_1984\",");
// depends on control dependency: [if], data = [none]
sbuff.append("SPHEROID[\"WGS 84\",6378137,298.257223563],");
// depends on control dependency: [if], data = [none]
sbuff.append("TOWGS84[0,0,0,0,0,0,0]],");
// depends on control dependency: [if], data = [none]
}
sbuff.append("PRIMEM[\"Greenwich\",0],");
sbuff.append("UNIT[\"degree\",0.0174532925199433]],");
sbuff.append("PROJECTION[\"Lambert_Conformal_Conic_1SP\"],");
sbuff.append("PARAMETER[\"latitude_of_origin\",").append(getOriginLat()).append("],"); // LOOK assumes getOriginLat = getParellel
sbuff.append("PARAMETER[\"central_meridian\",").append(getOriginLon()).append("],");
sbuff.append("PARAMETER[\"scale_factor\",1],");
sbuff.append("PARAMETER[\"false_easting\",").append(falseEasting).append("],");
sbuff.append("PARAMETER[\"false_northing\",").append(falseNorthing).append("],");
return sbuff.toString();
} } |
public class class_name {
public void stop() {
// set the record flag to false
if (recording.compareAndSet(true, false)) {
// remove the scheduled job
scheduler.removeScheduledJob(eventQueueJobName);
if (queue.isEmpty()) {
log.debug("Event queue was empty on stop");
} else {
if (!eqj.processing.get()){
log.debug("Event queue was not empty on stop and it's not processing, processing...");
do {
processQueue();
} while (!queue.isEmpty());
}else{
log.debug("Event queue was not empty on stop but it's in processing, waiting...");
do {
} while (!queue.isEmpty());
}
log.debug("Processing done, event queue empty, moving on");
}
recordingConsumer.uninit();
} else {
log.debug("Recording listener was already stopped");
}
} } | public class class_name {
public void stop() {
// set the record flag to false
if (recording.compareAndSet(true, false)) {
// remove the scheduled job
scheduler.removeScheduledJob(eventQueueJobName);
// depends on control dependency: [if], data = [none]
if (queue.isEmpty()) {
log.debug("Event queue was empty on stop");
// depends on control dependency: [if], data = [none]
} else {
if (!eqj.processing.get()){
log.debug("Event queue was not empty on stop and it's not processing, processing...");
do {
processQueue();
} while (!queue.isEmpty());
}else{
log.debug("Event queue was not empty on stop but it's in processing, waiting...");
// depends on control dependency: [if], data = [none]
do {
} while (!queue.isEmpty());
}
log.debug("Processing done, event queue empty, moving on");
// depends on control dependency: [if], data = [none]
}
recordingConsumer.uninit();
// depends on control dependency: [if], data = [none]
} else {
log.debug("Recording listener was already stopped");
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Pure
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity",
"checkstyle:nestedifdepth"})
static URL convertStringToURL(String urlDescription, boolean allowResourceSearch,
boolean repliesFileURL, boolean supportWindowsPaths) {
URL url = null;
if (urlDescription != null && urlDescription.length() > 0) {
if (supportWindowsPaths && isWindowsNativeFilename(urlDescription)) {
final File file = normalizeWindowsNativeFilename(urlDescription);
if (file != null) {
return convertFileToURL(file);
}
}
if (URISchemeType.RESOURCE.isScheme(urlDescription)) {
if (allowResourceSearch) {
final String resourceName = urlDescription.substring(9);
url = Resources.getResource(resourceName);
}
} else if (URISchemeType.FILE.isScheme(urlDescription)) {
final File file = new File(URISchemeType.FILE.removeScheme(urlDescription));
try {
url = new URL(URISchemeType.FILE.name(), "", fromFileStandardToURLStandard(file)); //$NON-NLS-1$
} catch (MalformedURLException e) {
//
}
} else {
try {
url = new URL(urlDescription);
} catch (MalformedURLException exception) {
// ignore error
}
}
if (url == null) {
if (allowResourceSearch) {
url = Resources.getResource(urlDescription);
}
if (url == null && URISchemeType.RESOURCE.isScheme(urlDescription)) {
return null;
}
if (url == null && repliesFileURL) {
final String urlPart = URISchemeType.removeAnyScheme(urlDescription);
// Try to parse a malformed JAR url:
// jar:{malformed-url}!/{entry}
if (URISchemeType.JAR.isScheme(urlDescription)) {
final int idx = urlPart.indexOf(JAR_URL_FILE_ROOT);
if (idx > 0) {
final URL jarURL = convertStringToURL(urlPart.substring(0, idx), allowResourceSearch);
if (jarURL != null) {
try {
url = toJarURL(jarURL, urlPart.substring(idx + 2));
} catch (MalformedURLException exception) {
//
}
}
}
}
// Standard local file
if (url == null) {
try {
final File file = new File(urlPart);
url = new URL(URISchemeType.FILE.name(), "", //$NON-NLS-1$
fromFileStandardToURLStandard(file));
} catch (MalformedURLException e) {
// ignore error
}
}
}
}
}
return url;
} } | public class class_name {
@Pure
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity",
"checkstyle:nestedifdepth"})
static URL convertStringToURL(String urlDescription, boolean allowResourceSearch,
boolean repliesFileURL, boolean supportWindowsPaths) {
URL url = null;
if (urlDescription != null && urlDescription.length() > 0) {
if (supportWindowsPaths && isWindowsNativeFilename(urlDescription)) {
final File file = normalizeWindowsNativeFilename(urlDescription);
if (file != null) {
return convertFileToURL(file); // depends on control dependency: [if], data = [(file]
}
}
if (URISchemeType.RESOURCE.isScheme(urlDescription)) {
if (allowResourceSearch) {
final String resourceName = urlDescription.substring(9);
url = Resources.getResource(resourceName); // depends on control dependency: [if], data = [none]
}
} else if (URISchemeType.FILE.isScheme(urlDescription)) {
final File file = new File(URISchemeType.FILE.removeScheme(urlDescription));
try {
url = new URL(URISchemeType.FILE.name(), "", fromFileStandardToURLStandard(file)); //$NON-NLS-1$ // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
//
} // depends on control dependency: [catch], data = [none]
} else {
try {
url = new URL(urlDescription); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException exception) {
// ignore error
} // depends on control dependency: [catch], data = [none]
}
if (url == null) {
if (allowResourceSearch) {
url = Resources.getResource(urlDescription); // depends on control dependency: [if], data = [none]
}
if (url == null && URISchemeType.RESOURCE.isScheme(urlDescription)) {
return null; // depends on control dependency: [if], data = [none]
}
if (url == null && repliesFileURL) {
final String urlPart = URISchemeType.removeAnyScheme(urlDescription);
// Try to parse a malformed JAR url:
// jar:{malformed-url}!/{entry}
if (URISchemeType.JAR.isScheme(urlDescription)) {
final int idx = urlPart.indexOf(JAR_URL_FILE_ROOT);
if (idx > 0) {
final URL jarURL = convertStringToURL(urlPart.substring(0, idx), allowResourceSearch);
if (jarURL != null) {
try {
url = toJarURL(jarURL, urlPart.substring(idx + 2)); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException exception) {
//
} // depends on control dependency: [catch], data = [none]
}
}
}
// Standard local file
if (url == null) {
try {
final File file = new File(urlPart);
url = new URL(URISchemeType.FILE.name(), "", //$NON-NLS-1$
fromFileStandardToURLStandard(file)); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
// ignore error
} // depends on control dependency: [catch], data = [none]
}
}
}
}
return url;
} } |
public class class_name {
public EEnum getIfcDistributionChamberElementTypeEnum() {
if (ifcDistributionChamberElementTypeEnumEEnum == null) {
ifcDistributionChamberElementTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(812);
}
return ifcDistributionChamberElementTypeEnumEEnum;
} } | public class class_name {
public EEnum getIfcDistributionChamberElementTypeEnum() {
if (ifcDistributionChamberElementTypeEnumEEnum == null) {
ifcDistributionChamberElementTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(812);
// depends on control dependency: [if], data = [none]
}
return ifcDistributionChamberElementTypeEnumEEnum;
} } |
public class class_name {
public static void process(GrayF32 orig,
GrayF32 derivXX, GrayF32 derivYY, GrayF32 derivXY ,
ImageBorder_F32 border ) {
InputSanityCheck.reshapeOneIn(orig, derivXX, derivYY, derivXY);
HessianSobel_Shared.process(orig, derivXX, derivYY, derivXY);
if( border != null ) {
border.setImage(orig);
ConvolveJustBorder_General_SB.convolve(kernelXX_F32, border , derivXX);
ConvolveJustBorder_General_SB.convolve(kernelYY_F32, border , derivYY);
ConvolveJustBorder_General_SB.convolve(kernelXY_F32, border , derivXY);
}
} } | public class class_name {
public static void process(GrayF32 orig,
GrayF32 derivXX, GrayF32 derivYY, GrayF32 derivXY ,
ImageBorder_F32 border ) {
InputSanityCheck.reshapeOneIn(orig, derivXX, derivYY, derivXY);
HessianSobel_Shared.process(orig, derivXX, derivYY, derivXY);
if( border != null ) {
border.setImage(orig); // depends on control dependency: [if], data = [none]
ConvolveJustBorder_General_SB.convolve(kernelXX_F32, border , derivXX); // depends on control dependency: [if], data = [none]
ConvolveJustBorder_General_SB.convolve(kernelYY_F32, border , derivYY); // depends on control dependency: [if], data = [none]
ConvolveJustBorder_General_SB.convolve(kernelXY_F32, border , derivXY); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public java.util.List<String> getInstancesList() {
if (instancesList == null) {
instancesList = new com.amazonaws.internal.SdkInternalList<String>();
}
return instancesList;
} } | public class class_name {
public java.util.List<String> getInstancesList() {
if (instancesList == null) {
instancesList = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return instancesList;
} } |
public class class_name {
synchronized void removeInterestedByClass(Class<?> clazz, ProbeListener listener) {
Set<ProbeListener> listeners = listenersByClass.get(clazz);
if (listeners != null) {
listeners.remove(listener);
if (listeners.isEmpty()) {
listenersByClass.remove(clazz);
}
}
} } | public class class_name {
synchronized void removeInterestedByClass(Class<?> clazz, ProbeListener listener) {
Set<ProbeListener> listeners = listenersByClass.get(clazz);
if (listeners != null) {
listeners.remove(listener); // depends on control dependency: [if], data = [none]
if (listeners.isEmpty()) {
listenersByClass.remove(clazz); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private RootBeanDefinition createEmbeddedServer(Element element,
ParserContext parserContext) {
Object source = parserContext.extractSource(element);
String suffix = element.getAttribute(ATT_ROOT_SUFFIX);
if (!StringUtils.hasText(suffix)) {
suffix = OPT_DEFAULT_ROOT_SUFFIX;
}
String port = element.getAttribute(ATT_PORT);
if (!StringUtils.hasText(port)) {
port = getDefaultPort();
if (logger.isDebugEnabled()) {
logger.debug("Using default port of " + port);
}
}
String url = "ldap://127.0.0.1:" + port + "/" + suffix;
BeanDefinitionBuilder contextSource = BeanDefinitionBuilder
.rootBeanDefinition(CONTEXT_SOURCE_CLASS);
contextSource.addConstructorArgValue(url);
contextSource.addPropertyValue("userDn", "uid=admin,ou=system");
contextSource.addPropertyValue("password", "secret");
RootBeanDefinition apacheContainer = new RootBeanDefinition(
"org.springframework.security.ldap.server.ApacheDSContainer", null, null);
apacheContainer.setSource(source);
apacheContainer.getConstructorArgumentValues().addGenericArgumentValue(suffix);
String ldifs = element.getAttribute(ATT_LDIF_FILE);
if (!StringUtils.hasText(ldifs)) {
ldifs = OPT_DEFAULT_LDIF_FILE;
}
apacheContainer.getConstructorArgumentValues().addGenericArgumentValue(ldifs);
apacheContainer.getPropertyValues().addPropertyValue("port", port);
logger.info("Embedded LDAP server bean definition created for URL: " + url);
if (parserContext.getRegistry()
.containsBeanDefinition(BeanIds.EMBEDDED_APACHE_DS)) {
parserContext.getReaderContext().error(
"Only one embedded server bean is allowed per application context",
element);
}
parserContext.getRegistry().registerBeanDefinition(BeanIds.EMBEDDED_APACHE_DS,
apacheContainer);
return (RootBeanDefinition) contextSource.getBeanDefinition();
} } | public class class_name {
private RootBeanDefinition createEmbeddedServer(Element element,
ParserContext parserContext) {
Object source = parserContext.extractSource(element);
String suffix = element.getAttribute(ATT_ROOT_SUFFIX);
if (!StringUtils.hasText(suffix)) {
suffix = OPT_DEFAULT_ROOT_SUFFIX; // depends on control dependency: [if], data = [none]
}
String port = element.getAttribute(ATT_PORT);
if (!StringUtils.hasText(port)) {
port = getDefaultPort(); // depends on control dependency: [if], data = [none]
if (logger.isDebugEnabled()) {
logger.debug("Using default port of " + port); // depends on control dependency: [if], data = [none]
}
}
String url = "ldap://127.0.0.1:" + port + "/" + suffix;
BeanDefinitionBuilder contextSource = BeanDefinitionBuilder
.rootBeanDefinition(CONTEXT_SOURCE_CLASS);
contextSource.addConstructorArgValue(url);
contextSource.addPropertyValue("userDn", "uid=admin,ou=system");
contextSource.addPropertyValue("password", "secret");
RootBeanDefinition apacheContainer = new RootBeanDefinition(
"org.springframework.security.ldap.server.ApacheDSContainer", null, null);
apacheContainer.setSource(source);
apacheContainer.getConstructorArgumentValues().addGenericArgumentValue(suffix);
String ldifs = element.getAttribute(ATT_LDIF_FILE);
if (!StringUtils.hasText(ldifs)) {
ldifs = OPT_DEFAULT_LDIF_FILE; // depends on control dependency: [if], data = [none]
}
apacheContainer.getConstructorArgumentValues().addGenericArgumentValue(ldifs);
apacheContainer.getPropertyValues().addPropertyValue("port", port);
logger.info("Embedded LDAP server bean definition created for URL: " + url);
if (parserContext.getRegistry()
.containsBeanDefinition(BeanIds.EMBEDDED_APACHE_DS)) {
parserContext.getReaderContext().error(
"Only one embedded server bean is allowed per application context",
element); // depends on control dependency: [if], data = [none]
}
parserContext.getRegistry().registerBeanDefinition(BeanIds.EMBEDDED_APACHE_DS,
apacheContainer);
return (RootBeanDefinition) contextSource.getBeanDefinition();
} } |
public class class_name {
public <T extends Appendable> T getExactly(T a) {
try {
boolean prependBlank = false;
long d = delta;
if (d >= YEAR) {
a.append(floor(d, YEAR));
a.append(' ');
a.append('y');
prependBlank = true;
}
d %= YEAR;
if (d >= DAY) {
if (prependBlank) {
a.append(' ');
}
a.append(floor(d, DAY));
a.append(' ');
a.append('d');
prependBlank = true;
}
d %= DAY;
if (d >= HOUR) {
if (prependBlank) {
a.append(' ');
}
a.append(floor(d, HOUR));
a.append(' ');
a.append('h');
prependBlank = true;
}
d %= HOUR;
if (d >= MINUTE) {
if (prependBlank) {
a.append(' ');
}
a.append(floor(d, MINUTE));
a.append(' ');
a.append('m');
prependBlank = true;
}
d %= MINUTE;
if (d >= SECOND) {
if (prependBlank) {
a.append(' ');
}
a.append(floor(d, SECOND));
a.append(' ');
a.append('s');
prependBlank = true;
}
d %= SECOND;
if (d > 0) {
if (prependBlank) {
a.append(' ');
}
a.append(Integer.toString((int) d));
a.append(' ');
a.append('m');
a.append('s');
}
} catch (IOException ex) {
// What were they thinking...
}
return a;
} } | public class class_name {
public <T extends Appendable> T getExactly(T a) {
try {
boolean prependBlank = false;
long d = delta;
if (d >= YEAR) {
a.append(floor(d, YEAR)); // depends on control dependency: [if], data = [(d]
a.append(' '); // depends on control dependency: [if], data = [none]
a.append('y'); // depends on control dependency: [if], data = [none]
prependBlank = true; // depends on control dependency: [if], data = [none]
}
d %= YEAR; // depends on control dependency: [try], data = [none]
if (d >= DAY) {
if (prependBlank) {
a.append(' '); // depends on control dependency: [if], data = [none]
}
a.append(floor(d, DAY)); // depends on control dependency: [if], data = [(d]
a.append(' '); // depends on control dependency: [if], data = [none]
a.append('d'); // depends on control dependency: [if], data = [none]
prependBlank = true; // depends on control dependency: [if], data = [none]
}
d %= DAY; // depends on control dependency: [try], data = [none]
if (d >= HOUR) {
if (prependBlank) {
a.append(' '); // depends on control dependency: [if], data = [none]
}
a.append(floor(d, HOUR)); // depends on control dependency: [if], data = [(d]
a.append(' '); // depends on control dependency: [if], data = [none]
a.append('h'); // depends on control dependency: [if], data = [none]
prependBlank = true; // depends on control dependency: [if], data = [none]
}
d %= HOUR; // depends on control dependency: [try], data = [none]
if (d >= MINUTE) {
if (prependBlank) {
a.append(' '); // depends on control dependency: [if], data = [none]
}
a.append(floor(d, MINUTE)); // depends on control dependency: [if], data = [(d]
a.append(' '); // depends on control dependency: [if], data = [none]
a.append('m'); // depends on control dependency: [if], data = [none]
prependBlank = true; // depends on control dependency: [if], data = [none]
}
d %= MINUTE; // depends on control dependency: [try], data = [none]
if (d >= SECOND) {
if (prependBlank) {
a.append(' '); // depends on control dependency: [if], data = [none]
}
a.append(floor(d, SECOND)); // depends on control dependency: [if], data = [(d]
a.append(' '); // depends on control dependency: [if], data = [none]
a.append('s'); // depends on control dependency: [if], data = [none]
prependBlank = true; // depends on control dependency: [if], data = [none]
}
d %= SECOND; // depends on control dependency: [try], data = [none]
if (d > 0) {
if (prependBlank) {
a.append(' '); // depends on control dependency: [if], data = [none]
}
a.append(Integer.toString((int) d)); // depends on control dependency: [if], data = [none]
a.append(' '); // depends on control dependency: [if], data = [none]
a.append('m'); // depends on control dependency: [if], data = [none]
a.append('s'); // depends on control dependency: [if], data = [none]
}
} catch (IOException ex) {
// What were they thinking...
} // depends on control dependency: [catch], data = [none]
return a;
} } |
public class class_name {
public void writeStatement(Statement oldStat)
{
if (oldStat == null)
{
throw new NullPointerException();
}
Statement newStat = createNewStatement(oldStat);
try
{
// execute newStat
newStat.execute();
}
catch (Exception e)
{
listener.exceptionThrown(new Exception("failed to write statement: " + oldStat, e)); //$NON-NLS-1$
}
} } | public class class_name {
public void writeStatement(Statement oldStat)
{
if (oldStat == null)
{
throw new NullPointerException();
}
Statement newStat = createNewStatement(oldStat);
try
{
// execute newStat
newStat.execute(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
listener.exceptionThrown(new Exception("failed to write statement: " + oldStat, e)); //$NON-NLS-1$
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getAssignedRealNode(Object factor) {
if(nodes.size() <= 1)return JobContext.getContext().getNodeId();
Long key = hash(factor.toString());
SortedMap<Long, String> tailMap = nodes.tailMap(key);
if (tailMap.isEmpty()) {
key = nodes.firstKey();
} else {
key = tailMap.firstKey();
}
return nodes.get(key);
} } | public class class_name {
public String getAssignedRealNode(Object factor) {
if(nodes.size() <= 1)return JobContext.getContext().getNodeId();
Long key = hash(factor.toString());
SortedMap<Long, String> tailMap = nodes.tailMap(key);
if (tailMap.isEmpty()) {
key = nodes.firstKey(); // depends on control dependency: [if], data = [none]
} else {
key = tailMap.firstKey(); // depends on control dependency: [if], data = [none]
}
return nodes.get(key);
} } |
public class class_name {
@Override
public DataBucket combineBuckets(DataBucket[] pBuckets) {
final DataBucket returnVal =
new DataBucket(pBuckets[0].getBucketKey(), pBuckets[0].getLastBucketPointer());
for (int i = 0; i < pBuckets[0].getDatas().length; i++) {
returnVal.setData(i, pBuckets[0].getData(i));
}
return returnVal;
} } | public class class_name {
@Override
public DataBucket combineBuckets(DataBucket[] pBuckets) {
final DataBucket returnVal =
new DataBucket(pBuckets[0].getBucketKey(), pBuckets[0].getLastBucketPointer());
for (int i = 0; i < pBuckets[0].getDatas().length; i++) {
returnVal.setData(i, pBuckets[0].getData(i)); // depends on control dependency: [for], data = [i]
}
return returnVal;
} } |
public class class_name {
@Override
public IComplexNDArray subi(INDArray other, INDArray result) {
IComplexNDArray cOther = (IComplexNDArray) other;
IComplexNDArray cResult = (IComplexNDArray) result;
if (other.isScalar())
return subi(cOther.getComplex(0), result);
if (result == this)
Nd4j.getBlasWrapper().axpy(Nd4j.NEG_UNIT, cOther, cResult);
else if (result == other) {
if (data.dataType() == (DataBuffer.Type.DOUBLE)) {
Nd4j.getBlasWrapper().scal(Nd4j.NEG_UNIT.asDouble(), cResult);
Nd4j.getBlasWrapper().axpy(Nd4j.UNIT, this, cResult);
} else {
Nd4j.getBlasWrapper().scal(Nd4j.NEG_UNIT.asFloat(), cResult);
Nd4j.getBlasWrapper().axpy(Nd4j.UNIT, this, cResult);
}
} else {
Nd4j.getBlasWrapper().copy(this, result);
Nd4j.getBlasWrapper().axpy(Nd4j.NEG_UNIT, cOther, cResult);
}
return cResult;
} } | public class class_name {
@Override
public IComplexNDArray subi(INDArray other, INDArray result) {
IComplexNDArray cOther = (IComplexNDArray) other;
IComplexNDArray cResult = (IComplexNDArray) result;
if (other.isScalar())
return subi(cOther.getComplex(0), result);
if (result == this)
Nd4j.getBlasWrapper().axpy(Nd4j.NEG_UNIT, cOther, cResult);
else if (result == other) {
if (data.dataType() == (DataBuffer.Type.DOUBLE)) {
Nd4j.getBlasWrapper().scal(Nd4j.NEG_UNIT.asDouble(), cResult); // depends on control dependency: [if], data = [none]
Nd4j.getBlasWrapper().axpy(Nd4j.UNIT, this, cResult); // depends on control dependency: [if], data = [none]
} else {
Nd4j.getBlasWrapper().scal(Nd4j.NEG_UNIT.asFloat(), cResult); // depends on control dependency: [if], data = [none]
Nd4j.getBlasWrapper().axpy(Nd4j.UNIT, this, cResult); // depends on control dependency: [if], data = [none]
}
} else {
Nd4j.getBlasWrapper().copy(this, result); // depends on control dependency: [if], data = [none]
Nd4j.getBlasWrapper().axpy(Nd4j.NEG_UNIT, cOther, cResult); // depends on control dependency: [if], data = [none]
}
return cResult;
} } |
public class class_name {
public EList<Parameter> getParameters() {
if (parameters == null) {
parameters = new EObjectContainmentEList<Parameter>(Parameter.class, this, XtextPackage.PARSER_RULE__PARAMETERS);
}
return parameters;
} } | public class class_name {
public EList<Parameter> getParameters() {
if (parameters == null) {
parameters = new EObjectContainmentEList<Parameter>(Parameter.class, this, XtextPackage.PARSER_RULE__PARAMETERS); // depends on control dependency: [if], data = [none]
}
return parameters;
} } |
public class class_name {
private Object getTargetObject(Object target) {
Data targetData;
if (target instanceof Portable) {
targetData = ss.toData(target);
if (targetData.isPortable()) {
return targetData;
}
}
if (target instanceof Data) {
targetData = (Data) target;
if (targetData.isPortable() || targetData.isJson()) {
return targetData;
} else {
// convert non-portable Data to object
return ss.toObject(target);
}
}
return target;
} } | public class class_name {
private Object getTargetObject(Object target) {
Data targetData;
if (target instanceof Portable) {
targetData = ss.toData(target); // depends on control dependency: [if], data = [none]
if (targetData.isPortable()) {
return targetData; // depends on control dependency: [if], data = [none]
}
}
if (target instanceof Data) {
targetData = (Data) target; // depends on control dependency: [if], data = [none]
if (targetData.isPortable() || targetData.isJson()) {
return targetData; // depends on control dependency: [if], data = [none]
} else {
// convert non-portable Data to object
return ss.toObject(target); // depends on control dependency: [if], data = [none]
}
}
return target;
} } |
public class class_name {
private double fillInterpolatedValues(InterpolationType interpolationType) {
double interpolatedValue = 0;
if (shouldDoInterpolation(true)) {
double y1 = values[indexToInterpolate];
if (current == indexToInterpolate) {
return y1;
}
long x = timestamps[current];
long x1 = timestamps[indexToInterpolate];
if (x == x1) {
return y1;
}
int next = indexToInterpolate + iterators.length;
double y2 = values[next];
long x2 = timestamps[next];
if (x == x2) {
return y2;
}
switch(interpolationType){
case LININT:
interpolatedValue = (y2 - y1) / (x2 - x1) * (x - x1) + y1;
break;
case ZIMSUM:
interpolatedValue = 0;
break;
default:
throw new IllegalArgumentException("Invalid interpolation type specified");
}
}
return interpolatedValue;
} } | public class class_name {
private double fillInterpolatedValues(InterpolationType interpolationType) {
double interpolatedValue = 0;
if (shouldDoInterpolation(true)) {
double y1 = values[indexToInterpolate];
if (current == indexToInterpolate) {
return y1; // depends on control dependency: [if], data = [none]
}
long x = timestamps[current];
long x1 = timestamps[indexToInterpolate];
if (x == x1) {
return y1; // depends on control dependency: [if], data = [none]
}
int next = indexToInterpolate + iterators.length;
double y2 = values[next];
long x2 = timestamps[next];
if (x == x2) {
return y2; // depends on control dependency: [if], data = [none]
}
switch(interpolationType){
case LININT:
interpolatedValue = (y2 - y1) / (x2 - x1) * (x - x1) + y1;
break;
case ZIMSUM:
interpolatedValue = 0;
break;
default:
throw new IllegalArgumentException("Invalid interpolation type specified");
}
}
return interpolatedValue;
} } |
public class class_name {
private void touchTableModel(final TableModel tableModel) {
for (int row = 0; row < tableModel.getRowCount(); row++) {
for (int col = 0; col < tableModel.getColumnCount(); col++) {
tableModel.getValueAt(row, col);
}
}
} } | public class class_name {
private void touchTableModel(final TableModel tableModel) {
for (int row = 0; row < tableModel.getRowCount(); row++) {
for (int col = 0; col < tableModel.getColumnCount(); col++) {
tableModel.getValueAt(row, col); // depends on control dependency: [for], data = [col]
}
}
} } |
public class class_name {
public static TimeZone resolveTimeZone(Object timeZone) {
if (timeZone instanceof String) {
return TimeZone.getTimeZone((String) timeZone);
}
else if (timeZone instanceof TimeZone) {
return (TimeZone) timeZone;
}
else {
return TimeZone.getDefault();
}
} } | public class class_name {
public static TimeZone resolveTimeZone(Object timeZone) {
if (timeZone instanceof String) {
return TimeZone.getTimeZone((String) timeZone); // depends on control dependency: [if], data = [none]
}
else if (timeZone instanceof TimeZone) {
return (TimeZone) timeZone; // depends on control dependency: [if], data = [none]
}
else {
return TimeZone.getDefault(); // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.