code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
@Nullable
public <T> T get(Key<T> key) {
for (int i = size - 1; i >= 0; i--) {
if (bytesEqual(key.asciiName(), name(i))) {
return key.parseBytes(value(i));
}
}
return null;
} } | public class class_name {
@Nullable
public <T> T get(Key<T> key) {
for (int i = size - 1; i >= 0; i--) {
if (bytesEqual(key.asciiName(), name(i))) {
return key.parseBytes(value(i)); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
public void releaseAcquiredTrigger(final OperableTrigger trigger) {
try {
doWithLock(new LockCallbackWithoutResult() {
@Override
public Void doWithLock(JedisCommands jedis) throws JobPersistenceException {
storage.releaseAcquiredTrigger(trigger, jedis);
return null;
}
}, "Could not release acquired trigger.");
} catch (JobPersistenceException e) {
logger.error("Could not release acquired trigger.", e);
}
} } | public class class_name {
@Override
public void releaseAcquiredTrigger(final OperableTrigger trigger) {
try {
doWithLock(new LockCallbackWithoutResult() {
@Override
public Void doWithLock(JedisCommands jedis) throws JobPersistenceException {
storage.releaseAcquiredTrigger(trigger, jedis);
return null;
}
}, "Could not release acquired trigger."); // depends on control dependency: [try], data = [none]
} catch (JobPersistenceException e) {
logger.error("Could not release acquired trigger.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void useResource(String host, int port, String user, String password, Authentication authType)
throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
{
// create the client
DatabaseClient client = DatabaseClientFactory.newClient(host, port, user, password, authType);
// create the resource extension client
DictionaryManager dictionaryMgr = new DictionaryManager(client);
// specify the identifier for the dictionary
String uri = "/example/metasyn.xml";
// create the dictionary
String[] words = {
"foo", "bar", "baz", "qux", "quux", "wibble", "wobble", "wubble"
};
dictionaryMgr.createDictionary(uri, words);
System.out.println("Created a dictionary on the server at "+uri);
// check the validity of the dictionary
Document[] list = dictionaryMgr.checkDictionaries(uri);
if (list == null || list.length == 0)
System.out.println("Could not check the validity of the dictionary at "+uri);
else
System.out.println(
"Checked the validity of the dictionary at "+uri+": "+
!"invalid".equals(list[0].getDocumentElement().getNodeName())
);
dictionaryMgr.getMimetype(uri);
// use a resource service to check the correctness of a word
String word = "biz";
if (!dictionaryMgr.isCorrect(word, uri)) {
System.out.println("Confirmed that '"+word+"' is not in the dictionary at "+uri);
// use a resource service to look up suggestions
String[] suggestions = dictionaryMgr.suggest(word, null, null, uri);
System.out.println("Nearest matches for '"+word+"' in the dictionary at "+uri);
for (String suggestion: suggestions) {
System.out.println(" "+suggestion);
}
}
// delete the dictionary
dictionaryMgr.deleteDictionary(uri);
// release the client
client.release();
} } | public class class_name {
public static void useResource(String host, int port, String user, String password, Authentication authType)
throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
{
// create the client
DatabaseClient client = DatabaseClientFactory.newClient(host, port, user, password, authType);
// create the resource extension client
DictionaryManager dictionaryMgr = new DictionaryManager(client);
// specify the identifier for the dictionary
String uri = "/example/metasyn.xml";
// create the dictionary
String[] words = {
"foo", "bar", "baz", "qux", "quux", "wibble", "wobble", "wubble"
};
dictionaryMgr.createDictionary(uri, words);
System.out.println("Created a dictionary on the server at "+uri);
// check the validity of the dictionary
Document[] list = dictionaryMgr.checkDictionaries(uri);
if (list == null || list.length == 0)
System.out.println("Could not check the validity of the dictionary at "+uri);
else
System.out.println(
"Checked the validity of the dictionary at "+uri+": "+
!"invalid".equals(list[0].getDocumentElement().getNodeName())
);
dictionaryMgr.getMimetype(uri);
// use a resource service to check the correctness of a word
String word = "biz";
if (!dictionaryMgr.isCorrect(word, uri)) {
System.out.println("Confirmed that '"+word+"' is not in the dictionary at "+uri);
// use a resource service to look up suggestions
String[] suggestions = dictionaryMgr.suggest(word, null, null, uri);
System.out.println("Nearest matches for '"+word+"' in the dictionary at "+uri);
for (String suggestion: suggestions) {
System.out.println(" "+suggestion); // depends on control dependency: [for], data = [suggestion]
}
}
// delete the dictionary
dictionaryMgr.deleteDictionary(uri);
// release the client
client.release();
} } |
public class class_name {
public void attribute(Writer out, String name, String value, char quotationMark, boolean escapeAmpersands) throws NullPointerException, IOException {
char[] ch = value.toCharArray();
int length = ch.length;
int start = 0;
int end = start + length;
// TODO: Call overloaded attribute method that accepts char[]
// The position after the last escaped character
int lastEscaped = 0;
boolean useQuote;
if (quotationMark == '"') {
useQuote = true;
} else if (quotationMark == '\'') {
useQuote = false;
} else {
String error = "Character 0x" + Integer.toHexString(quotationMark) + " ('" + quotationMark + "') is not a valid quotation mark.";
throw new IllegalArgumentException(error);
}
out.write(' ');
out.write(name);
if (useQuote) {
out.write(EQUALS_QUOTE, 0, 2);
} else {
out.write(EQUALS_APOSTROPHE, 0, 2);
}
for (int i = start; i < end; i++) {
int c = ch[i];
if (c >= 63 && c <= 127 || c >= 40 && c <= 59 || c >= 32 && c <= 37 && c != 34 || c == 38 && !escapeAmpersands || c > 127 && !_sevenBitEncoding || !useQuote && c == 34 || useQuote && c == 39 || c == 10 || c == 13 || c == 61 || c == 9) {
continue;
} else {
out.write(ch, lastEscaped, i - lastEscaped);
if (c == 60) {
out.write(ESC_LESS_THAN, 0, 4);
} else if (c == 62) {
out.write(ESC_GREATER_THAN, 0, 4);
} else if (c == 34) {
out.write(ESC_QUOTE, 0, 6);
} else if (c == 39) {
out.write(ESC_APOSTROPHE, 0, 6);
} else if (c == 38) {
out.write(ESC_AMPERSAND, 0, 5);
} else if (c > 127) {
out.write(AMPERSAND_HASH, 0, 2);
out.write(Integer.toString(c));
out.write(';');
} else {
throw new InvalidXMLException("The character 0x" + Integer.toHexString(c) + " is not valid.");
}
lastEscaped = i + 1;
}
}
out.write(ch, lastEscaped, length - lastEscaped);
out.write(quotationMark);
} } | public class class_name {
public void attribute(Writer out, String name, String value, char quotationMark, boolean escapeAmpersands) throws NullPointerException, IOException {
char[] ch = value.toCharArray();
int length = ch.length;
int start = 0;
int end = start + length;
// TODO: Call overloaded attribute method that accepts char[]
// The position after the last escaped character
int lastEscaped = 0;
boolean useQuote;
if (quotationMark == '"') {
useQuote = true;
} else if (quotationMark == '\'') {
useQuote = false;
} else {
String error = "Character 0x" + Integer.toHexString(quotationMark) + " ('" + quotationMark + "') is not a valid quotation mark.";
throw new IllegalArgumentException(error);
}
out.write(' ');
out.write(name);
if (useQuote) {
out.write(EQUALS_QUOTE, 0, 2);
} else {
out.write(EQUALS_APOSTROPHE, 0, 2);
}
for (int i = start; i < end; i++) {
int c = ch[i];
if (c >= 63 && c <= 127 || c >= 40 && c <= 59 || c >= 32 && c <= 37 && c != 34 || c == 38 && !escapeAmpersands || c > 127 && !_sevenBitEncoding || !useQuote && c == 34 || useQuote && c == 39 || c == 10 || c == 13 || c == 61 || c == 9) {
continue;
} else {
out.write(ch, lastEscaped, i - lastEscaped);
if (c == 60) {
out.write(ESC_LESS_THAN, 0, 4); // depends on control dependency: [if], data = [none]
} else if (c == 62) {
out.write(ESC_GREATER_THAN, 0, 4); // depends on control dependency: [if], data = [none]
} else if (c == 34) {
out.write(ESC_QUOTE, 0, 6); // depends on control dependency: [if], data = [none]
} else if (c == 39) {
out.write(ESC_APOSTROPHE, 0, 6); // depends on control dependency: [if], data = [none]
} else if (c == 38) {
out.write(ESC_AMPERSAND, 0, 5); // depends on control dependency: [if], data = [none]
} else if (c > 127) {
out.write(AMPERSAND_HASH, 0, 2); // depends on control dependency: [if], data = [none]
out.write(Integer.toString(c)); // depends on control dependency: [if], data = [(c]
out.write(';'); // depends on control dependency: [if], data = [none]
} else {
throw new InvalidXMLException("The character 0x" + Integer.toHexString(c) + " is not valid.");
}
lastEscaped = i + 1;
}
}
out.write(ch, lastEscaped, length - lastEscaped);
out.write(quotationMark);
} } |
public class class_name {
public Branch setWhiteListedSchemes(List<String> urlWhiteListPatternList) {
if (urlWhiteListPatternList != null) {
UniversalResourceAnalyser.getInstance(context_).addToAcceptURLFormats(urlWhiteListPatternList);
}
return this;
} } | public class class_name {
public Branch setWhiteListedSchemes(List<String> urlWhiteListPatternList) {
if (urlWhiteListPatternList != null) {
UniversalResourceAnalyser.getInstance(context_).addToAcceptURLFormats(urlWhiteListPatternList); // depends on control dependency: [if], data = [(urlWhiteListPatternList]
}
return this;
} } |
public class class_name {
private void _buildProjection(
final Projection p,
final StringBuilder stmt
)
{
if (p instanceof Aggregation) {
Aggregation aggr = (Aggregation)p;
stmt.append( aggr.getFunction().name() );
stmt.append( "(" );
String expr = aggr.getExpression();
if (Aggregation.WHOLE_OBJECT_EXPRESSION.equals( expr )) {
stmt.append( expr );
} else {
_buildProperty( expr, stmt );
//throws SearchException
}
stmt.append( ")" );
} else if (p instanceof PropertyProjection) {
PropertyProjection pp = (PropertyProjection)p;
_buildProperty( pp.getProperty(), stmt );
//throws SearchException
} else {
throw new IllegalArgumentException( "unsupported projection: " + p );
}
} } | public class class_name {
private void _buildProjection(
final Projection p,
final StringBuilder stmt
)
{
if (p instanceof Aggregation) {
Aggregation aggr = (Aggregation)p;
stmt.append( aggr.getFunction().name() ); // depends on control dependency: [if], data = [none]
stmt.append( "(" ); // depends on control dependency: [if], data = [none]
String expr = aggr.getExpression();
if (Aggregation.WHOLE_OBJECT_EXPRESSION.equals( expr )) {
stmt.append( expr ); // depends on control dependency: [if], data = [none]
} else {
_buildProperty( expr, stmt ); // depends on control dependency: [if], data = [none]
//throws SearchException
}
stmt.append( ")" ); // depends on control dependency: [if], data = [none]
} else if (p instanceof PropertyProjection) {
PropertyProjection pp = (PropertyProjection)p;
_buildProperty( pp.getProperty(), stmt ); // depends on control dependency: [if], data = [none]
//throws SearchException
} else {
throw new IllegalArgumentException( "unsupported projection: " + p );
}
} } |
public class class_name {
private static void prepareConnection(URLConnection connection, int timeout, SSLSocketFactory sslFactory) {
if (timeout == 0) {
throw new IllegalArgumentException("Zero (infinite) timeouts not permitted");
}
connection.setConnectTimeout(timeout);
connection.setReadTimeout(timeout);
connection.setDoInput(true); // whether we want to read from the connection
connection.setDoOutput(false); // whether we want to write to the connection
if(connection instanceof HttpsURLConnection && sslFactory != null) {
((HttpsURLConnection)connection).setSSLSocketFactory(sslFactory);
}
} } | public class class_name {
private static void prepareConnection(URLConnection connection, int timeout, SSLSocketFactory sslFactory) {
if (timeout == 0) {
throw new IllegalArgumentException("Zero (infinite) timeouts not permitted");
}
connection.setConnectTimeout(timeout);
connection.setReadTimeout(timeout);
connection.setDoInput(true); // whether we want to read from the connection
connection.setDoOutput(false); // whether we want to write to the connection
if(connection instanceof HttpsURLConnection && sslFactory != null) {
((HttpsURLConnection)connection).setSSLSocketFactory(sslFactory); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void deleteSeen(SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException,
SIErrorException, SIMPMessageNotLockedException
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.entry(CoreSPILockedMessageEnumeration.tc, "deleteSeen",
new Object[] {new Integer(hashCode()), transaction, this});
checkValidState("deleteSeen");
localConsumerPoint.checkNotClosed();
if (transaction != null && !((TransactionCommon)transaction).isAlive())
{
SIIncorrectCallException e = new SIIncorrectCallException( nls.getFormattedMessage(
"TRANSACTION_DELETE_USAGE_ERROR_CWSIP0778",
new Object[] { consumerSession.getDestinationAddress() },
null) );
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.exit(CoreSPILockedMessageEnumeration.tc, "deleteSeen", e);
throw e;
}
// if ordered, check that the provided tran is the current tran
if (localConsumerPoint.getConsumerManager().getDestination().isOrdered() &&
!localConsumerPoint.getConsumerManager().isNewTransactionAllowed((TransactionCommon) transaction))
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.exit(CoreSPILockedMessageEnumeration.tc, "deleteSeen", "Ordering error - Transaction active");
throw new SIIncorrectCallException(
nls.getFormattedMessage("ORDERED_MESSAGING_ERROR_CWSIP0194",
new Object[] { localConsumerPoint.getConsumerManager().getDestination().getName(),
localConsumerPoint.getConsumerManager().getMessageProcessor().getMessagingEngineName()},
null));
}
LocalTransaction localTransaction = null;
int deletedActiveMessages = 0;
SIMPMessageNotLockedException notLockedException = null;
int notLockedExceptionMessageIndex = 0;
synchronized(this)
{
if(currentUnlockedMessage != null)
{
removeMessage(currentUnlockedMessage);
currentUnlockedMessage = null;
}
messageAvailable = false;
if(firstMsg != null)
{
// Make the array atleast the size of the number of locked msgs
SIMessageHandle[] messageHandles = new SIMessageHandle[getNumberOfLockedMessages()];
LMEMessage pointerMsg = firstMsg;
LMEMessage removedMsg;
LMEMessage endMsg;
// There are two reasons for the currentMsg to be null, either it hasn't
// been used jet and therefore nothing has been 'seen' so nothing for us
// to do or it's moved off the end of the list in which case we delete
// the whole list
if((currentMsg == null) && endReached)
endMsg = lastMsg;
else
endMsg = currentMsg;
if(endMsg != null)
{
TransactionCommon tranImpl = (TransactionCommon)transaction;
boolean more = true;
if(tranImpl != null)
tranImpl.registerCallback(pointerMsg.message);
while(more)
{
if(pointerMsg == endMsg)
more = false;
// If the message is in the MS we need to remove it
if(pointerMsg.isStored)
{
// Create a local tran if we weren't given one
if(tranImpl == null)
{
localTransaction = txManager.createLocalTransaction(!isRMQ());
tranImpl = localTransaction;
tranImpl.registerCallback(pointerMsg.message);
}
try
{
removeMessageFromStore(pointerMsg.message,
tranImpl,
true); // true = decrement active message count (on commit)
}
catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// See defect 387591
// We should only get this exception if the message was deleted via
// the controllable objects i.e. the admin console. If we are here for
// another reason that we have a real error.
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
"1:1081:1.154.3.1",
e });
// Place the problem messagehandle in the array
messageHandles[notLockedExceptionMessageIndex] = pointerMsg.getJsMessage().getMessageHandle();
notLockedExceptionMessageIndex++;
notLockedException = e;
// Because we couldn't do the remove we wouldn't get the callback on the
// afterCompletion to removeActiveMessages so we should do it here now
if (localTransaction != null)
deletedActiveMessages++;
}
}
// If the message wasn't stored we need to decrement the count now, but we can't
// while we hold the LME lock.
else
deletedActiveMessages++;
removedMsg = pointerMsg;
pointerMsg = pointerMsg.next;
removeMessage(removedMsg);
}
}
}
} // synchronized
// Now we've released the lock we can decrement the active message count (which
// may resume the consumer)
if(deletedActiveMessages != 0)
localConsumerPoint.removeActiveMessages(deletedActiveMessages);
// Commit outside of the lock - it may be expensive and we may need other locks
// if we fail and events are driven on the messages
if(localTransaction != null)
{
localTransaction.commit();
}
if (notLockedException != null)
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.exit(CoreSPILockedMessageEnumeration.tc, "deleteSeen", this);
throw notLockedException;
}
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.exit(CoreSPILockedMessageEnumeration.tc, "deleteSeen", this);
} } | public class class_name {
public void deleteSeen(SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException,
SIErrorException, SIMPMessageNotLockedException
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.entry(CoreSPILockedMessageEnumeration.tc, "deleteSeen",
new Object[] {new Integer(hashCode()), transaction, this});
checkValidState("deleteSeen");
localConsumerPoint.checkNotClosed();
if (transaction != null && !((TransactionCommon)transaction).isAlive())
{
SIIncorrectCallException e = new SIIncorrectCallException( nls.getFormattedMessage(
"TRANSACTION_DELETE_USAGE_ERROR_CWSIP0778",
new Object[] { consumerSession.getDestinationAddress() },
null) );
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.exit(CoreSPILockedMessageEnumeration.tc, "deleteSeen", e);
throw e;
}
// if ordered, check that the provided tran is the current tran
if (localConsumerPoint.getConsumerManager().getDestination().isOrdered() &&
!localConsumerPoint.getConsumerManager().isNewTransactionAllowed((TransactionCommon) transaction))
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.exit(CoreSPILockedMessageEnumeration.tc, "deleteSeen", "Ordering error - Transaction active");
throw new SIIncorrectCallException(
nls.getFormattedMessage("ORDERED_MESSAGING_ERROR_CWSIP0194",
new Object[] { localConsumerPoint.getConsumerManager().getDestination().getName(),
localConsumerPoint.getConsumerManager().getMessageProcessor().getMessagingEngineName()},
null));
}
LocalTransaction localTransaction = null;
int deletedActiveMessages = 0;
SIMPMessageNotLockedException notLockedException = null;
int notLockedExceptionMessageIndex = 0;
synchronized(this)
{
if(currentUnlockedMessage != null)
{
removeMessage(currentUnlockedMessage); // depends on control dependency: [if], data = [(currentUnlockedMessage]
currentUnlockedMessage = null; // depends on control dependency: [if], data = [none]
}
messageAvailable = false;
if(firstMsg != null)
{
// Make the array atleast the size of the number of locked msgs
SIMessageHandle[] messageHandles = new SIMessageHandle[getNumberOfLockedMessages()];
LMEMessage pointerMsg = firstMsg;
LMEMessage removedMsg;
LMEMessage endMsg;
// There are two reasons for the currentMsg to be null, either it hasn't
// been used jet and therefore nothing has been 'seen' so nothing for us
// to do or it's moved off the end of the list in which case we delete
// the whole list
if((currentMsg == null) && endReached)
endMsg = lastMsg;
else
endMsg = currentMsg;
if(endMsg != null)
{
TransactionCommon tranImpl = (TransactionCommon)transaction;
boolean more = true;
if(tranImpl != null)
tranImpl.registerCallback(pointerMsg.message);
while(more)
{
if(pointerMsg == endMsg)
more = false;
// If the message is in the MS we need to remove it
if(pointerMsg.isStored)
{
// Create a local tran if we weren't given one
if(tranImpl == null)
{
localTransaction = txManager.createLocalTransaction(!isRMQ()); // depends on control dependency: [if], data = [none]
tranImpl = localTransaction; // depends on control dependency: [if], data = [none]
tranImpl.registerCallback(pointerMsg.message); // depends on control dependency: [if], data = [none]
}
try
{
removeMessageFromStore(pointerMsg.message,
tranImpl,
true); // true = decrement active message count (on commit) // depends on control dependency: [try], data = [none]
}
catch (SIMPMessageNotLockedException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
// See defect 387591
// We should only get this exception if the message was deleted via
// the controllable objects i.e. the admin console. If we are here for
// another reason that we have a real error.
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.impl.AbstractLockedMessageEnumeration",
"1:1081:1.154.3.1",
e });
// Place the problem messagehandle in the array
messageHandles[notLockedExceptionMessageIndex] = pointerMsg.getJsMessage().getMessageHandle();
notLockedExceptionMessageIndex++;
notLockedException = e;
// Because we couldn't do the remove we wouldn't get the callback on the
// afterCompletion to removeActiveMessages so we should do it here now
if (localTransaction != null)
deletedActiveMessages++;
} // depends on control dependency: [catch], data = [none]
}
// If the message wasn't stored we need to decrement the count now, but we can't
// while we hold the LME lock.
else
deletedActiveMessages++;
removedMsg = pointerMsg; // depends on control dependency: [while], data = [none]
pointerMsg = pointerMsg.next; // depends on control dependency: [while], data = [none]
removeMessage(removedMsg); // depends on control dependency: [while], data = [none]
}
}
}
} // synchronized
// Now we've released the lock we can decrement the active message count (which
// may resume the consumer)
if(deletedActiveMessages != 0)
localConsumerPoint.removeActiveMessages(deletedActiveMessages);
// Commit outside of the lock - it may be expensive and we may need other locks
// if we fail and events are driven on the messages
if(localTransaction != null)
{
localTransaction.commit();
}
if (notLockedException != null)
{
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.exit(CoreSPILockedMessageEnumeration.tc, "deleteSeen", this);
throw notLockedException;
}
if (TraceComponent.isAnyTracingEnabled() && CoreSPILockedMessageEnumeration.tc.isEntryEnabled())
SibTr.exit(CoreSPILockedMessageEnumeration.tc, "deleteSeen", this);
} } |
public class class_name {
public void marshall(CustomKeyStoresListEntry customKeyStoresListEntry, ProtocolMarshaller protocolMarshaller) {
if (customKeyStoresListEntry == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(customKeyStoresListEntry.getCustomKeyStoreId(), CUSTOMKEYSTOREID_BINDING);
protocolMarshaller.marshall(customKeyStoresListEntry.getCustomKeyStoreName(), CUSTOMKEYSTORENAME_BINDING);
protocolMarshaller.marshall(customKeyStoresListEntry.getCloudHsmClusterId(), CLOUDHSMCLUSTERID_BINDING);
protocolMarshaller.marshall(customKeyStoresListEntry.getTrustAnchorCertificate(), TRUSTANCHORCERTIFICATE_BINDING);
protocolMarshaller.marshall(customKeyStoresListEntry.getConnectionState(), CONNECTIONSTATE_BINDING);
protocolMarshaller.marshall(customKeyStoresListEntry.getConnectionErrorCode(), CONNECTIONERRORCODE_BINDING);
protocolMarshaller.marshall(customKeyStoresListEntry.getCreationDate(), CREATIONDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CustomKeyStoresListEntry customKeyStoresListEntry, ProtocolMarshaller protocolMarshaller) {
if (customKeyStoresListEntry == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(customKeyStoresListEntry.getCustomKeyStoreId(), CUSTOMKEYSTOREID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(customKeyStoresListEntry.getCustomKeyStoreName(), CUSTOMKEYSTORENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(customKeyStoresListEntry.getCloudHsmClusterId(), CLOUDHSMCLUSTERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(customKeyStoresListEntry.getTrustAnchorCertificate(), TRUSTANCHORCERTIFICATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(customKeyStoresListEntry.getConnectionState(), CONNECTIONSTATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(customKeyStoresListEntry.getConnectionErrorCode(), CONNECTIONERRORCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(customKeyStoresListEntry.getCreationDate(), CREATIONDATE_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 GroupDetail withGroupPolicyList(PolicyDetail... groupPolicyList) {
if (this.groupPolicyList == null) {
setGroupPolicyList(new com.amazonaws.internal.SdkInternalList<PolicyDetail>(groupPolicyList.length));
}
for (PolicyDetail ele : groupPolicyList) {
this.groupPolicyList.add(ele);
}
return this;
} } | public class class_name {
public GroupDetail withGroupPolicyList(PolicyDetail... groupPolicyList) {
if (this.groupPolicyList == null) {
setGroupPolicyList(new com.amazonaws.internal.SdkInternalList<PolicyDetail>(groupPolicyList.length)); // depends on control dependency: [if], data = [none]
}
for (PolicyDetail ele : groupPolicyList) {
this.groupPolicyList.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static VatIdMapSharedConstants create() {
if (vatIdMapConstants == null) { // NOPMD it's thread save!
synchronized (VatIdMapConstants.class) {
if (vatIdMapConstants == null) {
vatIdMapConstants = GWT.create(VatIdMapConstants.class);
}
}
}
return vatIdMapConstants;
} } | public class class_name {
public static VatIdMapSharedConstants create() {
if (vatIdMapConstants == null) { // NOPMD it's thread save!
synchronized (VatIdMapConstants.class) { // depends on control dependency: [if], data = [none]
if (vatIdMapConstants == null) {
vatIdMapConstants = GWT.create(VatIdMapConstants.class); // depends on control dependency: [if], data = [none]
}
}
}
return vatIdMapConstants;
} } |
public class class_name {
String[] getCommandLine() {
List<String> args = new ArrayList<>();
if (executable != null) {
args.add(executable);
}
for (int i = 0; i < arguments.size(); i++) {
CommandArgument argument = arguments.get(i);
args.add(argument.forCommandLine());
}
return args.toArray(new String[args.size()]);
} } | public class class_name {
String[] getCommandLine() {
List<String> args = new ArrayList<>();
if (executable != null) {
args.add(executable); // depends on control dependency: [if], data = [(executable]
}
for (int i = 0; i < arguments.size(); i++) {
CommandArgument argument = arguments.get(i);
args.add(argument.forCommandLine()); // depends on control dependency: [for], data = [none]
}
return args.toArray(new String[args.size()]);
} } |
public class class_name {
public List<String> getSpoutNames(PhysicalPlan pp) {
TopologyAPI.Topology localTopology = pp.getTopology();
ArrayList<String> spoutNames = new ArrayList<>();
for (TopologyAPI.Spout spout : localTopology.getSpoutsList()) {
spoutNames.add(spout.getComp().getName());
}
return spoutNames;
} } | public class class_name {
public List<String> getSpoutNames(PhysicalPlan pp) {
TopologyAPI.Topology localTopology = pp.getTopology();
ArrayList<String> spoutNames = new ArrayList<>();
for (TopologyAPI.Spout spout : localTopology.getSpoutsList()) {
spoutNames.add(spout.getComp().getName()); // depends on control dependency: [for], data = [spout]
}
return spoutNames;
} } |
public class class_name {
JavaFileObject printSource(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
JavaFileObject outFile
= fileManager.getJavaFileForOutput(CLASS_OUTPUT,
cdef.sym.flatname.toString(),
JavaFileObject.Kind.SOURCE,
null);
if (inputFiles.contains(outFile)) {
log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
return null;
} else {
BufferedWriter out = new BufferedWriter(outFile.openWriter());
try {
new Pretty(out, true).printUnit(env.toplevel, cdef);
if (verbose)
log.printVerbose("wrote.file", outFile);
} finally {
out.close();
}
return outFile;
}
} } | public class class_name {
JavaFileObject printSource(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
JavaFileObject outFile
= fileManager.getJavaFileForOutput(CLASS_OUTPUT,
cdef.sym.flatname.toString(),
JavaFileObject.Kind.SOURCE,
null);
if (inputFiles.contains(outFile)) {
log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
return null;
} else {
BufferedWriter out = new BufferedWriter(outFile.openWriter());
try {
new Pretty(out, true).printUnit(env.toplevel, cdef); // depends on control dependency: [try], data = [none]
if (verbose)
log.printVerbose("wrote.file", outFile);
} finally {
out.close();
}
return outFile;
}
} } |
public class class_name {
public Name getTemporaryName(Name originalName) {
LdapName temporaryName = LdapUtils.newLdapName(originalName);
// Add tempSuffix to the leaf node name.
try {
String leafNode = (String) temporaryName.remove(temporaryName.size() - 1);
temporaryName.add(new Rdn(leafNode + tempSuffix));
} catch (InvalidNameException e) {
throw new org.springframework.ldap.InvalidNameException(e);
}
return temporaryName;
} } | public class class_name {
public Name getTemporaryName(Name originalName) {
LdapName temporaryName = LdapUtils.newLdapName(originalName);
// Add tempSuffix to the leaf node name.
try {
String leafNode = (String) temporaryName.remove(temporaryName.size() - 1);
temporaryName.add(new Rdn(leafNode + tempSuffix));
// depends on control dependency: [try], data = [none]
} catch (InvalidNameException e) {
throw new org.springframework.ldap.InvalidNameException(e);
}
// depends on control dependency: [catch], data = [none]
return temporaryName;
} } |
public class class_name {
public CorsConfig build() {
if (preflightHeaders.isEmpty() && !noPreflightHeaders) {
preflightHeaders.put(HttpHeaderNames.DATE, DateValueGenerator.INSTANCE);
preflightHeaders.put(HttpHeaderNames.CONTENT_LENGTH, new ConstantValueGenerator("0"));
}
return new CorsConfig(this);
} } | public class class_name {
public CorsConfig build() {
if (preflightHeaders.isEmpty() && !noPreflightHeaders) {
preflightHeaders.put(HttpHeaderNames.DATE, DateValueGenerator.INSTANCE); // depends on control dependency: [if], data = [none]
preflightHeaders.put(HttpHeaderNames.CONTENT_LENGTH, new ConstantValueGenerator("0")); // depends on control dependency: [if], data = [none]
}
return new CorsConfig(this);
} } |
public class class_name {
@Override
public void setDateHeader(String hdr, long value) {
if (-1L == value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setDateHeader(" + hdr + ", -1), removing header");
}
this.response.removeHeader(hdr);
} else {
this.response.setHeader(hdr, connection.getDateFormatter().getRFC1123Time(new Date(value)));
}
} } | public class class_name {
@Override
public void setDateHeader(String hdr, long value) {
if (-1L == value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setDateHeader(" + hdr + ", -1), removing header"); // depends on control dependency: [if], data = [none]
}
this.response.removeHeader(hdr); // depends on control dependency: [if], data = [none]
} else {
this.response.setHeader(hdr, connection.getDateFormatter().getRFC1123Time(new Date(value))); // depends on control dependency: [if], data = [value)]
}
} } |
public class class_name {
@Override
public void fill(int fromIndex, int toIndex)
{
if (fromIndex > toIndex) {
throw new IndexOutOfBoundsException(
"fromIndex: " + fromIndex
+ " > toIndex: " + toIndex
);
}
if (fromIndex == toIndex) {
add(fromIndex);
return;
}
// Increase capacity if necessary
int startWordIndex = wordIndex(fromIndex);
int endWordIndex = wordIndex(toIndex);
expandTo(endWordIndex);
final int[] localWords = words; // faster
boolean modified = false;
int firstWordMask = ALL_ONES_WORD << fromIndex;
int lastWordMask = ALL_ONES_WORD >>> -(toIndex + 1);
if (startWordIndex == endWordIndex) {
// Case 1: One word
int before = localWords[startWordIndex];
localWords[startWordIndex] |= (firstWordMask & lastWordMask);
modified = localWords[startWordIndex] != before;
} else {
// Case 2: Multiple words
// Handle first word
int before = localWords[startWordIndex];
localWords[startWordIndex] |= firstWordMask;
modified = localWords[startWordIndex] != before;
// Handle intermediate words, if any
for (int i = startWordIndex + 1; i < endWordIndex; i++) {
modified = modified || localWords[i] != ALL_ONES_WORD;
localWords[i] = ALL_ONES_WORD;
}
// Handle last word
before = localWords[endWordIndex];
localWords[endWordIndex] |= lastWordMask;
modified = modified || localWords[endWordIndex] != before;
}
if (modified) {
size = -1;
}
} } | public class class_name {
@Override
public void fill(int fromIndex, int toIndex)
{
if (fromIndex > toIndex) {
throw new IndexOutOfBoundsException(
"fromIndex: " + fromIndex
+ " > toIndex: " + toIndex
);
}
if (fromIndex == toIndex) {
add(fromIndex);
// depends on control dependency: [if], data = [(fromIndex]
return;
// depends on control dependency: [if], data = [none]
}
// Increase capacity if necessary
int startWordIndex = wordIndex(fromIndex);
int endWordIndex = wordIndex(toIndex);
expandTo(endWordIndex);
final int[] localWords = words; // faster
boolean modified = false;
int firstWordMask = ALL_ONES_WORD << fromIndex;
int lastWordMask = ALL_ONES_WORD >>> -(toIndex + 1);
if (startWordIndex == endWordIndex) {
// Case 1: One word
int before = localWords[startWordIndex];
localWords[startWordIndex] |= (firstWordMask & lastWordMask);
// depends on control dependency: [if], data = [none]
modified = localWords[startWordIndex] != before;
// depends on control dependency: [if], data = [none]
} else {
// Case 2: Multiple words
// Handle first word
int before = localWords[startWordIndex];
localWords[startWordIndex] |= firstWordMask;
// depends on control dependency: [if], data = [none]
modified = localWords[startWordIndex] != before;
// depends on control dependency: [if], data = [none]
// Handle intermediate words, if any
for (int i = startWordIndex + 1; i < endWordIndex; i++) {
modified = modified || localWords[i] != ALL_ONES_WORD;
// depends on control dependency: [for], data = [i]
localWords[i] = ALL_ONES_WORD;
// depends on control dependency: [for], data = [i]
}
// Handle last word
before = localWords[endWordIndex];
// depends on control dependency: [if], data = [none]
localWords[endWordIndex] |= lastWordMask;
// depends on control dependency: [if], data = [none]
modified = modified || localWords[endWordIndex] != before;
// depends on control dependency: [if], data = [none]
}
if (modified) {
size = -1;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static Comparator<RepositoryResource> byMaxDistance(final Map<String, Integer> maxDistanceMap) {
return new Comparator<RepositoryResource>() {
@Override
public int compare(RepositoryResource o1, RepositoryResource o2) {
return Integer.compare(getDistance(o2), getDistance(o1));
}
private int getDistance(RepositoryResource res) {
if (res.getType() == ResourceType.FEATURE) {
Integer distance = maxDistanceMap.get(((EsaResource) res).getProvideFeature());
return distance == null ? 0 : distance;
} else {
return 0;
}
}
};
} } | public class class_name {
static Comparator<RepositoryResource> byMaxDistance(final Map<String, Integer> maxDistanceMap) {
return new Comparator<RepositoryResource>() {
@Override
public int compare(RepositoryResource o1, RepositoryResource o2) {
return Integer.compare(getDistance(o2), getDistance(o1));
}
private int getDistance(RepositoryResource res) {
if (res.getType() == ResourceType.FEATURE) {
Integer distance = maxDistanceMap.get(((EsaResource) res).getProvideFeature());
return distance == null ? 0 : distance; // depends on control dependency: [if], data = [none]
} else {
return 0; // depends on control dependency: [if], data = [none]
}
}
};
} } |
public class class_name {
public HttpChallengeFactory lookup(String authScheme) {
HttpChallengeFactory result;
if (authScheme == null) return null;
result = challengeFactoriesByAuthScheme.get(authScheme);
if (result == null) {
if (authScheme.startsWith(AUTH_SCHEME_APPLICATION_PREFIX)) {
authScheme = authScheme.replaceFirst(AUTH_SCHEME_APPLICATION_PREFIX, "");
}
result = challengeFactoriesByAuthScheme.get(authScheme);
}
return result;
} } | public class class_name {
public HttpChallengeFactory lookup(String authScheme) {
HttpChallengeFactory result;
if (authScheme == null) return null;
result = challengeFactoriesByAuthScheme.get(authScheme);
if (result == null) {
if (authScheme.startsWith(AUTH_SCHEME_APPLICATION_PREFIX)) {
authScheme = authScheme.replaceFirst(AUTH_SCHEME_APPLICATION_PREFIX, ""); // depends on control dependency: [if], data = [none]
}
result = challengeFactoriesByAuthScheme.get(authScheme); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static Provider[] getProviders(Map<String,String> filter) {
// Get all installed providers first.
// Then only return those providers who satisfy the selection criteria.
Provider[] allProviders = Security.getProviders();
Set<String> keySet = filter.keySet();
LinkedHashSet<Provider> candidates = new LinkedHashSet<>(5);
// Returns all installed providers
// if the selection criteria is null.
if ((keySet == null) || (allProviders == null)) {
return allProviders;
}
boolean firstSearch = true;
// For each selection criterion, remove providers
// which don't satisfy the criterion from the candidate set.
for (Iterator<String> ite = keySet.iterator(); ite.hasNext(); ) {
String key = ite.next();
String value = filter.get(key);
LinkedHashSet<Provider> newCandidates = getAllQualifyingCandidates(key, value,
allProviders);
if (firstSearch) {
candidates = newCandidates;
firstSearch = false;
}
if ((newCandidates != null) && !newCandidates.isEmpty()) {
// For each provider in the candidates set, if it
// isn't in the newCandidate set, we should remove
// it from the candidate set.
for (Iterator<Provider> cansIte = candidates.iterator();
cansIte.hasNext(); ) {
Provider prov = cansIte.next();
if (!newCandidates.contains(prov)) {
cansIte.remove();
}
}
} else {
candidates = null;
break;
}
}
if ((candidates == null) || (candidates.isEmpty()))
return null;
Object[] candidatesArray = candidates.toArray();
Provider[] result = new Provider[candidatesArray.length];
for (int i = 0; i < result.length; i++) {
result[i] = (Provider)candidatesArray[i];
}
return result;
} } | public class class_name {
public static Provider[] getProviders(Map<String,String> filter) {
// Get all installed providers first.
// Then only return those providers who satisfy the selection criteria.
Provider[] allProviders = Security.getProviders();
Set<String> keySet = filter.keySet();
LinkedHashSet<Provider> candidates = new LinkedHashSet<>(5);
// Returns all installed providers
// if the selection criteria is null.
if ((keySet == null) || (allProviders == null)) {
return allProviders; // depends on control dependency: [if], data = [none]
}
boolean firstSearch = true;
// For each selection criterion, remove providers
// which don't satisfy the criterion from the candidate set.
for (Iterator<String> ite = keySet.iterator(); ite.hasNext(); ) {
String key = ite.next();
String value = filter.get(key);
LinkedHashSet<Provider> newCandidates = getAllQualifyingCandidates(key, value,
allProviders);
if (firstSearch) {
candidates = newCandidates; // depends on control dependency: [if], data = [none]
firstSearch = false; // depends on control dependency: [if], data = [none]
}
if ((newCandidates != null) && !newCandidates.isEmpty()) {
// For each provider in the candidates set, if it
// isn't in the newCandidate set, we should remove
// it from the candidate set.
for (Iterator<Provider> cansIte = candidates.iterator();
cansIte.hasNext(); ) {
Provider prov = cansIte.next();
if (!newCandidates.contains(prov)) {
cansIte.remove(); // depends on control dependency: [if], data = [none]
}
}
} else {
candidates = null; // depends on control dependency: [if], data = [none]
break;
}
}
if ((candidates == null) || (candidates.isEmpty()))
return null;
Object[] candidatesArray = candidates.toArray();
Provider[] result = new Provider[candidatesArray.length];
for (int i = 0; i < result.length; i++) {
result[i] = (Provider)candidatesArray[i]; // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
@Override
public void registerSynchronization(Synchronization sync) {
TransactionManager transactionManager = this.getTransactionManager();
try {
Transaction tran = transactionManager.getTransaction();
if (tran instanceof TransactionImpl) {
((TransactionImpl) tran).registerSynchronization(sync, RegisteredSyncs.SYNC_TIER_OUTER);
} else {
tran.registerSynchronization(sync);
}
} catch (SystemException se) {
FFDCFilter.processException(se, this.getClass().getName() + ".registerSynchronization", "177", this);
} catch (RollbackException re) {
FFDCFilter.processException(re, this.getClass().getName() + ".registerSynchronization", "180", this);
} catch (IllegalStateException ie) {
FFDCFilter.processException(ie, this.getClass().getName() + ".registerSynchronization", "182", this);
}
} } | public class class_name {
@Override
public void registerSynchronization(Synchronization sync) {
TransactionManager transactionManager = this.getTransactionManager();
try {
Transaction tran = transactionManager.getTransaction();
if (tran instanceof TransactionImpl) {
((TransactionImpl) tran).registerSynchronization(sync, RegisteredSyncs.SYNC_TIER_OUTER); // depends on control dependency: [if], data = [none]
} else {
tran.registerSynchronization(sync); // depends on control dependency: [if], data = [none]
}
} catch (SystemException se) {
FFDCFilter.processException(se, this.getClass().getName() + ".registerSynchronization", "177", this);
} catch (RollbackException re) { // depends on control dependency: [catch], data = [none]
FFDCFilter.processException(re, this.getClass().getName() + ".registerSynchronization", "180", this);
} catch (IllegalStateException ie) { // depends on control dependency: [catch], data = [none]
FFDCFilter.processException(ie, this.getClass().getName() + ".registerSynchronization", "182", this);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void addNewField(Item item, String values) {
if(logger.isDebugEnabled()) {
logger.debug("Tagging item with field: " + newField + " and value: " + values);
}
Document document = item.getDescriptorDom();
if(document != null) {
Element root = document.getRootElement();
if(root != null) {
for(String value : values.split(",")) {
Element newElement = root.addElement(newField);
newElement.setText(value);
}
}
}
} } | public class class_name {
protected void addNewField(Item item, String values) {
if(logger.isDebugEnabled()) {
logger.debug("Tagging item with field: " + newField + " and value: " + values); // depends on control dependency: [if], data = [none]
}
Document document = item.getDescriptorDom();
if(document != null) {
Element root = document.getRootElement();
if(root != null) {
for(String value : values.split(",")) {
Element newElement = root.addElement(newField);
newElement.setText(value); // depends on control dependency: [for], data = [value]
}
}
}
} } |
public class class_name {
private void initializeTickGenerator() {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.entry(tc, "initializeTickGenerator");
// we do not want ticks to start at zero - it causes the first message
// to go missing
long tick = -1;
try {
tick = _msgStore.getUniqueTickCount();
} catch (PersistenceException e) {
// No FFDC code needed
// Should be ok to carry on in the result of a persistence failure
// as
// we are only trying to increment the tick
if (TraceComponent.isAnyTracingEnabled()
&& TraceComponent.isAnyTracingEnabled()
&& tc.isEventEnabled())
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.exit(tc, "initializeTickGenerator", new Long(tick));
} } | public class class_name {
private void initializeTickGenerator() {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.entry(tc, "initializeTickGenerator");
// we do not want ticks to start at zero - it causes the first message
// to go missing
long tick = -1;
try {
tick = _msgStore.getUniqueTickCount(); // depends on control dependency: [try], data = [none]
} catch (PersistenceException e) {
// No FFDC code needed
// Should be ok to carry on in the result of a persistence failure
// as
// we are only trying to increment the tick
if (TraceComponent.isAnyTracingEnabled()
&& TraceComponent.isAnyTracingEnabled()
&& tc.isEventEnabled())
SibTr.exception(tc, e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.exit(tc, "initializeTickGenerator", new Long(tick));
} } |
public class class_name {
public void dissolve() {
if (state == State.SESSION_DISSOLVED) {
return;
}
if (handler.sessionFree() || sessionPassThrough) {
return;
}
if (null == session) {
// only case is when CSRF token check failed
// while resolving session
// we need to generate new session anyway
// because it is required to cache the
// original URL
// see RedirectToLoginUrl
session = new H.Session();
}
localeResolver.dissolve();
app().eventBus().emit(new SessionWillDissolveEvent(this));
try {
setCsrfCookieAndRenderArgs();
sessionManager().dissolveState(session(), flash(), resp());
// dissolveFlash();
// dissolveSession();
state = State.SESSION_DISSOLVED;
} finally {
app().eventBus().emit(new SessionDissolvedEvent(this));
}
} } | public class class_name {
public void dissolve() {
if (state == State.SESSION_DISSOLVED) {
return; // depends on control dependency: [if], data = [none]
}
if (handler.sessionFree() || sessionPassThrough) {
return; // depends on control dependency: [if], data = [none]
}
if (null == session) {
// only case is when CSRF token check failed
// while resolving session
// we need to generate new session anyway
// because it is required to cache the
// original URL
// see RedirectToLoginUrl
session = new H.Session(); // depends on control dependency: [if], data = [none]
}
localeResolver.dissolve();
app().eventBus().emit(new SessionWillDissolveEvent(this));
try {
setCsrfCookieAndRenderArgs(); // depends on control dependency: [try], data = [none]
sessionManager().dissolveState(session(), flash(), resp()); // depends on control dependency: [try], data = [none]
// dissolveFlash();
// dissolveSession();
state = State.SESSION_DISSOLVED; // depends on control dependency: [try], data = [none]
} finally {
app().eventBus().emit(new SessionDissolvedEvent(this));
}
} } |
public class class_name {
public static ResultSet createResultSet(String[] columnNames, ColumnType[] columnTypes,
String[][] data,
Protocol protocol) {
int columnNameLength = columnNames.length;
ColumnInformation[] columns = new ColumnInformation[columnNameLength];
for (int i = 0; i < columnNameLength; i++) {
columns[i] = ColumnInformation.create(columnNames[i], columnTypes[i]);
}
List<byte[]> rows = new ArrayList<>();
for (String[] rowData : data) {
assert rowData.length == columnNameLength;
byte[][] rowBytes = new byte[rowData.length][];
for (int i = 0; i < rowData.length; i++) {
if (rowData[i] != null) {
rowBytes[i] = rowData[i].getBytes();
}
}
rows.add(StandardPacketInputStream.create(rowBytes, columnTypes));
}
return new SelectResultSet(columns, rows, protocol, TYPE_SCROLL_SENSITIVE);
} } | public class class_name {
public static ResultSet createResultSet(String[] columnNames, ColumnType[] columnTypes,
String[][] data,
Protocol protocol) {
int columnNameLength = columnNames.length;
ColumnInformation[] columns = new ColumnInformation[columnNameLength];
for (int i = 0; i < columnNameLength; i++) {
columns[i] = ColumnInformation.create(columnNames[i], columnTypes[i]); // depends on control dependency: [for], data = [i]
}
List<byte[]> rows = new ArrayList<>();
for (String[] rowData : data) {
assert rowData.length == columnNameLength;
byte[][] rowBytes = new byte[rowData.length][];
for (int i = 0; i < rowData.length; i++) {
if (rowData[i] != null) {
rowBytes[i] = rowData[i].getBytes(); // depends on control dependency: [if], data = [none]
}
}
rows.add(StandardPacketInputStream.create(rowBytes, columnTypes)); // depends on control dependency: [for], data = [none]
}
return new SelectResultSet(columns, rows, protocol, TYPE_SCROLL_SENSITIVE);
} } |
public class class_name {
@Override
public synchronized WroModel create() {
final StopWatch stopWatch = new StopWatch("Create Wro Model from Groovy");
try {
stopWatch.start("createModel");
final Type type = new TypeToken<WroModel>() {}.getType();
final InputStream is = getModelResourceAsStream();
if (is == null) {
throw new WroRuntimeException("Invalid model stream provided!");
}
final WroModel model = new Gson().fromJson(new InputStreamReader(new AutoCloseInputStream(is)), type);
LOG.debug("json model: {}", model);
if (model == null) {
throw new WroRuntimeException("Invalid content provided, cannot build model!");
}
return model;
} catch (final Exception e) {
throw new WroRuntimeException("Invalid model found!", e);
} finally {
stopWatch.stop();
LOG.debug(stopWatch.prettyPrint());
}
} } | public class class_name {
@Override
public synchronized WroModel create() {
final StopWatch stopWatch = new StopWatch("Create Wro Model from Groovy");
try {
stopWatch.start("createModel");
// depends on control dependency: [try], data = [none]
final Type type = new TypeToken<WroModel>() {}.getType();
final InputStream is = getModelResourceAsStream();
if (is == null) {
throw new WroRuntimeException("Invalid model stream provided!");
}
final WroModel model = new Gson().fromJson(new InputStreamReader(new AutoCloseInputStream(is)), type);
LOG.debug("json model: {}", model);
// depends on control dependency: [try], data = [none]
if (model == null) {
throw new WroRuntimeException("Invalid content provided, cannot build model!");
}
return model;
// depends on control dependency: [try], data = [none]
} catch (final Exception e) {
throw new WroRuntimeException("Invalid model found!", e);
} finally {
// depends on control dependency: [catch], data = [none]
stopWatch.stop();
LOG.debug(stopWatch.prettyPrint());
}
} } |
public class class_name {
public static List<Class<? extends WindupVertexFrame>> getMappings(GraphRewrite event, String pattern)
{
Map<String, List<Class<? extends WindupVertexFrame>>> mappings = getMappings(event);
List<Class<? extends WindupVertexFrame>> result = mappings.get(pattern);
if (result == null)
{
result = new ArrayList<>();
mappings.put(pattern, result);
}
return result;
} } | public class class_name {
public static List<Class<? extends WindupVertexFrame>> getMappings(GraphRewrite event, String pattern)
{
Map<String, List<Class<? extends WindupVertexFrame>>> mappings = getMappings(event);
List<Class<? extends WindupVertexFrame>> result = mappings.get(pattern);
if (result == null)
{
result = new ArrayList<>(); // depends on control dependency: [if], data = [none]
mappings.put(pattern, result); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@Override
public int compareTo(BLine other) {
int pageCompare = new Integer(pageId).compareTo(other.pageId);
if (pageCompare != 0) {
return pageCompare;
}
int xCompare = new Float(region.x).compareTo(other.region.x);
if (xCompare != 0) {
return xCompare;
}
int yCompare = new Float(region.y).compareTo(other.region.y);
return yCompare;
} } | public class class_name {
@Override
public int compareTo(BLine other) {
int pageCompare = new Integer(pageId).compareTo(other.pageId);
if (pageCompare != 0) {
return pageCompare; // depends on control dependency: [if], data = [none]
}
int xCompare = new Float(region.x).compareTo(other.region.x);
if (xCompare != 0) {
return xCompare; // depends on control dependency: [if], data = [none]
}
int yCompare = new Float(region.y).compareTo(other.region.y);
return yCompare;
} } |
public class class_name {
public void setLocalSecondaryIndexes(java.util.Collection<LocalSecondaryIndex> localSecondaryIndexes) {
if (localSecondaryIndexes == null) {
this.localSecondaryIndexes = null;
return;
}
this.localSecondaryIndexes = new java.util.ArrayList<LocalSecondaryIndex>(localSecondaryIndexes);
} } | public class class_name {
public void setLocalSecondaryIndexes(java.util.Collection<LocalSecondaryIndex> localSecondaryIndexes) {
if (localSecondaryIndexes == null) {
this.localSecondaryIndexes = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.localSecondaryIndexes = new java.util.ArrayList<LocalSecondaryIndex>(localSecondaryIndexes);
} } |
public class class_name {
public void setCommandInvocations(java.util.Collection<CommandInvocation> commandInvocations) {
if (commandInvocations == null) {
this.commandInvocations = null;
return;
}
this.commandInvocations = new com.amazonaws.internal.SdkInternalList<CommandInvocation>(commandInvocations);
} } | public class class_name {
public void setCommandInvocations(java.util.Collection<CommandInvocation> commandInvocations) {
if (commandInvocations == null) {
this.commandInvocations = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.commandInvocations = new com.amazonaws.internal.SdkInternalList<CommandInvocation>(commandInvocations);
} } |
public class class_name {
private Object getReferencedObject(Identity id, ObjectReferenceDescriptor rds)
{
Class baseClassForProxy;
if (rds.isLazy())
{
/*
arminw:
use real reference class instead of the top-level class,
because we want to use a proxy representing the real class
not only the top-level class - right?
*/
// referencedProxy = getClassDescriptor(referencedClass).getDynamicProxyClass();
//referencedProxy = rds.getItemClass();
/*
* andrew.clute:
* With proxy generation now handled by the ProxyFactory implementations, the class of the Item
* is now the nessecary parameter to generate a proxy.
*/
baseClassForProxy = rds.getItemClass();
}
else
{
/*
* andrew.clute:
* If the descriptor does not mark it as lazy, then the class for the proxy must be of type VirtualProxy
*/
baseClassForProxy = rds.getItemProxyClass();
}
if (baseClassForProxy != null)
{
try
{
return pb.createProxy(baseClassForProxy, id);
}
catch (Exception e)
{
log.error("Error while instantiate object " + id + ", msg: "+ e.getMessage(), e);
if(e instanceof PersistenceBrokerException)
{
throw (PersistenceBrokerException) e;
}
else
{
throw new PersistenceBrokerException(e);
}
}
}
else
{
return pb.doGetObjectByIdentity(id);
}
} } | public class class_name {
private Object getReferencedObject(Identity id, ObjectReferenceDescriptor rds)
{
Class baseClassForProxy;
if (rds.isLazy())
{
/*
arminw:
use real reference class instead of the top-level class,
because we want to use a proxy representing the real class
not only the top-level class - right?
*/
// referencedProxy = getClassDescriptor(referencedClass).getDynamicProxyClass();
//referencedProxy = rds.getItemClass();
/*
* andrew.clute:
* With proxy generation now handled by the ProxyFactory implementations, the class of the Item
* is now the nessecary parameter to generate a proxy.
*/
baseClassForProxy = rds.getItemClass();
// depends on control dependency: [if], data = [none]
}
else
{
/*
* andrew.clute:
* If the descriptor does not mark it as lazy, then the class for the proxy must be of type VirtualProxy
*/
baseClassForProxy = rds.getItemProxyClass();
// depends on control dependency: [if], data = [none]
}
if (baseClassForProxy != null)
{
try
{
return pb.createProxy(baseClassForProxy, id);
// depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
log.error("Error while instantiate object " + id + ", msg: "+ e.getMessage(), e);
if(e instanceof PersistenceBrokerException)
{
throw (PersistenceBrokerException) e;
}
else
{
throw new PersistenceBrokerException(e);
}
}
// depends on control dependency: [catch], data = [none]
}
else
{
return pb.doGetObjectByIdentity(id);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(CreateAuthorizerRequest createAuthorizerRequest, ProtocolMarshaller protocolMarshaller) {
if (createAuthorizerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createAuthorizerRequest.getRestApiId(), RESTAPIID_BINDING);
protocolMarshaller.marshall(createAuthorizerRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createAuthorizerRequest.getType(), TYPE_BINDING);
protocolMarshaller.marshall(createAuthorizerRequest.getProviderARNs(), PROVIDERARNS_BINDING);
protocolMarshaller.marshall(createAuthorizerRequest.getAuthType(), AUTHTYPE_BINDING);
protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerUri(), AUTHORIZERURI_BINDING);
protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerCredentials(), AUTHORIZERCREDENTIALS_BINDING);
protocolMarshaller.marshall(createAuthorizerRequest.getIdentitySource(), IDENTITYSOURCE_BINDING);
protocolMarshaller.marshall(createAuthorizerRequest.getIdentityValidationExpression(), IDENTITYVALIDATIONEXPRESSION_BINDING);
protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerResultTtlInSeconds(), AUTHORIZERRESULTTTLINSECONDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateAuthorizerRequest createAuthorizerRequest, ProtocolMarshaller protocolMarshaller) {
if (createAuthorizerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createAuthorizerRequest.getRestApiId(), RESTAPIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAuthorizerRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAuthorizerRequest.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAuthorizerRequest.getProviderARNs(), PROVIDERARNS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAuthorizerRequest.getAuthType(), AUTHTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerUri(), AUTHORIZERURI_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerCredentials(), AUTHORIZERCREDENTIALS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAuthorizerRequest.getIdentitySource(), IDENTITYSOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAuthorizerRequest.getIdentityValidationExpression(), IDENTITYVALIDATIONEXPRESSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerResultTtlInSeconds(), AUTHORIZERRESULTTTLINSECONDS_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 void setCDSTranslationReport(ExtendedResult<CdsFeatureTranslationCheck.TranslationReportInfo> cdsCheckResult) {
try {
CdsFeatureTranslationCheck.TranslationReportInfo translationInfo = cdsCheckResult.getExtension();
StringWriter translationReportWriter = new StringWriter();
TranslationResult translationResult = translationInfo.getTranslationResult();
CdsFeature cdsFeature = translationInfo.getCdsFeature();
if (translationResult != null && cdsFeature != null) {
String providedTranslation = cdsFeature.getTranslation();
new TranslationResultWriter(translationResult, providedTranslation).write(translationReportWriter);
String translationReport = translationReportWriter.toString();
StringWriter reportString = new StringWriter();
reportString.append("The results of the automatic translation are shown below.\n\n");
CompoundLocation<Location> compoundLocation = translationInfo.getCdsFeature().getLocations();
reportString.append("Feature location : ");
reportString.append(FeatureLocationWriter.renderCompoundLocation(compoundLocation)).append("\n");
reportString.append("Base count : ").append(Integer.toString(translationResult.getBaseCount()))
.append("\n");
reportString.append("Translation length : ")
.append(Integer.toString(translationResult.getTranslation().length())).append("\n\n");
reportString.append("Translation table info : ");
TranslationTable translationTable = translationInfo.getTranslationTable();
String translationTableName = "NOT SET";
String translationTableNumber = "NOT SET";
if (translationTable != null) {
translationTableName = translationTable.getName();
translationTableNumber = Integer.toString(translationTable.getNumber());
}
reportString.append("Table name - \"").append(translationTableName).append("\" ");
reportString.append("Table number - \"").append(translationTableNumber).append("\"\n\n");
if (translationReport != null && !translationReport.isEmpty()) {
reportString.append("The amino acid codes immediately below the dna triplets is the actual " +
"translation based on the information you provided.");
List<Qualifier> providedtranslations =
translationInfo.getCdsFeature().getQualifiers(Qualifier.TRANSLATION_QUALIFIER_NAME);
if (!providedtranslations.isEmpty()) {
reportString
.append("\nThe second row of amino acid codes is the translation you provided in the CDS " +
"feature. These translations should match.");
}
reportString.append("\n\n");
reportString.append(translationReport);
} else {
reportString.append("No translation made\n\n");
}
/**
* set in all messages and the validation result - used differently in webapp to the command line tool
*/
cdsCheckResult.setReportMessage(reportString.toString());
for (ValidationMessage message : cdsCheckResult.getMessages()) {
message.setReportMessage(reportString.toString());
}
}
} catch (IOException e) {
e.printStackTrace();
}
} } | public class class_name {
public static void setCDSTranslationReport(ExtendedResult<CdsFeatureTranslationCheck.TranslationReportInfo> cdsCheckResult) {
try {
CdsFeatureTranslationCheck.TranslationReportInfo translationInfo = cdsCheckResult.getExtension();
StringWriter translationReportWriter = new StringWriter();
TranslationResult translationResult = translationInfo.getTranslationResult();
CdsFeature cdsFeature = translationInfo.getCdsFeature();
if (translationResult != null && cdsFeature != null) {
String providedTranslation = cdsFeature.getTranslation();
new TranslationResultWriter(translationResult, providedTranslation).write(translationReportWriter); // depends on control dependency: [if], data = [(translationResult]
String translationReport = translationReportWriter.toString();
StringWriter reportString = new StringWriter();
reportString.append("The results of the automatic translation are shown below.\n\n"); // depends on control dependency: [if], data = [none]
CompoundLocation<Location> compoundLocation = translationInfo.getCdsFeature().getLocations();
reportString.append("Feature location : "); // depends on control dependency: [if], data = [none]
reportString.append(FeatureLocationWriter.renderCompoundLocation(compoundLocation)).append("\n"); // depends on control dependency: [if], data = [none]
reportString.append("Base count : ").append(Integer.toString(translationResult.getBaseCount()))
.append("\n"); // depends on control dependency: [if], data = [none]
reportString.append("Translation length : ")
.append(Integer.toString(translationResult.getTranslation().length())).append("\n\n"); // depends on control dependency: [if], data = [none]
reportString.append("Translation table info : "); // depends on control dependency: [if], data = [none]
TranslationTable translationTable = translationInfo.getTranslationTable();
String translationTableName = "NOT SET";
String translationTableNumber = "NOT SET";
if (translationTable != null) {
translationTableName = translationTable.getName(); // depends on control dependency: [if], data = [none]
translationTableNumber = Integer.toString(translationTable.getNumber()); // depends on control dependency: [if], data = [(translationTable]
}
reportString.append("Table name - \"").append(translationTableName).append("\" "); // depends on control dependency: [if], data = [none]
reportString.append("Table number - \"").append(translationTableNumber).append("\"\n\n"); // depends on control dependency: [if], data = [none]
if (translationReport != null && !translationReport.isEmpty()) {
reportString.append("The amino acid codes immediately below the dna triplets is the actual " +
"translation based on the information you provided."); // depends on control dependency: [if], data = [none]
List<Qualifier> providedtranslations =
translationInfo.getCdsFeature().getQualifiers(Qualifier.TRANSLATION_QUALIFIER_NAME);
if (!providedtranslations.isEmpty()) {
reportString
.append("\nThe second row of amino acid codes is the translation you provided in the CDS " +
"feature. These translations should match."); // depends on control dependency: [if], data = [none]
}
reportString.append("\n\n"); // depends on control dependency: [if], data = [none]
reportString.append(translationReport); // depends on control dependency: [if], data = [(translationReport]
} else {
reportString.append("No translation made\n\n"); // depends on control dependency: [if], data = [none]
}
/**
* set in all messages and the validation result - used differently in webapp to the command line tool
*/
cdsCheckResult.setReportMessage(reportString.toString()); // depends on control dependency: [if], data = [none]
for (ValidationMessage message : cdsCheckResult.getMessages()) {
message.setReportMessage(reportString.toString()); // depends on control dependency: [for], data = [message]
}
}
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setMorphTime(float time) {
for (int i=0;i<figures.size();i++) {
Figure figure = (Figure) figures.get(i);
MorphShape shape = (MorphShape) figure.getShape();
shape.setMorphTime(time);
}
} } | public class class_name {
public void setMorphTime(float time) {
for (int i=0;i<figures.size();i++) {
Figure figure = (Figure) figures.get(i);
MorphShape shape = (MorphShape) figure.getShape();
shape.setMorphTime(time);
// depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static String joinPath(final String left, final String right) {
String leftHand = left;
if (!left.endsWith(SEPARATOR_UNIX)) {
leftHand += SEPARATOR_UNIX;
}
return leftHand + right.replaceFirst("^/(.*)", "$1");
} } | public class class_name {
public static String joinPath(final String left, final String right) {
String leftHand = left;
if (!left.endsWith(SEPARATOR_UNIX)) {
leftHand += SEPARATOR_UNIX;
// depends on control dependency: [if], data = [none]
}
return leftHand + right.replaceFirst("^/(.*)", "$1");
} } |
public class class_name {
public Optional<SectionHeader> maybeGetSectionHeader(
DataDirectoryKey dataDirKey) {
Optional<DataDirEntry> dataDir = optHeader
.maybeGetDataDirEntry(dataDirKey);
if (dataDir.isPresent()) {
return dataDir.get().maybeGetSectionTableEntry(table);
}
logger.warn("data dir entry " + dataDirKey + " doesn't exist");
return Optional.absent();
} } | public class class_name {
public Optional<SectionHeader> maybeGetSectionHeader(
DataDirectoryKey dataDirKey) {
Optional<DataDirEntry> dataDir = optHeader
.maybeGetDataDirEntry(dataDirKey);
if (dataDir.isPresent()) {
return dataDir.get().maybeGetSectionTableEntry(table); // depends on control dependency: [if], data = [none]
}
logger.warn("data dir entry " + dataDirKey + " doesn't exist");
return Optional.absent();
} } |
public class class_name {
public List<Node> select(final Collection<List<CssSelector>> selectorsCollection) {
List<Node> results = new ArrayList<>();
for (List<CssSelector> selectors : selectorsCollection) {
processSelectors(results, selectors);
}
return results;
} } | public class class_name {
public List<Node> select(final Collection<List<CssSelector>> selectorsCollection) {
List<Node> results = new ArrayList<>();
for (List<CssSelector> selectors : selectorsCollection) {
processSelectors(results, selectors); // depends on control dependency: [for], data = [selectors]
}
return results;
} } |
public class class_name {
@NonNull
public static List<String> unmodifiableNonNullListOfStrings(@Nullable Object[] args) {
if (args == null || args.length == 0) {
return emptyList();
} else {
final List<String> list = new ArrayList<String>(args.length);
//noinspection ForLoopReplaceableByForEach -> on Android it's faster
for (int i = 0; i < args.length; i++) {
final Object arg = args[i];
list.add(arg != null ? arg.toString() : "null");
}
return unmodifiableList(list);
}
} } | public class class_name {
@NonNull
public static List<String> unmodifiableNonNullListOfStrings(@Nullable Object[] args) {
if (args == null || args.length == 0) {
return emptyList(); // depends on control dependency: [if], data = [none]
} else {
final List<String> list = new ArrayList<String>(args.length);
//noinspection ForLoopReplaceableByForEach -> on Android it's faster
for (int i = 0; i < args.length; i++) {
final Object arg = args[i];
list.add(arg != null ? arg.toString() : "null"); // depends on control dependency: [for], data = [none]
}
return unmodifiableList(list); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void allowCheckStateShadow(boolean allow) {
if (allow != mAllowCheckStateShadow) {
mAllowCheckStateShadow = allow;
setShadowInternal(mShadowRadius, mShadowColor, true);
}
} } | public class class_name {
public void allowCheckStateShadow(boolean allow) {
if (allow != mAllowCheckStateShadow) {
mAllowCheckStateShadow = allow; // depends on control dependency: [if], data = [none]
setShadowInternal(mShadowRadius, mShadowColor, true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public CompletableFuture<Void> shutdownServer() {
CompletableFuture<Void> shutdownFuture = new CompletableFuture<>();
if (serverShutdownFuture.compareAndSet(null, shutdownFuture)) {
log.info("Shutting down {} @ {}", serverName, serverAddress);
final CompletableFuture<Void> groupShutdownFuture = new CompletableFuture<>();
if (bootstrap != null) {
EventLoopGroup group = bootstrap.group();
if (group != null && !group.isShutdown()) {
group.shutdownGracefully(0L, 0L, TimeUnit.MILLISECONDS)
.addListener(finished -> {
if (finished.isSuccess()) {
groupShutdownFuture.complete(null);
} else {
groupShutdownFuture.completeExceptionally(finished.cause());
}
});
} else {
groupShutdownFuture.complete(null);
}
} else {
groupShutdownFuture.complete(null);
}
final CompletableFuture<Void> handlerShutdownFuture = new CompletableFuture<>();
if (handler == null) {
handlerShutdownFuture.complete(null);
} else {
handler.shutdown().whenComplete((result, throwable) -> {
if (throwable != null) {
handlerShutdownFuture.completeExceptionally(throwable);
} else {
handlerShutdownFuture.complete(null);
}
});
}
final CompletableFuture<Void> queryExecShutdownFuture = CompletableFuture.runAsync(() -> {
if (queryExecutor != null) {
ExecutorUtils.gracefulShutdown(10L, TimeUnit.MINUTES, queryExecutor);
}
});
CompletableFuture.allOf(
queryExecShutdownFuture, groupShutdownFuture, handlerShutdownFuture
).whenComplete((result, throwable) -> {
if (throwable != null) {
shutdownFuture.completeExceptionally(throwable);
} else {
shutdownFuture.complete(null);
}
});
}
return serverShutdownFuture.get();
} } | public class class_name {
public CompletableFuture<Void> shutdownServer() {
CompletableFuture<Void> shutdownFuture = new CompletableFuture<>();
if (serverShutdownFuture.compareAndSet(null, shutdownFuture)) {
log.info("Shutting down {} @ {}", serverName, serverAddress); // depends on control dependency: [if], data = [none]
final CompletableFuture<Void> groupShutdownFuture = new CompletableFuture<>();
if (bootstrap != null) {
EventLoopGroup group = bootstrap.group();
if (group != null && !group.isShutdown()) {
group.shutdownGracefully(0L, 0L, TimeUnit.MILLISECONDS)
.addListener(finished -> {
if (finished.isSuccess()) {
groupShutdownFuture.complete(null); // depends on control dependency: [if], data = [none]
} else {
groupShutdownFuture.completeExceptionally(finished.cause()); // depends on control dependency: [if], data = [none]
}
});
} else {
groupShutdownFuture.complete(null); // depends on control dependency: [if], data = [none]
}
} else {
groupShutdownFuture.complete(null);
}
final CompletableFuture<Void> handlerShutdownFuture = new CompletableFuture<>();
if (handler == null) {
handlerShutdownFuture.complete(null);
} else {
handler.shutdown().whenComplete((result, throwable) -> {
if (throwable != null) {
handlerShutdownFuture.completeExceptionally(throwable); // depends on control dependency: [if], data = [(throwable]
} else {
handlerShutdownFuture.complete(null); // depends on control dependency: [if], data = [null)]
}
});
}
final CompletableFuture<Void> queryExecShutdownFuture = CompletableFuture.runAsync(() -> {
if (queryExecutor != null) {
ExecutorUtils.gracefulShutdown(10L, TimeUnit.MINUTES, queryExecutor);
}
});
CompletableFuture.allOf(
queryExecShutdownFuture, groupShutdownFuture, handlerShutdownFuture
).whenComplete((result, throwable) -> {
if (throwable != null) {
shutdownFuture.completeExceptionally(throwable);
} else {
shutdownFuture.complete(null);
}
});
}
return serverShutdownFuture.get();
} } |
public class class_name {
private static Collection<Path> findFiles(FileSystem fs, final String contains) throws IOException {
final ArrayList<Path> rv = new ArrayList<>();
Iterator<Path> dirs = fs.getRootDirectories().iterator();
Files.walkFileTree(dirs.next(), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
if (file.toString().contains(contains)) {
rv.add(file);
}
return FileVisitResult.CONTINUE;
}
});
if (dirs.hasNext()) {
// There is more than one root directory.
throw new IOException("FileSystem had more than one root directory: " + fs);
}
return rv;
} } | public class class_name {
private static Collection<Path> findFiles(FileSystem fs, final String contains) throws IOException {
final ArrayList<Path> rv = new ArrayList<>();
Iterator<Path> dirs = fs.getRootDirectories().iterator();
Files.walkFileTree(dirs.next(), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
if (file.toString().contains(contains)) {
rv.add(file); // depends on control dependency: [if], data = [none]
}
return FileVisitResult.CONTINUE;
}
});
if (dirs.hasNext()) {
// There is more than one root directory.
throw new IOException("FileSystem had more than one root directory: " + fs);
}
return rv;
} } |
public class class_name {
public static BoundingBox getProjectedBoundingBox(String authority,
Long code, int x, int y, int zoom) {
BoundingBox boundingBox = getWebMercatorBoundingBox(x, y, zoom);
if (code != null) {
ProjectionTransform transform = webMercator.getTransformation(
authority, code);
boundingBox = boundingBox.transform(transform);
}
return boundingBox;
} } | public class class_name {
public static BoundingBox getProjectedBoundingBox(String authority,
Long code, int x, int y, int zoom) {
BoundingBox boundingBox = getWebMercatorBoundingBox(x, y, zoom);
if (code != null) {
ProjectionTransform transform = webMercator.getTransformation(
authority, code);
boundingBox = boundingBox.transform(transform); // depends on control dependency: [if], data = [none]
}
return boundingBox;
} } |
public class class_name {
public static String getJustClassName(Class<?> cls)
{
if (cls == null)
return null;
if (cls.isArray())
{
Class<?> c = cls.getComponentType();
return getJustClassName(c.getName());
}
return getJustClassName(cls.getName());
} } | public class class_name {
public static String getJustClassName(Class<?> cls)
{
if (cls == null)
return null;
if (cls.isArray())
{
Class<?> c = cls.getComponentType();
return getJustClassName(c.getName()); // depends on control dependency: [if], data = [none]
}
return getJustClassName(cls.getName());
} } |
public class class_name {
static synchronized Udev getInstance() {
if (instance == null) {
try {
instance = new Udev();
} catch (IOException e) {
System.err.println("Udev: failed to open connection");
e.printStackTrace();
}
}
return instance;
} } | public class class_name {
static synchronized Udev getInstance() {
if (instance == null) {
try {
instance = new Udev(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
System.err.println("Udev: failed to open connection");
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return instance;
} } |
public class class_name {
public static List<Pair<String, TypeName>> orderContentValues(final SQLiteModelMethod method, final List<Pair<String, TypeName>> updateableParams) {
final List<Pair<String, TypeName>> result = new ArrayList<Pair<String, TypeName>>();
JQLChecker checker = JQLChecker.getInstance();
final One<Boolean> inserMode = new One<Boolean>(false);
checker.replace(method, method.jql, new JQLReplacerListenerImpl(method) {
// used in update
@Override
public String onColumnNameToUpdate(String columnName) {
String column = currentEntity.findPropertyByName(columnName).columnName;
for (Pair<String, TypeName> item : updateableParams) {
String paramNameInQuery = method.findParameterAliasByName(item.value0);
if (paramNameInQuery.equalsIgnoreCase(columnName)) {
result.add(item);
break;
}
}
return column;
}
// used in insert
@Override
public void onColumnNameSetBegin(Column_name_setContext ctx) {
inserMode.value0 = true;
}
@Override
public void onColumnNameSetEnd(Column_name_setContext ctx) {
inserMode.value0 = false;
}
@Override
public String onColumnName(String columnName) {
if (!inserMode.value0)
return columnName;
String column = currentEntity.findPropertyByName(columnName).columnName;
for (Pair<String, TypeName> item : updateableParams) {
String paramNameInQuery = method.findParameterAliasByName(item.value0);
if (paramNameInQuery.equalsIgnoreCase(columnName)) {
result.add(item);
break;
}
}
return column;
}
});
return result;
} } | public class class_name {
public static List<Pair<String, TypeName>> orderContentValues(final SQLiteModelMethod method, final List<Pair<String, TypeName>> updateableParams) {
final List<Pair<String, TypeName>> result = new ArrayList<Pair<String, TypeName>>();
JQLChecker checker = JQLChecker.getInstance();
final One<Boolean> inserMode = new One<Boolean>(false);
checker.replace(method, method.jql, new JQLReplacerListenerImpl(method) {
// used in update
@Override
public String onColumnNameToUpdate(String columnName) {
String column = currentEntity.findPropertyByName(columnName).columnName;
for (Pair<String, TypeName> item : updateableParams) {
String paramNameInQuery = method.findParameterAliasByName(item.value0);
if (paramNameInQuery.equalsIgnoreCase(columnName)) {
result.add(item); // depends on control dependency: [if], data = [none]
break;
}
}
return column;
}
// used in insert
@Override
public void onColumnNameSetBegin(Column_name_setContext ctx) {
inserMode.value0 = true;
}
@Override
public void onColumnNameSetEnd(Column_name_setContext ctx) {
inserMode.value0 = false;
}
@Override
public String onColumnName(String columnName) {
if (!inserMode.value0)
return columnName;
String column = currentEntity.findPropertyByName(columnName).columnName;
for (Pair<String, TypeName> item : updateableParams) {
String paramNameInQuery = method.findParameterAliasByName(item.value0);
if (paramNameInQuery.equalsIgnoreCase(columnName)) {
result.add(item); // depends on control dependency: [if], data = [none]
break;
}
}
return column;
}
});
return result;
} } |
public class class_name {
public void shutdownAndWait() {
try {
client.shutdown().get();
LOG.info("The Queryable State Client was shutdown successfully.");
} catch (Exception e) {
LOG.warn("The Queryable State Client shutdown failed: ", e);
}
} } | public class class_name {
public void shutdownAndWait() {
try {
client.shutdown().get(); // depends on control dependency: [try], data = [none]
LOG.info("The Queryable State Client was shutdown successfully."); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.warn("The Queryable State Client shutdown failed: ", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public PersistenceDelegate getPersistenceDelegate(Class<?> type)
{
if (type == null)
{
return nullPD; // may be return a special PD?
}
// registered delegate
PersistenceDelegate registeredPD = delegates.get(type);
if (registeredPD != null)
{
return registeredPD;
}
if (type.getName().startsWith(UtilCollectionsPersistenceDelegate.CLASS_PREFIX))
{
return utilCollectionsPD;
}
if (type.isArray())
{
return arrayPD;
}
if (Proxy.isProxyClass(type))
{
return proxyPD;
}
// check "persistenceDelegate" property
try
{
BeanInfo beanInfo = Introspector.getBeanInfo(type);
if (beanInfo != null)
{
PersistenceDelegate pd = (PersistenceDelegate) beanInfo.getBeanDescriptor().getValue("persistenceDelegate"); //$NON-NLS-1$
if (pd != null)
{
return pd;
}
}
}
catch (Exception e)
{
// Ignored
}
// default persistence delegate
return defaultPD;
} } | public class class_name {
public PersistenceDelegate getPersistenceDelegate(Class<?> type)
{
if (type == null)
{
return nullPD; // may be return a special PD? // depends on control dependency: [if], data = [none]
}
// registered delegate
PersistenceDelegate registeredPD = delegates.get(type);
if (registeredPD != null)
{
return registeredPD; // depends on control dependency: [if], data = [none]
}
if (type.getName().startsWith(UtilCollectionsPersistenceDelegate.CLASS_PREFIX))
{
return utilCollectionsPD; // depends on control dependency: [if], data = [none]
}
if (type.isArray())
{
return arrayPD; // depends on control dependency: [if], data = [none]
}
if (Proxy.isProxyClass(type))
{
return proxyPD; // depends on control dependency: [if], data = [none]
}
// check "persistenceDelegate" property
try
{
BeanInfo beanInfo = Introspector.getBeanInfo(type);
if (beanInfo != null)
{
PersistenceDelegate pd = (PersistenceDelegate) beanInfo.getBeanDescriptor().getValue("persistenceDelegate"); //$NON-NLS-1$
if (pd != null)
{
return pd; // depends on control dependency: [if], data = [none]
}
}
}
catch (Exception e)
{
// Ignored
} // depends on control dependency: [catch], data = [none]
// default persistence delegate
return defaultPD;
} } |
public class class_name {
@Override
protected String doBuildColumnString(String dm) {
StringBuilder sb = new StringBuilder();
sb.append(dm).append(createdAt);
sb.append(dm).append(updatedAt);
if (sb.length() > dm.length()) {
sb.delete(0, dm.length());
}
sb.insert(0, "{").append("}");
return sb.toString();
} } | public class class_name {
@Override
protected String doBuildColumnString(String dm) {
StringBuilder sb = new StringBuilder();
sb.append(dm).append(createdAt);
sb.append(dm).append(updatedAt);
if (sb.length() > dm.length()) {
sb.delete(0, dm.length()); // depends on control dependency: [if], data = [dm.length())]
}
sb.insert(0, "{").append("}");
return sb.toString();
} } |
public class class_name {
public void marshall(LifecyclePolicyRuleAction lifecyclePolicyRuleAction, ProtocolMarshaller protocolMarshaller) {
if (lifecyclePolicyRuleAction == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lifecyclePolicyRuleAction.getType(), TYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LifecyclePolicyRuleAction lifecyclePolicyRuleAction, ProtocolMarshaller protocolMarshaller) {
if (lifecyclePolicyRuleAction == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lifecyclePolicyRuleAction.getType(), TYPE_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 Object getValueAt(int rowIndex, int columnIndex) {
Object result = null;
Item item = getPropertySheetElement(rowIndex);
if (item.isProperty()) {
switch (columnIndex) {
case NAME_COLUMN:
result = item;
break;
case VALUE_COLUMN:
try {
result = item.getProperty().getValue();
} catch (Exception e) {
Logger.getLogger(PropertySheetTableModel.class.getName()).log(Level.SEVERE, null, e);
}
break;
default:
// should not happen
}
} else {
result = item;
}
return result;
} } | public class class_name {
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Object result = null;
Item item = getPropertySheetElement(rowIndex);
if (item.isProperty()) {
switch (columnIndex) {
case NAME_COLUMN:
result = item;
break;
case VALUE_COLUMN:
try {
result = item.getProperty().getValue(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
Logger.getLogger(PropertySheetTableModel.class.getName()).log(Level.SEVERE, null, e);
} // depends on control dependency: [catch], data = [none]
break;
default:
// should not happen
}
} else {
result = item; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@SuppressWarnings("rawtypes")
protected Object getValue(GetterMethodCover method, Object value) {
if(method.isByte()) {
value = ((Byte)value).intValue();
}
else if(method.isChar()) {
value = (int)((Character)value).charValue();
}
else if(method.isFloat()) {
value = ((Float)value).doubleValue();
}
else if(method.isLong()) {
value = ((Long)value).doubleValue();
}
else if(method.isShort()) {
value = ((Short)value).intValue();
}
else if(method.isObject()) {
value = parseObject(method, value);
}
else if(method.isObjectArray()) {
value = parseArray(method, value);
}
else if(method.isArrayObjectCollection()) {
return parseArrayObjectCollection(method, (Collection)value);
}
else if(method.isObjectCollection()) {
return parseObjectCollection(method, (Collection)value);
}
else if(method.isArrayCollection()) {
return parseArrayCollection(method, (Collection)value);
}
else if(method.isArray() || method.isColection()) {
return transformSimpleValue(value);
}
return value;
} } | public class class_name {
@SuppressWarnings("rawtypes")
protected Object getValue(GetterMethodCover method, Object value) {
if(method.isByte()) {
value = ((Byte)value).intValue(); // depends on control dependency: [if], data = [none]
}
else if(method.isChar()) {
value = (int)((Character)value).charValue(); // depends on control dependency: [if], data = [none]
}
else if(method.isFloat()) {
value = ((Float)value).doubleValue(); // depends on control dependency: [if], data = [none]
}
else if(method.isLong()) {
value = ((Long)value).doubleValue(); // depends on control dependency: [if], data = [none]
}
else if(method.isShort()) {
value = ((Short)value).intValue(); // depends on control dependency: [if], data = [none]
}
else if(method.isObject()) {
value = parseObject(method, value); // depends on control dependency: [if], data = [none]
}
else if(method.isObjectArray()) {
value = parseArray(method, value); // depends on control dependency: [if], data = [none]
}
else if(method.isArrayObjectCollection()) {
return parseArrayObjectCollection(method, (Collection)value); // depends on control dependency: [if], data = [none]
}
else if(method.isObjectCollection()) {
return parseObjectCollection(method, (Collection)value); // depends on control dependency: [if], data = [none]
}
else if(method.isArrayCollection()) {
return parseArrayCollection(method, (Collection)value); // depends on control dependency: [if], data = [none]
}
else if(method.isArray() || method.isColection()) {
return transformSimpleValue(value); // depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
@Override
public void doExceptionCaughtListeners(final Throwable cause) {
runManagementTask(new Runnable() {
@Override
public void run() {
try {
List<SessionManagementListener> sessionListeners = getManagementListeners();
for (final SessionManagementListener listener : sessionListeners) {
listener.doExceptionCaught(SessionManagementBeanImpl.this, cause);
}
markChanged();
} catch (Exception ex) {
logger.warn("Error during doExceptionCaught session listener notifications:", ex);
}
}
});
} } | public class class_name {
@Override
public void doExceptionCaughtListeners(final Throwable cause) {
runManagementTask(new Runnable() {
@Override
public void run() {
try {
List<SessionManagementListener> sessionListeners = getManagementListeners();
for (final SessionManagementListener listener : sessionListeners) {
listener.doExceptionCaught(SessionManagementBeanImpl.this, cause); // depends on control dependency: [for], data = [listener]
}
markChanged(); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
logger.warn("Error during doExceptionCaught session listener notifications:", ex);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private void parseLastConsonant() {
if (!validViSyll)
return;
if (iCurPos > strSyllable.length())
strLastConsonant = ZERO;
String strCon = strSyllable.substring(iCurPos, strSyllable.length());
if (strCon.length() > 3) {
validViSyll = false;
return;
}
Iterator iter = alLastConsonants.iterator();
while (iter.hasNext()) {
String tempLastCon = (String) iter.next();
if (strCon.equals(tempLastCon)) {
strLastConsonant = tempLastCon;
iCurPos += strLastConsonant.length();
return;
}
}
strLastConsonant = ZERO;
if (iCurPos >= strSyllable.length())
validViSyll = true;
else validViSyll = false;
return;
} } | public class class_name {
private void parseLastConsonant() {
if (!validViSyll)
return;
if (iCurPos > strSyllable.length())
strLastConsonant = ZERO;
String strCon = strSyllable.substring(iCurPos, strSyllable.length());
if (strCon.length() > 3) {
validViSyll = false; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
Iterator iter = alLastConsonants.iterator();
while (iter.hasNext()) {
String tempLastCon = (String) iter.next();
if (strCon.equals(tempLastCon)) {
strLastConsonant = tempLastCon; // depends on control dependency: [if], data = [none]
iCurPos += strLastConsonant.length(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
strLastConsonant = ZERO;
if (iCurPos >= strSyllable.length())
validViSyll = true;
else validViSyll = false;
return;
} } |
public class class_name {
public static DoubleSupplier doubleSupplier(CheckedDoubleSupplier supplier, Consumer<Throwable> handler) {
return () -> {
try {
return supplier.getAsDouble();
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} } | public class class_name {
public static DoubleSupplier doubleSupplier(CheckedDoubleSupplier supplier, Consumer<Throwable> handler) {
return () -> {
try {
return supplier.getAsDouble(); // depends on control dependency: [try], data = [none]
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
} // depends on control dependency: [catch], data = [none]
};
} } |
public class class_name {
public void unregisterMonitor(Monitor monitor) {
if (monitors != null) {
monitors.remove(monitor);
if (monitors.isEmpty()) {
monitors = null;
}
}
} } | public class class_name {
public void unregisterMonitor(Monitor monitor) {
if (monitors != null) {
monitors.remove(monitor); // depends on control dependency: [if], data = [none]
if (monitors.isEmpty()) {
monitors = null; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static String task2MergeCompName(String old) {
String[] parts = old.split(DELIM);
if (parts.length >= 7) {
parts[0] = MetaType.COMPONENT.getV() + parts[0].charAt(1);
parts[parts.length - 3] = EMPTY;
parts[parts.length - 4] = "0";
String metricName = getMergeMetricName(parts[parts.length - 1]);
parts[parts.length - 1] = metricName;
}
return concat(parts);
} } | public class class_name {
public static String task2MergeCompName(String old) {
String[] parts = old.split(DELIM);
if (parts.length >= 7) {
parts[0] = MetaType.COMPONENT.getV() + parts[0].charAt(1); // depends on control dependency: [if], data = [none]
parts[parts.length - 3] = EMPTY; // depends on control dependency: [if], data = [none]
parts[parts.length - 4] = "0"; // depends on control dependency: [if], data = [none]
String metricName = getMergeMetricName(parts[parts.length - 1]);
parts[parts.length - 1] = metricName; // depends on control dependency: [if], data = [none]
}
return concat(parts);
} } |
public class class_name {
@Override
public boolean containsValue(Object value) {
for (V v : values()) {
if (v.equals(value)) {
return true;
}
}
return false;
} } | public class class_name {
@Override
public boolean containsValue(Object value) {
for (V v : values()) {
if (v.equals(value)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void marshall(DecreaseReplicationFactorRequest decreaseReplicationFactorRequest, ProtocolMarshaller protocolMarshaller) {
if (decreaseReplicationFactorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(decreaseReplicationFactorRequest.getClusterName(), CLUSTERNAME_BINDING);
protocolMarshaller.marshall(decreaseReplicationFactorRequest.getNewReplicationFactor(), NEWREPLICATIONFACTOR_BINDING);
protocolMarshaller.marshall(decreaseReplicationFactorRequest.getAvailabilityZones(), AVAILABILITYZONES_BINDING);
protocolMarshaller.marshall(decreaseReplicationFactorRequest.getNodeIdsToRemove(), NODEIDSTOREMOVE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DecreaseReplicationFactorRequest decreaseReplicationFactorRequest, ProtocolMarshaller protocolMarshaller) {
if (decreaseReplicationFactorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(decreaseReplicationFactorRequest.getClusterName(), CLUSTERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(decreaseReplicationFactorRequest.getNewReplicationFactor(), NEWREPLICATIONFACTOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(decreaseReplicationFactorRequest.getAvailabilityZones(), AVAILABILITYZONES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(decreaseReplicationFactorRequest.getNodeIdsToRemove(), NODEIDSTOREMOVE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private JSONArray readArray(boolean stringy) throws JSONException {
JSONArray jsonarray = new JSONArray();
jsonarray.put(stringy
? read(this.stringhuff, this.stringhuffext, this.stringkeep)
: readValue());
while (true) {
if (probe) {
log();
}
if (!bit()) {
if (!bit()) {
return jsonarray;
}
jsonarray.put(stringy
? readValue()
: read(this.stringhuff, this.stringhuffext,
this.stringkeep));
} else {
jsonarray.put(stringy
? read(this.stringhuff, this.stringhuffext,
this.stringkeep)
: readValue());
}
}
} } | public class class_name {
private JSONArray readArray(boolean stringy) throws JSONException {
JSONArray jsonarray = new JSONArray();
jsonarray.put(stringy
? read(this.stringhuff, this.stringhuffext, this.stringkeep)
: readValue());
while (true) {
if (probe) {
log(); // depends on control dependency: [if], data = [none]
}
if (!bit()) {
if (!bit()) {
return jsonarray; // depends on control dependency: [if], data = [none]
}
jsonarray.put(stringy
? readValue()
: read(this.stringhuff, this.stringhuffext,
this.stringkeep)); // depends on control dependency: [if], data = [none]
} else {
jsonarray.put(stringy
? read(this.stringhuff, this.stringhuffext,
this.stringkeep)
: readValue()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected void createServletWrappers() throws Exception {
// NOTE: namespace preinvoke/postinvoke not necessary as the only
// external
// code being run is the servlet's init() and that is handled in the
// ServletWrapper
// check if an extensionFactory is present for *.jsp:
// We do this by constructing an arbitrary mapping which
// will only match the *.xxx extension pattern
//
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.entering(CLASS_NAME, "createServletWrappers");
WebExtensionProcessor jspProcessor = (WebExtensionProcessor) requestMapper.map("/dummyPath.jsp");
if (jspProcessor == null) {
// No extension processor present to handle this kind of
// target. Hence warn, skip.
// pk435011
// LIBERTY: changing log level to debug as this is valid if there's no JSP support configured
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "createServletWrappers", "No Extension Processor found for handling JSPs");
//logger.logp(Level.WARNING, CLASS_NAME, "createServletWrappers", "no.jsp.extension.handler.found");
}
Iterator<IServletConfig> sortedServletConfigIterator = sortNamesByStartUpWeight(config.getServletInfos());
Map<String, List<String>> mappings = config.getServletMappings();
String path = null;
IServletConfig servletConfig;
IServletWrapper wrapper = null;
while (sortedServletConfigIterator.hasNext() && !com.ibm.ws.webcontainer.osgi.WebContainer.isServerStopping()) {
wrapper = null; // 248871: reset wrapper to null
servletConfig = sortedServletConfigIterator.next();
String servletName = servletConfig.getServletName();
List<String> mapList = mappings.get(servletConfig.getServletName());
servletConfig.setServletContext(this.getFacade());
// Begin 650884
// WARNING!!! We shouldn't map by name only as there is
// no way to configure a security constraint
// for a dynamically added path.
//Consolidate the code to setup a single entry map list when its mapped by name only
// if (mapList==null){
// //WARNING!!! We shouldn't map by name only as there is
// //no way to configure a security constraint
// //for a dynamically added path.
// //Also, if there was nothing mapped to the servlet
// //in web.xml, we would have never called WebAppConfiguration.addServletMapping
// //which sets the mappings on sconfig. Adding the list directly to the hashMap short
// //circuits that logic so future calls to addMapping on the ServletConfig wouldn't work
// //unless there was at least one mapping in web.xml
//
//
// // hardcode the path, since it had no mappings
// String byNamePath = BY_NAME_ONLY + servletName;
//
// // Add this to the config, because we will be looking at
// // the mappings in order to get to the servlet through the
// // mappings in the config.
// mapList = new ArrayList<String>();
// mapList.add(byNamePath);
// mappings.put(servletName, mapList);
// }
// End 650884
if (mapList == null || mapList.isEmpty()) {
wrapper = jspAwareCreateServletWrapper(jspProcessor,
servletConfig, servletName);
}
else {
for (String urlPattern : mapList) {
path = urlPattern;
if (path == null) {
// shouldn't happen since there is a mapping specified
// but too bad the user can never hit the servlet
// pk435011
// Begin 650884
logger.logp(Level.SEVERE, CLASS_NAME, "createServletWrappers", "illegal.servlet.mapping", servletName); // PK33511
// path = "/" + BY_NAME_ONLY + "/" + servletName;
// End 650884
} else if (path.equals("/")) {
path = "/*";
}
if (wrapper == null) { // 248871: Check to see if we've
// already found wrapper for
// servletName
wrapper = jspAwareCreateServletWrapper(jspProcessor,
servletConfig, servletName);
if (wrapper == null)
continue;
}
try {
// Begin:248871: Check to see if we found the wrapper
// before adding
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "createServletWrappers"
, "determine whether to add mapping for path[{0}] wrapper[{1}] isEnabled[{2}]"
, new Object[] { path, wrapper, servletConfig.isEnabled() });
if (path != null && servletConfig.isEnabled()) {
requestMapper.addMapping(path, wrapper);
}
// End:248871
} catch (Exception e) {
//TODO: ???? extension processor used to call addMappingTarget after the wrappers had been added.
//Now it is done before, and you can get this exception here in the case they call addMappingTarget
//and add the mapping to the servletConfig because we'll try to add it again, but it will
//already be mapped. You could add a list of paths to ignore and not try to add again. So any
//path added via addMappingTarget will be recorded and addMapping can be skipped. It is preferrable
//to just have them not call addMappingTarget any more instead of adding the extra check.
// pk435011
logger.logp(Level.WARNING, CLASS_NAME, "createServletWrappers", "error.while.adding.servlet.mapping.for.path", new Object[] {
path, wrapper, getApplicationName() });
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, CLASS_NAME + ".createServletWrappers", "455", this);
// pk435011
logger.logp(Level.SEVERE, CLASS_NAME, "createServletWrappers", "error.adding.servlet.mapping.for.servlet", new Object[] {
servletName, getApplicationName(), e }); // PK33511
}
}
}
}
servletConfig.setServletWrapper(wrapper);
this.initializeNonDDRepresentableAnnotation(servletConfig);
// set the servlet wrapper on the
// servlet config so
// ServletConfig.addMapping
// can put it in the
// requestMapper
}
} } | public class class_name {
protected void createServletWrappers() throws Exception {
// NOTE: namespace preinvoke/postinvoke not necessary as the only
// external
// code being run is the servlet's init() and that is handled in the
// ServletWrapper
// check if an extensionFactory is present for *.jsp:
// We do this by constructing an arbitrary mapping which
// will only match the *.xxx extension pattern
//
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.entering(CLASS_NAME, "createServletWrappers");
WebExtensionProcessor jspProcessor = (WebExtensionProcessor) requestMapper.map("/dummyPath.jsp");
if (jspProcessor == null) {
// No extension processor present to handle this kind of
// target. Hence warn, skip.
// pk435011
// LIBERTY: changing log level to debug as this is valid if there's no JSP support configured
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "createServletWrappers", "No Extension Processor found for handling JSPs");
//logger.logp(Level.WARNING, CLASS_NAME, "createServletWrappers", "no.jsp.extension.handler.found");
}
Iterator<IServletConfig> sortedServletConfigIterator = sortNamesByStartUpWeight(config.getServletInfos());
Map<String, List<String>> mappings = config.getServletMappings();
String path = null;
IServletConfig servletConfig;
IServletWrapper wrapper = null;
while (sortedServletConfigIterator.hasNext() && !com.ibm.ws.webcontainer.osgi.WebContainer.isServerStopping()) {
wrapper = null; // 248871: reset wrapper to null
servletConfig = sortedServletConfigIterator.next();
String servletName = servletConfig.getServletName();
List<String> mapList = mappings.get(servletConfig.getServletName());
servletConfig.setServletContext(this.getFacade());
// Begin 650884
// WARNING!!! We shouldn't map by name only as there is
// no way to configure a security constraint
// for a dynamically added path.
//Consolidate the code to setup a single entry map list when its mapped by name only
// if (mapList==null){
// //WARNING!!! We shouldn't map by name only as there is
// //no way to configure a security constraint
// //for a dynamically added path.
// //Also, if there was nothing mapped to the servlet
// //in web.xml, we would have never called WebAppConfiguration.addServletMapping
// //which sets the mappings on sconfig. Adding the list directly to the hashMap short
// //circuits that logic so future calls to addMapping on the ServletConfig wouldn't work
// //unless there was at least one mapping in web.xml
//
//
// // hardcode the path, since it had no mappings
// String byNamePath = BY_NAME_ONLY + servletName;
//
// // Add this to the config, because we will be looking at
// // the mappings in order to get to the servlet through the
// // mappings in the config.
// mapList = new ArrayList<String>();
// mapList.add(byNamePath);
// mappings.put(servletName, mapList);
// }
// End 650884
if (mapList == null || mapList.isEmpty()) {
wrapper = jspAwareCreateServletWrapper(jspProcessor,
servletConfig, servletName);
}
else {
for (String urlPattern : mapList) {
path = urlPattern; // depends on control dependency: [for], data = [urlPattern]
if (path == null) {
// shouldn't happen since there is a mapping specified
// but too bad the user can never hit the servlet
// pk435011
// Begin 650884
logger.logp(Level.SEVERE, CLASS_NAME, "createServletWrappers", "illegal.servlet.mapping", servletName); // PK33511 // depends on control dependency: [if], data = [none]
// path = "/" + BY_NAME_ONLY + "/" + servletName;
// End 650884
} else if (path.equals("/")) {
path = "/*"; // depends on control dependency: [if], data = [none]
}
if (wrapper == null) { // 248871: Check to see if we've
// already found wrapper for
// servletName
wrapper = jspAwareCreateServletWrapper(jspProcessor,
servletConfig, servletName); // depends on control dependency: [if], data = [none]
if (wrapper == null)
continue;
}
try {
// Begin:248871: Check to see if we found the wrapper
// before adding
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "createServletWrappers"
, "determine whether to add mapping for path[{0}] wrapper[{1}] isEnabled[{2}]"
, new Object[] { path, wrapper, servletConfig.isEnabled() });
if (path != null && servletConfig.isEnabled()) {
requestMapper.addMapping(path, wrapper); // depends on control dependency: [if], data = [(path]
}
// End:248871
} catch (Exception e) {
//TODO: ???? extension processor used to call addMappingTarget after the wrappers had been added.
//Now it is done before, and you can get this exception here in the case they call addMappingTarget
//and add the mapping to the servletConfig because we'll try to add it again, but it will
//already be mapped. You could add a list of paths to ignore and not try to add again. So any
//path added via addMappingTarget will be recorded and addMapping can be skipped. It is preferrable
//to just have them not call addMappingTarget any more instead of adding the extra check.
// pk435011
logger.logp(Level.WARNING, CLASS_NAME, "createServletWrappers", "error.while.adding.servlet.mapping.for.path", new Object[] {
path, wrapper, getApplicationName() });
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(e, CLASS_NAME + ".createServletWrappers", "455", this); // depends on control dependency: [if], data = [none]
// pk435011
logger.logp(Level.SEVERE, CLASS_NAME, "createServletWrappers", "error.adding.servlet.mapping.for.servlet", new Object[] {
servletName, getApplicationName(), e }); // PK33511 // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
servletConfig.setServletWrapper(wrapper);
this.initializeNonDDRepresentableAnnotation(servletConfig);
// set the servlet wrapper on the
// servlet config so
// ServletConfig.addMapping
// can put it in the
// requestMapper
}
} } |
public class class_name {
public ProjectCalendar getByName(String calendarName)
{
ProjectCalendar calendar = null;
if (calendarName != null && calendarName.length() != 0)
{
Iterator<ProjectCalendar> iter = iterator();
while (iter.hasNext() == true)
{
calendar = iter.next();
String name = calendar.getName();
if ((name != null) && (name.equalsIgnoreCase(calendarName) == true))
{
break;
}
calendar = null;
}
}
return (calendar);
} } | public class class_name {
public ProjectCalendar getByName(String calendarName)
{
ProjectCalendar calendar = null;
if (calendarName != null && calendarName.length() != 0)
{
Iterator<ProjectCalendar> iter = iterator();
while (iter.hasNext() == true)
{
calendar = iter.next(); // depends on control dependency: [while], data = [none]
String name = calendar.getName();
if ((name != null) && (name.equalsIgnoreCase(calendarName) == true))
{
break;
}
calendar = null; // depends on control dependency: [while], data = [none]
}
}
return (calendar);
} } |
public class class_name {
public boolean isOverridden(Object instance, Method origin) {
try {
return (Boolean) mAdvice.getClass().getMethod("isOverridden", Object.class,
Method.class).invoke(mAdvice, instance, origin);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new IllegalStateException(e);
}
} } | public class class_name {
public boolean isOverridden(Object instance, Method origin) {
try {
return (Boolean) mAdvice.getClass().getMethod("isOverridden", Object.class,
Method.class).invoke(mAdvice, instance, origin); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void printElement(String name, String value, String... attributes) {
startElement(name, attributes);
if (value != null) { println(">" + escape(value) + "</" + name + ">"); } else { println("/>"); }
outdent();
} } | public class class_name {
public void printElement(String name, String value, String... attributes) {
startElement(name, attributes);
if (value != null) { println(">" + escape(value) + "</" + name + ">"); } else { println("/>"); } // depends on control dependency: [if], data = [(value] // depends on control dependency: [if], data = [none]
outdent();
} } |
public class class_name {
public ILocationData getMergedAssociatedLocation() {
List<ILocationData> allData = getAssociatedLocations();
if (allData.isEmpty()) {
return null;
}
if (allData.size() == 1) {
return allData.get(0);
}
boolean allNull = true;
SourceRelativeURI path = null;
ITextRegionWithLineInformation region = ITextRegionWithLineInformation.EMPTY_REGION;
for (ILocationData data : allData) {
if (path != null) {
if (!path.equals(data.getSrcRelativePath())) {
return null;
}
} else {
if (data.getSrcRelativePath() == null) {
if (!allNull)
throw new IllegalStateException(
"Iff multiple associated locations are present, the path has to be set");
} else {
allNull = false;
path = data.getSrcRelativePath();
}
}
region = region.merge(new TextRegionWithLineInformation(data.getOffset(), data.getLength(),
data.getLineNumber(), data.getEndLineNumber()));
}
return new LocationData(region.getOffset(), region.getLength(), region.getLineNumber(),
region.getEndLineNumber(), path);
} } | public class class_name {
public ILocationData getMergedAssociatedLocation() {
List<ILocationData> allData = getAssociatedLocations();
if (allData.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
if (allData.size() == 1) {
return allData.get(0); // depends on control dependency: [if], data = [none]
}
boolean allNull = true;
SourceRelativeURI path = null;
ITextRegionWithLineInformation region = ITextRegionWithLineInformation.EMPTY_REGION;
for (ILocationData data : allData) {
if (path != null) {
if (!path.equals(data.getSrcRelativePath())) {
return null; // depends on control dependency: [if], data = [none]
}
} else {
if (data.getSrcRelativePath() == null) {
if (!allNull)
throw new IllegalStateException(
"Iff multiple associated locations are present, the path has to be set");
} else {
allNull = false; // depends on control dependency: [if], data = [none]
path = data.getSrcRelativePath(); // depends on control dependency: [if], data = [none]
}
}
region = region.merge(new TextRegionWithLineInformation(data.getOffset(), data.getLength(),
data.getLineNumber(), data.getEndLineNumber())); // depends on control dependency: [for], data = [none]
}
return new LocationData(region.getOffset(), region.getLength(), region.getLineNumber(),
region.getEndLineNumber(), path);
} } |
public class class_name {
static StructrPropertyDefinition deserialize(final StructrTypeDefinition parent, final String name, final Map<String, Object> source) {
final String propertyType = (String)source.get(JsonSchema.KEY_TYPE);
StructrPropertyDefinition newProperty = null;
if (propertyType != null) {
final boolean isDate = source.containsKey(JsonSchema.KEY_FORMAT) && JsonSchema.FORMAT_DATE_TIME.equals(source.get(JsonSchema.KEY_FORMAT));
final boolean isEnum = source.containsKey(JsonSchema.KEY_ENUM);
switch (propertyType) {
case "string": // can be string, date, enum or script
if (isDate) {
newProperty = new StructrDateProperty(parent, name);
} else if (isEnum) {
newProperty = new StructrEnumProperty(parent, name);
} else {
newProperty = new StructrStringProperty(parent, name);
}
break;
case "password":
newProperty = new StructrPasswordProperty(parent, name);
break;
case "thumbnail":
newProperty = new StructrThumbnailProperty(parent, name);
break;
case "count":
newProperty = new StructrCountProperty(parent, name);
break;
case "script":
newProperty = new StructrScriptProperty(parent, name);
break;
case "function":
newProperty = new StructrFunctionProperty(parent, name);
break;
case "boolean":
newProperty = new StructrBooleanProperty(parent, name);
break;
case "number":
newProperty = new StructrNumberProperty(parent, name);
break;
case "integer":
newProperty = new StructrIntegerProperty(parent, name);
break;
case "long":
newProperty = new StructrLongProperty(parent, name);
break;
case "custom":
newProperty = new StructrCustomProperty(parent, name);
break;
case "encrypted":
newProperty = new StructrEncryptedStringProperty(parent, name);
break;
case "object":
// notion properties don't contain $link
if (source.containsKey(JsonSchema.KEY_REFERENCE) && !source.containsKey(JsonSchema.KEY_LINK)) {
final Object reference = source.get(JsonSchema.KEY_REFERENCE);
if (reference != null && reference instanceof String) {
final String refName = StructrPropertyDefinition.getPropertyNameFromJsonPointer(reference.toString());
newProperty = new NotionReferenceProperty(parent, name, (String)source.get(JsonSchema.KEY_REFERENCE), "object", refName);
}
}
break;
case "array":
// notion properties don't contain $link
if (!source.containsKey(JsonSchema.KEY_LINK)) {
final Map<String, Object> items = (Map)source.get(JsonSchema.KEY_ITEMS);
if (items != null) {
if (items.containsKey(JsonSchema.KEY_REFERENCE)) {
final Object reference = items.get(JsonSchema.KEY_REFERENCE);
if (reference != null && reference instanceof String) {
final String refName = StructrPropertyDefinition.getPropertyNameFromJsonPointer(reference.toString());
newProperty = new NotionReferenceProperty(parent, name, (String)source.get(JsonSchema.KEY_REFERENCE), "array", refName);
}
} else if (items.containsKey(JsonSchema.KEY_TYPE)) {
final Object typeValue = items.get(JsonSchema.KEY_TYPE);
if (typeValue != null) {
switch (typeValue.toString()) {
case "string":
newProperty = new StructrStringArrayProperty(parent, name);
break;
case "integer":
newProperty = new StructrIntegerArrayProperty(parent, name);
break;
case "long":
newProperty = new StructrLongArrayProperty(parent, name);
break;
case "number":
newProperty = new StructrNumberArrayProperty(parent, name);
break;
case "boolean":
newProperty = new StructrBooleanArrayProperty(parent, name);
break;
case "date":
newProperty = new StructrDateArrayProperty(parent, name);
break;
}
}
}
}
}
break;
}
} else {
throw new IllegalStateException("Property " + name + " has no type.");
}
if (newProperty != null) {
newProperty.deserialize(source);
}
return newProperty;
} } | public class class_name {
static StructrPropertyDefinition deserialize(final StructrTypeDefinition parent, final String name, final Map<String, Object> source) {
final String propertyType = (String)source.get(JsonSchema.KEY_TYPE);
StructrPropertyDefinition newProperty = null;
if (propertyType != null) {
final boolean isDate = source.containsKey(JsonSchema.KEY_FORMAT) && JsonSchema.FORMAT_DATE_TIME.equals(source.get(JsonSchema.KEY_FORMAT));
final boolean isEnum = source.containsKey(JsonSchema.KEY_ENUM);
switch (propertyType) {
case "string": // can be string, date, enum or script
if (isDate) {
newProperty = new StructrDateProperty(parent, name); // depends on control dependency: [if], data = [none]
} else if (isEnum) {
newProperty = new StructrEnumProperty(parent, name); // depends on control dependency: [if], data = [none]
} else {
newProperty = new StructrStringProperty(parent, name); // depends on control dependency: [if], data = [none]
}
break;
case "password":
newProperty = new StructrPasswordProperty(parent, name);
break;
case "thumbnail":
newProperty = new StructrThumbnailProperty(parent, name);
break;
case "count":
newProperty = new StructrCountProperty(parent, name);
break;
case "script":
newProperty = new StructrScriptProperty(parent, name);
break;
case "function":
newProperty = new StructrFunctionProperty(parent, name);
break;
case "boolean":
newProperty = new StructrBooleanProperty(parent, name);
break;
case "number":
newProperty = new StructrNumberProperty(parent, name);
break;
case "integer":
newProperty = new StructrIntegerProperty(parent, name);
break;
case "long":
newProperty = new StructrLongProperty(parent, name);
break;
case "custom":
newProperty = new StructrCustomProperty(parent, name);
break;
case "encrypted":
newProperty = new StructrEncryptedStringProperty(parent, name);
break;
case "object":
// notion properties don't contain $link
if (source.containsKey(JsonSchema.KEY_REFERENCE) && !source.containsKey(JsonSchema.KEY_LINK)) {
final Object reference = source.get(JsonSchema.KEY_REFERENCE);
if (reference != null && reference instanceof String) {
final String refName = StructrPropertyDefinition.getPropertyNameFromJsonPointer(reference.toString());
newProperty = new NotionReferenceProperty(parent, name, (String)source.get(JsonSchema.KEY_REFERENCE), "object", refName); // depends on control dependency: [if], data = [none]
}
}
break;
case "array":
// notion properties don't contain $link
if (!source.containsKey(JsonSchema.KEY_LINK)) {
final Map<String, Object> items = (Map)source.get(JsonSchema.KEY_ITEMS);
if (items != null) {
if (items.containsKey(JsonSchema.KEY_REFERENCE)) {
final Object reference = items.get(JsonSchema.KEY_REFERENCE);
if (reference != null && reference instanceof String) {
final String refName = StructrPropertyDefinition.getPropertyNameFromJsonPointer(reference.toString());
newProperty = new NotionReferenceProperty(parent, name, (String)source.get(JsonSchema.KEY_REFERENCE), "array", refName); // depends on control dependency: [if], data = [none]
}
} else if (items.containsKey(JsonSchema.KEY_TYPE)) {
final Object typeValue = items.get(JsonSchema.KEY_TYPE);
if (typeValue != null) {
switch (typeValue.toString()) { // depends on control dependency: [if], data = [(typeValue]
case "string":
newProperty = new StructrStringArrayProperty(parent, name);
break;
case "integer":
newProperty = new StructrIntegerArrayProperty(parent, name);
break;
case "long":
newProperty = new StructrLongArrayProperty(parent, name);
break;
case "number":
newProperty = new StructrNumberArrayProperty(parent, name);
break;
case "boolean":
newProperty = new StructrBooleanArrayProperty(parent, name);
break;
case "date":
newProperty = new StructrDateArrayProperty(parent, name);
break;
}
}
}
}
}
break;
}
} else {
throw new IllegalStateException("Property " + name + " has no type.");
}
if (newProperty != null) {
newProperty.deserialize(source); // depends on control dependency: [if], data = [none]
}
return newProperty;
} } |
public class class_name {
public static Date parse(String value) {
if (value.length() == 0) {
return null;
}
ParsePosition position = new ParsePosition(0);
Date result = STANDARD_DATE_FORMAT.get().parse(value, position);
if (position.getIndex() == value.length()) {
// STANDARD_DATE_FORMAT must match exactly; all text must be consumed, e.g. no ignored
// non-standard trailing "+01:00". Those cases are covered below.
return result;
}
synchronized (BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS) {
for (int i = 0, count = BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS.length; i < count; i++) {
DateFormat format = BROWSER_COMPATIBLE_DATE_FORMATS[i];
if (format == null) {
format = new SimpleDateFormat(BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS[i], Locale.US);
// Set the timezone to use when interpreting formats that don't have a timezone. GMT is
// specified by RFC 7231.
format.setTimeZone(UTC);
BROWSER_COMPATIBLE_DATE_FORMATS[i] = format;
}
position.setIndex(0);
result = format.parse(value, position);
if (position.getIndex() != 0) {
// Something was parsed. It's possible the entire string was not consumed but we ignore
// that. If any of the BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS ended in "'GMT'" we'd have
// to also check that position.getIndex() == value.length() otherwise parsing might have
// terminated early, ignoring things like "+01:00". Leaving this as != 0 means that any
// trailing junk is ignored.
return result;
}
}
}
return null;
} } | public class class_name {
public static Date parse(String value) {
if (value.length() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
ParsePosition position = new ParsePosition(0);
Date result = STANDARD_DATE_FORMAT.get().parse(value, position);
if (position.getIndex() == value.length()) {
// STANDARD_DATE_FORMAT must match exactly; all text must be consumed, e.g. no ignored
// non-standard trailing "+01:00". Those cases are covered below.
return result; // depends on control dependency: [if], data = [none]
}
synchronized (BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS) {
for (int i = 0, count = BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS.length; i < count; i++) {
DateFormat format = BROWSER_COMPATIBLE_DATE_FORMATS[i];
if (format == null) {
format = new SimpleDateFormat(BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS[i], Locale.US); // depends on control dependency: [if], data = [none]
// Set the timezone to use when interpreting formats that don't have a timezone. GMT is
// specified by RFC 7231.
format.setTimeZone(UTC); // depends on control dependency: [if], data = [none]
BROWSER_COMPATIBLE_DATE_FORMATS[i] = format; // depends on control dependency: [if], data = [none]
}
position.setIndex(0); // depends on control dependency: [for], data = [none]
result = format.parse(value, position); // depends on control dependency: [for], data = [none]
if (position.getIndex() != 0) {
// Something was parsed. It's possible the entire string was not consumed but we ignore
// that. If any of the BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS ended in "'GMT'" we'd have
// to also check that position.getIndex() == value.length() otherwise parsing might have
// terminated early, ignoring things like "+01:00". Leaving this as != 0 means that any
// trailing junk is ignored.
return result; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public boolean filterMatches(AbstractItem item)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "filterMatches", item);
boolean result = true;
if (selectorTree != null || discriminatorTree != null)
{
// Defect 382250, set the unlockCount from MsgStore into the message
// in the case where the message is being redelivered.
// 668676, get the message if available
JsMessage msg = ((SIMPMessage)item).getMessageIfAvailable();
if ( msg == null)
{
result = false;
}
else
{
int redelCount = ((SIMPMessage)item).guessRedeliveredCount();
if (redelCount > 0)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Set deliverycount into message: " + redelCount);
msg.setDeliveryCount(redelCount);
}
// Evaluate message against selector tree
result =
consumerDispatcher.getMessageProcessor().getMessageProcessorMatching().evaluateMessage(
selectorTree,
discriminatorTree,
msg);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "filterMatches", Boolean.valueOf(result));
return result;
} } | public class class_name {
public boolean filterMatches(AbstractItem item)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "filterMatches", item);
boolean result = true;
if (selectorTree != null || discriminatorTree != null)
{
// Defect 382250, set the unlockCount from MsgStore into the message
// in the case where the message is being redelivered.
// 668676, get the message if available
JsMessage msg = ((SIMPMessage)item).getMessageIfAvailable();
if ( msg == null)
{
result = false; // depends on control dependency: [if], data = [none]
}
else
{
int redelCount = ((SIMPMessage)item).guessRedeliveredCount();
if (redelCount > 0)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Set deliverycount into message: " + redelCount);
msg.setDeliveryCount(redelCount); // depends on control dependency: [if], data = [(redelCount]
}
// Evaluate message against selector tree
result =
consumerDispatcher.getMessageProcessor().getMessageProcessorMatching().evaluateMessage(
selectorTree,
discriminatorTree,
msg); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "filterMatches", Boolean.valueOf(result));
return result;
} } |
public class class_name {
protected void removeUnsupportedLanguageElements(Document doc) throws JaxenException {
String[] unsupportedLanguages = new String[]{
"ar", "bg", "ca", "cs", "da", "el", "et", "fa", "fi", "he", "hi", "hu",
"id", "it", "ja", "ko", "lt", "lv", "no", "pl", "pt", "ro", "ru", "sk",
"sl", "sv", "th", "tr", "uk", "vi", "zh",
};
List nodes = XmlUtils.newXPath(
"/io:root/io:property/io:desc | " +
"/io:root/io:property/io:images/io:image/io:title",
doc).selectNodes(doc);
for (Object item : nodes) {
Element node = (Element) item;
List childNodes = XmlUtils.newXPath(
"*", doc).selectNodes(node);
for (Object childItem : childNodes) {
Element langNode = (Element) childItem;
String lang = langNode.getLocalName().toLowerCase();
if (ArrayUtils.contains(unsupportedLanguages, lang)) {
node.removeChild(langNode);
}
}
}
} } | public class class_name {
protected void removeUnsupportedLanguageElements(Document doc) throws JaxenException {
String[] unsupportedLanguages = new String[]{
"ar", "bg", "ca", "cs", "da", "el", "et", "fa", "fi", "he", "hi", "hu",
"id", "it", "ja", "ko", "lt", "lv", "no", "pl", "pt", "ro", "ru", "sk",
"sl", "sv", "th", "tr", "uk", "vi", "zh",
};
List nodes = XmlUtils.newXPath(
"/io:root/io:property/io:desc | " +
"/io:root/io:property/io:images/io:image/io:title",
doc).selectNodes(doc);
for (Object item : nodes) {
Element node = (Element) item;
List childNodes = XmlUtils.newXPath(
"*", doc).selectNodes(node);
for (Object childItem : childNodes) {
Element langNode = (Element) childItem;
String lang = langNode.getLocalName().toLowerCase();
if (ArrayUtils.contains(unsupportedLanguages, lang)) {
node.removeChild(langNode); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
@Override
public boolean persistState() {
if (!safeMode) {
LOG.info(
"Cannot persist state because ClusterManager is not in Safe Mode");
return false;
}
try {
JsonGenerator jsonGenerator = CoronaSerializer.createJsonGenerator(conf);
jsonGenerator.writeStartObject();
jsonGenerator.writeFieldName("startTime");
jsonGenerator.writeNumber(startTime);
jsonGenerator.writeFieldName("nodeManager");
nodeManager.write(jsonGenerator);
jsonGenerator.writeFieldName("sessionManager");
sessionManager.write(jsonGenerator);
jsonGenerator.writeFieldName("sessionNotifier");
sessionNotifier.write(jsonGenerator);
jsonGenerator.writeEndObject();
jsonGenerator.close();
} catch (IOException e) {
LOG.info("Could not persist the state: ", e);
return false;
}
return true;
} } | public class class_name {
@Override
public boolean persistState() {
if (!safeMode) {
LOG.info(
"Cannot persist state because ClusterManager is not in Safe Mode"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
try {
JsonGenerator jsonGenerator = CoronaSerializer.createJsonGenerator(conf);
jsonGenerator.writeStartObject(); // depends on control dependency: [try], data = [none]
jsonGenerator.writeFieldName("startTime"); // depends on control dependency: [try], data = [none]
jsonGenerator.writeNumber(startTime); // depends on control dependency: [try], data = [none]
jsonGenerator.writeFieldName("nodeManager"); // depends on control dependency: [try], data = [none]
nodeManager.write(jsonGenerator); // depends on control dependency: [try], data = [none]
jsonGenerator.writeFieldName("sessionManager"); // depends on control dependency: [try], data = [none]
sessionManager.write(jsonGenerator); // depends on control dependency: [try], data = [none]
jsonGenerator.writeFieldName("sessionNotifier"); // depends on control dependency: [try], data = [none]
sessionNotifier.write(jsonGenerator); // depends on control dependency: [try], data = [none]
jsonGenerator.writeEndObject(); // depends on control dependency: [try], data = [none]
jsonGenerator.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOG.info("Could not persist the state: ", e);
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
private BufferedImage create_TICKMARKS_Image(final int WIDTH) {
if (WIDTH <= 0) {
return null;
}
final BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT);
final Graphics2D G2 = IMAGE.createGraphics();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
final int IMAGE_WIDTH = IMAGE.getWidth();
final AffineTransform OLD_TRANSFORM = G2.getTransform();
final BasicStroke THIN_STROKE = new BasicStroke(0.01f * IMAGE_WIDTH, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
final Font FONT = new Font("Verdana", 0, (int) (0.0747663551f * IMAGE_WIDTH));
final float TEXT_DISTANCE = 0.1f * IMAGE_WIDTH;
final float MIN_LENGTH = 0.02f * IMAGE_WIDTH;
final float MED_LENGTH = 0.04f * IMAGE_WIDTH;
// Create the watch itself
final float RADIUS = IMAGE_WIDTH * 0.37f;
CENTER.setLocation(IMAGE_WIDTH / 2.0f, IMAGE_WIDTH / 2.0f);
// Draw ticks
Point2D innerPoint = new Point2D.Double();
Point2D outerPoint = new Point2D.Double();
Point2D textPoint = new Point2D.Double();
Line2D tick;
int tickCounterFull = 0;
int tickCounterHalf = 0;
int counter = 0;
double sinValue = 0;
double cosValue = 0;
final double STEP = (2.0 * Math.PI) / (20.0);
if (isTickmarkColorFromThemeEnabled()) {
G2.setColor(getBackgroundColor().LABEL_COLOR);
} else {
G2.setColor(getTickmarkColor());
}
for (double alpha = 2.0 * Math.PI; alpha >= 0; alpha -= STEP) {
G2.setStroke(THIN_STROKE);
sinValue = Math.sin(alpha);
cosValue = Math.cos(alpha);
if (tickCounterHalf == 1) {
G2.setStroke(THIN_STROKE);
innerPoint.setLocation(CENTER.getX() + (RADIUS - MIN_LENGTH) * sinValue, CENTER.getY() + (RADIUS - MIN_LENGTH) * cosValue);
outerPoint.setLocation(CENTER.getX() + RADIUS * sinValue, CENTER.getY() + RADIUS * cosValue);
// Draw ticks
tick = new Line2D.Double(innerPoint.getX(), innerPoint.getY(), outerPoint.getX(), outerPoint.getY());
G2.draw(tick);
tickCounterHalf = 0;
}
// Different tickmark every 15 units
if (tickCounterFull == 2) {
G2.setStroke(THIN_STROKE);
innerPoint.setLocation(CENTER.getX() + (RADIUS - MED_LENGTH) * sinValue, CENTER.getY() + (RADIUS - MED_LENGTH) * cosValue);
outerPoint.setLocation(CENTER.getX() + RADIUS * sinValue, CENTER.getY() + RADIUS * cosValue);
// Draw ticks
tick = new Line2D.Double(innerPoint.getX(), innerPoint.getY(), outerPoint.getX(), outerPoint.getY());
G2.draw(tick);
tickCounterFull = 0;
}
// Draw text
G2.setFont(FONT);
textPoint.setLocation(CENTER.getX() + (RADIUS - TEXT_DISTANCE) * sinValue, CENTER.getY() + (RADIUS - TEXT_DISTANCE) * cosValue);
if (counter != 20 && counter % 2 == 0) {
G2.rotate(Math.toRadians(0), CENTER.getX(), CENTER.getY());
G2.fill(UTIL.rotateTextAroundCenter(G2, String.valueOf(counter / 2), (int) textPoint.getX(), (int) textPoint.getY(), (2 * Math.PI - alpha)));
}
G2.setTransform(OLD_TRANSFORM);
tickCounterHalf++;
tickCounterFull++;
counter++;
}
G2.dispose();
return IMAGE;
} } | public class class_name {
private BufferedImage create_TICKMARKS_Image(final int WIDTH) {
if (WIDTH <= 0) {
return null; // depends on control dependency: [if], data = [none]
}
final BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT);
final Graphics2D G2 = IMAGE.createGraphics();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
final int IMAGE_WIDTH = IMAGE.getWidth();
final AffineTransform OLD_TRANSFORM = G2.getTransform();
final BasicStroke THIN_STROKE = new BasicStroke(0.01f * IMAGE_WIDTH, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL);
final Font FONT = new Font("Verdana", 0, (int) (0.0747663551f * IMAGE_WIDTH));
final float TEXT_DISTANCE = 0.1f * IMAGE_WIDTH;
final float MIN_LENGTH = 0.02f * IMAGE_WIDTH;
final float MED_LENGTH = 0.04f * IMAGE_WIDTH;
// Create the watch itself
final float RADIUS = IMAGE_WIDTH * 0.37f;
CENTER.setLocation(IMAGE_WIDTH / 2.0f, IMAGE_WIDTH / 2.0f);
// Draw ticks
Point2D innerPoint = new Point2D.Double();
Point2D outerPoint = new Point2D.Double();
Point2D textPoint = new Point2D.Double();
Line2D tick;
int tickCounterFull = 0;
int tickCounterHalf = 0;
int counter = 0;
double sinValue = 0;
double cosValue = 0;
final double STEP = (2.0 * Math.PI) / (20.0);
if (isTickmarkColorFromThemeEnabled()) {
G2.setColor(getBackgroundColor().LABEL_COLOR); // depends on control dependency: [if], data = [none]
} else {
G2.setColor(getTickmarkColor()); // depends on control dependency: [if], data = [none]
}
for (double alpha = 2.0 * Math.PI; alpha >= 0; alpha -= STEP) {
G2.setStroke(THIN_STROKE); // depends on control dependency: [for], data = [none]
sinValue = Math.sin(alpha); // depends on control dependency: [for], data = [alpha]
cosValue = Math.cos(alpha); // depends on control dependency: [for], data = [alpha]
if (tickCounterHalf == 1) {
G2.setStroke(THIN_STROKE); // depends on control dependency: [if], data = [none]
innerPoint.setLocation(CENTER.getX() + (RADIUS - MIN_LENGTH) * sinValue, CENTER.getY() + (RADIUS - MIN_LENGTH) * cosValue); // depends on control dependency: [if], data = [none]
outerPoint.setLocation(CENTER.getX() + RADIUS * sinValue, CENTER.getY() + RADIUS * cosValue); // depends on control dependency: [if], data = [none]
// Draw ticks
tick = new Line2D.Double(innerPoint.getX(), innerPoint.getY(), outerPoint.getX(), outerPoint.getY()); // depends on control dependency: [if], data = [none]
G2.draw(tick); // depends on control dependency: [if], data = [none]
tickCounterHalf = 0; // depends on control dependency: [if], data = [none]
}
// Different tickmark every 15 units
if (tickCounterFull == 2) {
G2.setStroke(THIN_STROKE); // depends on control dependency: [if], data = [none]
innerPoint.setLocation(CENTER.getX() + (RADIUS - MED_LENGTH) * sinValue, CENTER.getY() + (RADIUS - MED_LENGTH) * cosValue); // depends on control dependency: [if], data = [none]
outerPoint.setLocation(CENTER.getX() + RADIUS * sinValue, CENTER.getY() + RADIUS * cosValue); // depends on control dependency: [if], data = [none]
// Draw ticks
tick = new Line2D.Double(innerPoint.getX(), innerPoint.getY(), outerPoint.getX(), outerPoint.getY()); // depends on control dependency: [if], data = [none]
G2.draw(tick); // depends on control dependency: [if], data = [none]
tickCounterFull = 0; // depends on control dependency: [if], data = [none]
}
// Draw text
G2.setFont(FONT); // depends on control dependency: [for], data = [none]
textPoint.setLocation(CENTER.getX() + (RADIUS - TEXT_DISTANCE) * sinValue, CENTER.getY() + (RADIUS - TEXT_DISTANCE) * cosValue); // depends on control dependency: [for], data = [none]
if (counter != 20 && counter % 2 == 0) {
G2.rotate(Math.toRadians(0), CENTER.getX(), CENTER.getY()); // depends on control dependency: [if], data = [0)]
G2.fill(UTIL.rotateTextAroundCenter(G2, String.valueOf(counter / 2), (int) textPoint.getX(), (int) textPoint.getY(), (2 * Math.PI - alpha))); // depends on control dependency: [if], data = [none]
}
G2.setTransform(OLD_TRANSFORM); // depends on control dependency: [for], data = [none]
tickCounterHalf++; // depends on control dependency: [for], data = [none]
tickCounterFull++; // depends on control dependency: [for], data = [none]
counter++; // depends on control dependency: [for], data = [none]
}
G2.dispose();
return IMAGE;
} } |
public class class_name {
private void addToken(final MutationToken token) {
if (token != null) {
ListIterator<MutationToken> tokenIterator = tokens.listIterator();
while (tokenIterator.hasNext()) {
MutationToken t = tokenIterator.next();
if (t.vbucketID() == token.vbucketID() && t.bucket().equals(token.bucket())) {
if (token.sequenceNumber() > t.sequenceNumber()) {
tokenIterator.set(token);
}
return;
}
}
tokens.add(token);
}
} } | public class class_name {
private void addToken(final MutationToken token) {
if (token != null) {
ListIterator<MutationToken> tokenIterator = tokens.listIterator();
while (tokenIterator.hasNext()) {
MutationToken t = tokenIterator.next();
if (t.vbucketID() == token.vbucketID() && t.bucket().equals(token.bucket())) {
if (token.sequenceNumber() > t.sequenceNumber()) {
tokenIterator.set(token); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
}
tokens.add(token); // depends on control dependency: [if], data = [(token]
}
} } |
public class class_name {
public NetworkInterface withIpv6Addresses(NetworkInterfaceIpv6Address... ipv6Addresses) {
if (this.ipv6Addresses == null) {
setIpv6Addresses(new com.amazonaws.internal.SdkInternalList<NetworkInterfaceIpv6Address>(ipv6Addresses.length));
}
for (NetworkInterfaceIpv6Address ele : ipv6Addresses) {
this.ipv6Addresses.add(ele);
}
return this;
} } | public class class_name {
public NetworkInterface withIpv6Addresses(NetworkInterfaceIpv6Address... ipv6Addresses) {
if (this.ipv6Addresses == null) {
setIpv6Addresses(new com.amazonaws.internal.SdkInternalList<NetworkInterfaceIpv6Address>(ipv6Addresses.length)); // depends on control dependency: [if], data = [none]
}
for (NetworkInterfaceIpv6Address ele : ipv6Addresses) {
this.ipv6Addresses.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public CmsUUID getElementView() {
String elementViewString = getString(CmsEditorConstants.ATTR_ELEMENT_VIEW);
if (elementViewString == null) {
return null;
}
return new CmsUUID(elementViewString);
} } | public class class_name {
public CmsUUID getElementView() {
String elementViewString = getString(CmsEditorConstants.ATTR_ELEMENT_VIEW);
if (elementViewString == null) {
return null; // depends on control dependency: [if], data = [none]
}
return new CmsUUID(elementViewString);
} } |
public class class_name {
public Integer getFileSizeThreshold()
{
if (childNode.getTextValueForPatternName("file-size-threshold") != null && !childNode.getTextValueForPatternName("file-size-threshold").equals("null")) {
return Integer.valueOf(childNode.getTextValueForPatternName("file-size-threshold"));
}
return null;
} } | public class class_name {
public Integer getFileSizeThreshold()
{
if (childNode.getTextValueForPatternName("file-size-threshold") != null && !childNode.getTextValueForPatternName("file-size-threshold").equals("null")) {
return Integer.valueOf(childNode.getTextValueForPatternName("file-size-threshold")); // depends on control dependency: [if], data = [(childNode.getTextValueForPatternName("file-size-threshold")]
}
return null;
} } |
public class class_name {
@Override
public void beginImport() {
if (m_emf == null) {
m_emf = Persistence.createEntityManagerFactory(m_persistenceUnitName);
}
m_em = m_emf.createEntityManager();
m_batch = new ArrayList(m_batchSize);
} } | public class class_name {
@Override
public void beginImport() {
if (m_emf == null) {
m_emf = Persistence.createEntityManagerFactory(m_persistenceUnitName);
// depends on control dependency: [if], data = [none]
}
m_em = m_emf.createEntityManager();
m_batch = new ArrayList(m_batchSize);
} } |
public class class_name {
public NamedNativeQuery<Entity<T>> getOrCreateNamedNativeQuery()
{
List<Node> nodeList = childNode.get("named-native-query");
if (nodeList != null && nodeList.size() > 0)
{
return new NamedNativeQueryImpl<Entity<T>>(this, "named-native-query", childNode, nodeList.get(0));
}
return createNamedNativeQuery();
} } | public class class_name {
public NamedNativeQuery<Entity<T>> getOrCreateNamedNativeQuery()
{
List<Node> nodeList = childNode.get("named-native-query");
if (nodeList != null && nodeList.size() > 0)
{
return new NamedNativeQueryImpl<Entity<T>>(this, "named-native-query", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createNamedNativeQuery();
} } |
public class class_name {
public boolean hasPermissionsById(String id, String... permissions) {
List<Permission> resolvedPermissions = Lists.newArrayListWithCapacity(permissions.length);
for (String permission : permissions) {
resolvedPermissions.add(getPermissionResolver().resolvePermission(permission));
}
return hasPermissionsById(id, resolvedPermissions);
} } | public class class_name {
public boolean hasPermissionsById(String id, String... permissions) {
List<Permission> resolvedPermissions = Lists.newArrayListWithCapacity(permissions.length);
for (String permission : permissions) {
resolvedPermissions.add(getPermissionResolver().resolvePermission(permission)); // depends on control dependency: [for], data = [permission]
}
return hasPermissionsById(id, resolvedPermissions);
} } |
public class class_name {
public Namer getManyToOneIntermediateNamer(Namer fromEntityNamer, ColumnConfig pointsOnToEntity, Namer toEntityNamer) {
// new configuration
Namer result = getManyToOneNamerFromConf(pointsOnToEntity, toEntityNamer);
// fallback
if (result == null) {
// NOTE: we use the many to many fallback as it is totally complient with intermediate m2o fallback expectations.
result = getManyToManyNamerFallBack(fromEntityNamer, pointsOnToEntity, toEntityNamer);
}
return result;
} } | public class class_name {
public Namer getManyToOneIntermediateNamer(Namer fromEntityNamer, ColumnConfig pointsOnToEntity, Namer toEntityNamer) {
// new configuration
Namer result = getManyToOneNamerFromConf(pointsOnToEntity, toEntityNamer);
// fallback
if (result == null) {
// NOTE: we use the many to many fallback as it is totally complient with intermediate m2o fallback expectations.
result = getManyToManyNamerFallBack(fromEntityNamer, pointsOnToEntity, toEntityNamer); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@SuppressWarnings("fallthrough")
protected DCText inlineWord() {
int pos = bp;
int depth = 0;
loop:
while (bp < buflen) {
switch (ch) {
case '\n':
newline = true;
// fallthrough
case '\r': case '\f': case ' ': case '\t':
return m.at(pos).newTextTree(newString(pos, bp));
case '@':
if (newline)
break loop;
case '{':
depth++;
break;
case '}':
if (depth == 0 || --depth == 0)
return m.at(pos).newTextTree(newString(pos, bp));
break;
}
newline = false;
nextChar();
}
return null;
} } | public class class_name {
@SuppressWarnings("fallthrough")
protected DCText inlineWord() {
int pos = bp;
int depth = 0;
loop:
while (bp < buflen) {
switch (ch) {
case '\n':
newline = true;
// fallthrough
case '\r': case '\f': case ' ': case '\t':
return m.at(pos).newTextTree(newString(pos, bp));
case '@':
if (newline)
break loop;
case '{':
depth++;
break;
case '}':
if (depth == 0 || --depth == 0)
return m.at(pos).newTextTree(newString(pos, bp));
break;
}
newline = false; // depends on control dependency: [while], data = [none]
nextChar(); // depends on control dependency: [while], data = [none]
}
return null;
} } |
public class class_name {
public void reportGenericFailure(SmackWrappedException exception) {
assert exception != null;
connectionLock.lock();
try {
state = State.Failure;
this.smackWrappedExcpetion = exception;
condition.signalAll();
}
finally {
connectionLock.unlock();
}
} } | public class class_name {
public void reportGenericFailure(SmackWrappedException exception) {
assert exception != null;
connectionLock.lock();
try {
state = State.Failure; // depends on control dependency: [try], data = [none]
this.smackWrappedExcpetion = exception; // depends on control dependency: [try], data = [exception]
condition.signalAll(); // depends on control dependency: [try], data = [none]
}
finally {
connectionLock.unlock();
}
} } |
public class class_name {
public ClientConfig setIdleConnectionTimeout(long idleConnectionTimeout, TimeUnit unit) {
if (idleConnectionTimeout <= 0) {
this.idleConnectionTimeoutMs = -1;
} else {
if(unit.toMinutes(idleConnectionTimeout) < 10) {
throw new IllegalArgumentException("idleConnectionTimeout should be minimum of 10 minutes");
}
this.idleConnectionTimeoutMs = unit.toMillis(idleConnectionTimeout);
}
return this;
} } | public class class_name {
public ClientConfig setIdleConnectionTimeout(long idleConnectionTimeout, TimeUnit unit) {
if (idleConnectionTimeout <= 0) {
this.idleConnectionTimeoutMs = -1; // depends on control dependency: [if], data = [none]
} else {
if(unit.toMinutes(idleConnectionTimeout) < 10) {
throw new IllegalArgumentException("idleConnectionTimeout should be minimum of 10 minutes");
}
this.idleConnectionTimeoutMs = unit.toMillis(idleConnectionTimeout); // depends on control dependency: [if], data = [(idleConnectionTimeout]
}
return this;
} } |
public class class_name {
private void addDependent(String pathName, String relativeTo) {
if (relativeTo != null) {
Set<String> dependents = dependenctRelativePaths.get(relativeTo);
if (dependents == null) {
dependents = new HashSet<String>();
dependenctRelativePaths.put(relativeTo, dependents);
}
dependents.add(pathName);
}
} } | public class class_name {
private void addDependent(String pathName, String relativeTo) {
if (relativeTo != null) {
Set<String> dependents = dependenctRelativePaths.get(relativeTo);
if (dependents == null) {
dependents = new HashSet<String>(); // depends on control dependency: [if], data = [none]
dependenctRelativePaths.put(relativeTo, dependents); // depends on control dependency: [if], data = [none]
}
dependents.add(pathName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
if(null != m_firstWalker)
{
m_firstWalker.setRoot(context);
m_lastUsedWalker = m_firstWalker;
}
} } | public class class_name {
public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
if(null != m_firstWalker)
{
m_firstWalker.setRoot(context); // depends on control dependency: [if], data = [none]
m_lastUsedWalker = m_firstWalker; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
private CachedFieldValue getCacheFieldValueFromObject(Object objWithKeyParam)
{
if(objWithKeyParam == null)
{
return null;
}
//Get Word...
Method methodGetWord = CacheUtil.getMethod(
objWithKeyParam.getClass(),
CustomCode.IWord.METHOD_getWord);
//Get Value...
Method methodGetValue = CacheUtil.getMethod(
objWithKeyParam.getClass(),
CustomCode.ADataType.METHOD_getValue);
//Word...
Object getWordObj = CacheUtil.invoke(methodGetWord, objWithKeyParam);
String getWordVal = null;
if(getWordObj instanceof String)
{
getWordVal = (String)getWordObj;
}
//Value...
Object getValueObj;
if(FlowJobType.MULTIPLE_CHOICE.equals(getWordVal))
{
MultiChoice multiChoice = new MultiChoice();
//Available Choices...
Method methodAvailableChoices = getMethod(
objWithKeyParam.getClass(),
CustomCode.MultipleChoice.METHOD_getAvailableChoices);
Object availChoicesObj =
CacheUtil.invoke(methodAvailableChoices, objWithKeyParam);
if(availChoicesObj instanceof List)
{
multiChoice.setAvailableMultiChoices((List)availChoicesObj);
}
//Selected...
Method methodSelectedChoices = getMethod(
objWithKeyParam.getClass(),
CustomCode.MultipleChoice.METHOD_getSelectedChoices);
Object selectedChoicesObj =
invoke(methodSelectedChoices, objWithKeyParam);
if(selectedChoicesObj instanceof List)
{
multiChoice.setSelectedMultiChoices((List)selectedChoicesObj);
}
getValueObj = multiChoice;
}
else
{
getValueObj = CacheUtil.invoke(methodGetValue, objWithKeyParam);
}
if(getValueObj == null)
{
return null;
}
if(getWordVal == null)
{
throw new FluidCacheException(
"Get Word value is 'null'. Not allowed.");
}
CachedFieldValue returnVal = new CachedFieldValue();
returnVal.dataType = getWordVal;
returnVal.cachedFieldValue = getValueObj;
return returnVal;
} } | public class class_name {
@SuppressWarnings("unchecked")
private CachedFieldValue getCacheFieldValueFromObject(Object objWithKeyParam)
{
if(objWithKeyParam == null)
{
return null; // depends on control dependency: [if], data = [none]
}
//Get Word...
Method methodGetWord = CacheUtil.getMethod(
objWithKeyParam.getClass(),
CustomCode.IWord.METHOD_getWord);
//Get Value...
Method methodGetValue = CacheUtil.getMethod(
objWithKeyParam.getClass(),
CustomCode.ADataType.METHOD_getValue);
//Word...
Object getWordObj = CacheUtil.invoke(methodGetWord, objWithKeyParam);
String getWordVal = null;
if(getWordObj instanceof String)
{
getWordVal = (String)getWordObj; // depends on control dependency: [if], data = [none]
}
//Value...
Object getValueObj;
if(FlowJobType.MULTIPLE_CHOICE.equals(getWordVal))
{
MultiChoice multiChoice = new MultiChoice();
//Available Choices...
Method methodAvailableChoices = getMethod(
objWithKeyParam.getClass(),
CustomCode.MultipleChoice.METHOD_getAvailableChoices);
Object availChoicesObj =
CacheUtil.invoke(methodAvailableChoices, objWithKeyParam);
if(availChoicesObj instanceof List)
{
multiChoice.setAvailableMultiChoices((List)availChoicesObj); // depends on control dependency: [if], data = [none]
}
//Selected...
Method methodSelectedChoices = getMethod(
objWithKeyParam.getClass(),
CustomCode.MultipleChoice.METHOD_getSelectedChoices);
Object selectedChoicesObj =
invoke(methodSelectedChoices, objWithKeyParam);
if(selectedChoicesObj instanceof List)
{
multiChoice.setSelectedMultiChoices((List)selectedChoicesObj); // depends on control dependency: [if], data = [none]
}
getValueObj = multiChoice; // depends on control dependency: [if], data = [none]
}
else
{
getValueObj = CacheUtil.invoke(methodGetValue, objWithKeyParam); // depends on control dependency: [if], data = [none]
}
if(getValueObj == null)
{
return null; // depends on control dependency: [if], data = [none]
}
if(getWordVal == null)
{
throw new FluidCacheException(
"Get Word value is 'null'. Not allowed.");
}
CachedFieldValue returnVal = new CachedFieldValue();
returnVal.dataType = getWordVal;
returnVal.cachedFieldValue = getValueObj;
return returnVal;
} } |
public class class_name {
public void timeBagOfPrimitivesReflectionStreaming(int reps) throws Exception {
for (int i=0; i<reps; ++i) {
StringReader reader = new StringReader(json);
JsonReader jr = new JsonReader(reader);
jr.beginObject();
BagOfPrimitives bag = new BagOfPrimitives();
while(jr.hasNext()) {
String name = jr.nextName();
for (Field field : BagOfPrimitives.class.getDeclaredFields()) {
if (field.getName().equals(name)) {
Class<?> fieldType = field.getType();
if (fieldType.equals(long.class)) {
field.setLong(bag, jr.nextLong());
} else if (fieldType.equals(int.class)) {
field.setInt(bag, jr.nextInt());
} else if (fieldType.equals(boolean.class)) {
field.setBoolean(bag, jr.nextBoolean());
} else if (fieldType.equals(String.class)) {
field.set(bag, jr.nextString());
} else {
throw new RuntimeException("Unexpected: type: " + fieldType + ", name: " + name);
}
}
}
}
jr.endObject();
}
} } | public class class_name {
public void timeBagOfPrimitivesReflectionStreaming(int reps) throws Exception {
for (int i=0; i<reps; ++i) {
StringReader reader = new StringReader(json);
JsonReader jr = new JsonReader(reader);
jr.beginObject();
BagOfPrimitives bag = new BagOfPrimitives();
while(jr.hasNext()) {
String name = jr.nextName();
for (Field field : BagOfPrimitives.class.getDeclaredFields()) {
if (field.getName().equals(name)) {
Class<?> fieldType = field.getType();
if (fieldType.equals(long.class)) {
field.setLong(bag, jr.nextLong()); // depends on control dependency: [if], data = [none]
} else if (fieldType.equals(int.class)) {
field.setInt(bag, jr.nextInt()); // depends on control dependency: [if], data = [none]
} else if (fieldType.equals(boolean.class)) {
field.setBoolean(bag, jr.nextBoolean()); // depends on control dependency: [if], data = [none]
} else if (fieldType.equals(String.class)) {
field.set(bag, jr.nextString()); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Unexpected: type: " + fieldType + ", name: " + name);
}
}
}
}
jr.endObject();
}
} } |
public class class_name {
private List<String> getAllPConfigurationKeyValues(ConfigurationProvider configuration) {
List<String> keyValues = new ArrayList<String>();
for (String key : configuration.keys()) {
keyValues.add(key + "=\"" + configuration.getString(key) + "\"");
}
Collections.sort(keyValues);
return keyValues;
} } | public class class_name {
private List<String> getAllPConfigurationKeyValues(ConfigurationProvider configuration) {
List<String> keyValues = new ArrayList<String>();
for (String key : configuration.keys()) {
keyValues.add(key + "=\"" + configuration.getString(key) + "\""); // depends on control dependency: [for], data = [key]
}
Collections.sort(keyValues);
return keyValues;
} } |
public class class_name {
public void setValue(int value) {
if(value < min || value > max) {
throw new IllegalArgumentException("The value " + value + " is out of the admitted range [" + min + ", " + max + "].");
}
if(value != min && value != max) {
if(timer == null) {
logger.trace("creating timer");
timer = new Timer(50, this);
}
if(!timer.isRunning()) {
logger.trace("starting timer");
timer.start();
}
} else {
logger.trace("value is '{}' (in range [{}, {}]", value, min, max);
if(timer != null && timer.isRunning()) {
logger.trace("stopping timer");
timer.stop();
// unless we force a repaint, the component may stop at 99%
repaint();
}
}
this.value = value;
} } | public class class_name {
public void setValue(int value) {
if(value < min || value > max) {
throw new IllegalArgumentException("The value " + value + " is out of the admitted range [" + min + ", " + max + "].");
}
if(value != min && value != max) {
if(timer == null) {
logger.trace("creating timer"); // depends on control dependency: [if], data = [none]
timer = new Timer(50, this); // depends on control dependency: [if], data = [none]
}
if(!timer.isRunning()) {
logger.trace("starting timer"); // depends on control dependency: [if], data = [none]
timer.start(); // depends on control dependency: [if], data = [none]
}
} else {
logger.trace("value is '{}' (in range [{}, {}]", value, min, max); // depends on control dependency: [if], data = [none]
if(timer != null && timer.isRunning()) {
logger.trace("stopping timer"); // depends on control dependency: [if], data = [none]
timer.stop(); // depends on control dependency: [if], data = [none]
// unless we force a repaint, the component may stop at 99%
repaint(); // depends on control dependency: [if], data = [none]
}
}
this.value = value;
} } |
public class class_name {
protected RegistryAuth registryAuth() throws MojoExecutionException {
if (settings != null && serverId != null) {
final Server server = settings.getServer(serverId);
if (server != null) {
final RegistryAuth.Builder registryAuthBuilder = RegistryAuth.builder();
final String username = server.getUsername();
String password = server.getPassword();
if (secDispatcher != null) {
try {
password = secDispatcher.decrypt(password);
} catch (SecDispatcherException ex) {
throw new MojoExecutionException("Cannot decrypt password from settings", ex);
}
}
final String email = getEmail(server);
if (!isNullOrEmpty(username)) {
registryAuthBuilder.username(username);
}
if (!isNullOrEmpty(email)) {
registryAuthBuilder.email(email);
}
if (!isNullOrEmpty(password)) {
registryAuthBuilder.password(password);
}
if (!isNullOrEmpty(registryUrl)) {
registryAuthBuilder.serverAddress(registryUrl);
}
return registryAuthBuilder.build();
} else {
// settings.xml has no entry for the configured serverId, warn the user
getLog().warn("No entry found in settings.xml for serverId=" + serverId
+ ", cannot configure authentication for that registry");
}
}
return null;
} } | public class class_name {
protected RegistryAuth registryAuth() throws MojoExecutionException {
if (settings != null && serverId != null) {
final Server server = settings.getServer(serverId);
if (server != null) {
final RegistryAuth.Builder registryAuthBuilder = RegistryAuth.builder();
final String username = server.getUsername();
String password = server.getPassword();
if (secDispatcher != null) {
try {
password = secDispatcher.decrypt(password); // depends on control dependency: [try], data = [none]
} catch (SecDispatcherException ex) {
throw new MojoExecutionException("Cannot decrypt password from settings", ex);
} // depends on control dependency: [catch], data = [none]
}
final String email = getEmail(server);
if (!isNullOrEmpty(username)) {
registryAuthBuilder.username(username); // depends on control dependency: [if], data = [none]
}
if (!isNullOrEmpty(email)) {
registryAuthBuilder.email(email); // depends on control dependency: [if], data = [none]
}
if (!isNullOrEmpty(password)) {
registryAuthBuilder.password(password); // depends on control dependency: [if], data = [none]
}
if (!isNullOrEmpty(registryUrl)) {
registryAuthBuilder.serverAddress(registryUrl); // depends on control dependency: [if], data = [none]
}
return registryAuthBuilder.build(); // depends on control dependency: [if], data = [none]
} else {
// settings.xml has no entry for the configured serverId, warn the user
getLog().warn("No entry found in settings.xml for serverId=" + serverId
+ ", cannot configure authentication for that registry"); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static Map<String, Method> getPropGetMethodList(final Class<?> cls) {
Map<String, Method> getterMethodList = entityDeclaredPropGetMethodPool.get(cls);
if (getterMethodList == null) {
loadPropGetSetMethodList(cls);
getterMethodList = entityDeclaredPropGetMethodPool.get(cls);
}
return getterMethodList;
} } | public class class_name {
public static Map<String, Method> getPropGetMethodList(final Class<?> cls) {
Map<String, Method> getterMethodList = entityDeclaredPropGetMethodPool.get(cls);
if (getterMethodList == null) {
loadPropGetSetMethodList(cls);
// depends on control dependency: [if], data = [none]
getterMethodList = entityDeclaredPropGetMethodPool.get(cls);
// depends on control dependency: [if], data = [none]
}
return getterMethodList;
} } |
public class class_name {
private Optional<T> getServerIdToTry() {
if (m_serverIdsToTry.isEmpty()) {
final Collection<T> moreCandidates = getMoreCandidates();
if (moreCandidates.isEmpty()) {
// We were unable to find more candidates. To avoid hammering
// the service that provides potential candidates, flag that we
// should sleep for a little while before trying again to get
// more potential candidates.
m_sleepBeforeTryingToGetMoreCandidates = true;
return (new NoneImpl<T>());
} else {
// We successfully retrieved more candidates. We clear the
// flag that prevented requesting more potential candidates,
// since all is well. Since we have candidates with which to
// work, we probably will not be hitting the service that
// provides potential candidates any time soon.
m_sleepBeforeTryingToGetMoreCandidates = false;
m_serverIdsToTry.addAll(moreCandidates);
return (new SomeImpl<T>(m_serverIdsToTry.remove(0)));
}
} else {
// We already have servers to try. Try one of them.
return (new SomeImpl<T>(m_serverIdsToTry.remove(0)));
}
} } | public class class_name {
private Optional<T> getServerIdToTry() {
if (m_serverIdsToTry.isEmpty()) {
final Collection<T> moreCandidates = getMoreCandidates();
if (moreCandidates.isEmpty()) {
// We were unable to find more candidates. To avoid hammering
// the service that provides potential candidates, flag that we
// should sleep for a little while before trying again to get
// more potential candidates.
m_sleepBeforeTryingToGetMoreCandidates = true; // depends on control dependency: [if], data = [none]
return (new NoneImpl<T>()); // depends on control dependency: [if], data = [none]
} else {
// We successfully retrieved more candidates. We clear the
// flag that prevented requesting more potential candidates,
// since all is well. Since we have candidates with which to
// work, we probably will not be hitting the service that
// provides potential candidates any time soon.
m_sleepBeforeTryingToGetMoreCandidates = false; // depends on control dependency: [if], data = [none]
m_serverIdsToTry.addAll(moreCandidates); // depends on control dependency: [if], data = [none]
return (new SomeImpl<T>(m_serverIdsToTry.remove(0))); // depends on control dependency: [if], data = [none]
}
} else {
// We already have servers to try. Try one of them.
return (new SomeImpl<T>(m_serverIdsToTry.remove(0))); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void enforceVersionRequired( FieldDeclaration f, InterfaceDeclaration controlIntf )
{
VersionRequired versionRequired = f.getAnnotation(VersionRequired.class);
Version versionPresent = controlIntf.getAnnotation(Version.class);
if (versionRequired != null) {
int majorRequired = -1;
try {
majorRequired = versionRequired.major();
}
catch(NullPointerException ignore) {
/*
the major version annotation is required and if unspecified, will
throw an NPE when it is quereid but not provided. this error will
be caught during syntactic validation perfoemed by javac, so ignore
it if an NPE is caught here
*/
return;
}
int minorRequired = versionRequired.minor();
/* no version requirement, so return */
if(majorRequired < 0)
return;
int majorPresent = -1;
int minorPresent = -1;
if ( versionPresent != null )
{
try {
majorPresent = versionPresent.major();
}
catch(NullPointerException ignore) {
/*
the major version annotation is required and if unspecified, will
throw an NPE when it is quereid but not provided. this error will
be caught during syntactic validation perfoemed by javac, so ignore
it if an NPE is caught here
*/
}
minorPresent = versionPresent.minor();
if ( majorRequired <= majorPresent &&
(minorRequired < 0 || minorRequired <= minorPresent) )
{
// Version requirement is satisfied
return;
}
}
//
// Version requirement failed
//
printError( f, "control.field.bad.version", f.getSimpleName(), majorRequired, minorRequired,
majorPresent, minorPresent );
}
} } | public class class_name {
private void enforceVersionRequired( FieldDeclaration f, InterfaceDeclaration controlIntf )
{
VersionRequired versionRequired = f.getAnnotation(VersionRequired.class);
Version versionPresent = controlIntf.getAnnotation(Version.class);
if (versionRequired != null) {
int majorRequired = -1;
try {
majorRequired = versionRequired.major(); // depends on control dependency: [try], data = [none]
}
catch(NullPointerException ignore) {
/*
the major version annotation is required and if unspecified, will
throw an NPE when it is quereid but not provided. this error will
be caught during syntactic validation perfoemed by javac, so ignore
it if an NPE is caught here
*/
return;
} // depends on control dependency: [catch], data = [none]
int minorRequired = versionRequired.minor();
/* no version requirement, so return */
if(majorRequired < 0)
return;
int majorPresent = -1;
int minorPresent = -1;
if ( versionPresent != null )
{
try {
majorPresent = versionPresent.major(); // depends on control dependency: [try], data = [none]
}
catch(NullPointerException ignore) {
/*
the major version annotation is required and if unspecified, will
throw an NPE when it is quereid but not provided. this error will
be caught during syntactic validation perfoemed by javac, so ignore
it if an NPE is caught here
*/
} // depends on control dependency: [catch], data = [none]
minorPresent = versionPresent.minor(); // depends on control dependency: [if], data = [none]
if ( majorRequired <= majorPresent &&
(minorRequired < 0 || minorRequired <= minorPresent) )
{
// Version requirement is satisfied
return; // depends on control dependency: [if], data = [none]
}
}
//
// Version requirement failed
//
printError( f, "control.field.bad.version", f.getSimpleName(), majorRequired, minorRequired,
majorPresent, minorPresent ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void close() {
Closeable closable = getClosable();
try {
LOG.closingResponse(this);
closable.close();
LOG.successfullyClosedResponse(this);
} catch (IOException e) {
throw LOG.exceptionWhileClosingResponse(e);
}
} } | public class class_name {
public void close() {
Closeable closable = getClosable();
try {
LOG.closingResponse(this); // depends on control dependency: [try], data = [none]
closable.close(); // depends on control dependency: [try], data = [none]
LOG.successfullyClosedResponse(this); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw LOG.exceptionWhileClosingResponse(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void parseAttemptPurgeData(Map props) {
//PI11176
String value = (String) props.get(HttpConfigConstants.PROPNAME_PURGE_DATA_DURING_CLOSE);
if (null != value) {
this.attemptPurgeData = convertBoolean(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: PI11176:PurgeDataDuringClose is " + shouldAttemptPurgeData());
}
}
} } | public class class_name {
private void parseAttemptPurgeData(Map props) {
//PI11176
String value = (String) props.get(HttpConfigConstants.PROPNAME_PURGE_DATA_DURING_CLOSE);
if (null != value) {
this.attemptPurgeData = convertBoolean(value); // depends on control dependency: [if], data = [value)]
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: PI11176:PurgeDataDuringClose is " + shouldAttemptPurgeData()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private boolean ready(Build.Task task) {
// FIXME: this is not a great solution in the long run for several reasons.
// Firstly, its possible that a given source will be rebuilt in the near future
// as a result of some other task and we should be waiting for that.
Path.Entry<?> target = task.getTarget();
for(Path.Entry<?> s : task.getSources()) {
if(s.lastModified() > target.lastModified()) {
return true;
}
}
return false;
} } | public class class_name {
private boolean ready(Build.Task task) {
// FIXME: this is not a great solution in the long run for several reasons.
// Firstly, its possible that a given source will be rebuilt in the near future
// as a result of some other task and we should be waiting for that.
Path.Entry<?> target = task.getTarget();
for(Path.Entry<?> s : task.getSources()) {
if(s.lastModified() > target.lastModified()) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void quit()
{
if (pc != null) {
final KNXNetworkLink lnk = pc.detach();
if (lnk != null)
lnk.close();
Runtime.getRuntime().removeShutdownHook(sh);
}
} } | public class class_name {
public void quit()
{
if (pc != null) {
final KNXNetworkLink lnk = pc.detach();
if (lnk != null)
lnk.close();
Runtime.getRuntime().removeShutdownHook(sh);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static TSQuery parseQuery(final TSDB tsdb, final HttpQuery query,
final List<ExpressionTree> expressions) {
final TSQuery data_query = new TSQuery();
data_query.setStart(query.getRequiredQueryStringParam("start"));
data_query.setEnd(query.getQueryStringParam("end"));
if (query.hasQueryStringParam("padding")) {
data_query.setPadding(true);
}
if (query.hasQueryStringParam("no_annotations")) {
data_query.setNoAnnotations(true);
}
if (query.hasQueryStringParam("global_annotations")) {
data_query.setGlobalAnnotations(true);
}
if (query.hasQueryStringParam("show_tsuids")) {
data_query.setShowTSUIDs(true);
}
if (query.hasQueryStringParam("ms")) {
data_query.setMsResolution(true);
}
if (query.hasQueryStringParam("show_query")) {
data_query.setShowQuery(true);
}
if (query.hasQueryStringParam("show_stats")) {
data_query.setShowStats(true);
}
if (query.hasQueryStringParam("show_summary")) {
data_query.setShowSummary(true);
}
// handle tsuid queries first
if (query.hasQueryStringParam("tsuid")) {
final List<String> tsuids = query.getQueryStringParams("tsuid");
for (String q : tsuids) {
parseTsuidTypeSubQuery(q, data_query);
}
}
if (query.hasQueryStringParam("m")) {
final List<String> legacy_queries = query.getQueryStringParams("m");
for (String q : legacy_queries) {
parseMTypeSubQuery(q, data_query);
}
}
// TODO - testing out the graphite style expressions here with the "exp"
// param that could stand for experimental or expression ;)
if (expressions != null) {
if (query.hasQueryStringParam("exp")) {
final List<String> uri_expressions = query.getQueryStringParams("exp");
final List<String> metric_queries = new ArrayList<String>(
uri_expressions.size());
// parse the expressions into their trees. If one or more expressions
// are improper then it will toss an exception up
expressions.addAll(Expressions.parseExpressions(
uri_expressions, data_query, metric_queries));
// iterate over each of the parsed metric queries and store it in the
// TSQuery list so that we fetch the data for them.
for (final String mq: metric_queries) {
parseMTypeSubQuery(mq, data_query);
}
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Received a request with an expression but at the "
+ "wrong endpoint: " + query);
}
}
if (data_query.getQueries() == null || data_query.getQueries().size() < 1) {
throw new BadRequestException("Missing sub queries");
}
// Filter out duplicate queries
Set<TSSubQuery> query_set = new LinkedHashSet<TSSubQuery>(data_query.getQueries());
data_query.getQueries().clear();
data_query.getQueries().addAll(query_set);
return data_query;
} } | public class class_name {
public static TSQuery parseQuery(final TSDB tsdb, final HttpQuery query,
final List<ExpressionTree> expressions) {
final TSQuery data_query = new TSQuery();
data_query.setStart(query.getRequiredQueryStringParam("start"));
data_query.setEnd(query.getQueryStringParam("end"));
if (query.hasQueryStringParam("padding")) {
data_query.setPadding(true); // depends on control dependency: [if], data = [none]
}
if (query.hasQueryStringParam("no_annotations")) {
data_query.setNoAnnotations(true); // depends on control dependency: [if], data = [none]
}
if (query.hasQueryStringParam("global_annotations")) {
data_query.setGlobalAnnotations(true); // depends on control dependency: [if], data = [none]
}
if (query.hasQueryStringParam("show_tsuids")) {
data_query.setShowTSUIDs(true); // depends on control dependency: [if], data = [none]
}
if (query.hasQueryStringParam("ms")) {
data_query.setMsResolution(true); // depends on control dependency: [if], data = [none]
}
if (query.hasQueryStringParam("show_query")) {
data_query.setShowQuery(true); // depends on control dependency: [if], data = [none]
}
if (query.hasQueryStringParam("show_stats")) {
data_query.setShowStats(true); // depends on control dependency: [if], data = [none]
}
if (query.hasQueryStringParam("show_summary")) {
data_query.setShowSummary(true); // depends on control dependency: [if], data = [none]
}
// handle tsuid queries first
if (query.hasQueryStringParam("tsuid")) {
final List<String> tsuids = query.getQueryStringParams("tsuid");
for (String q : tsuids) {
parseTsuidTypeSubQuery(q, data_query); // depends on control dependency: [for], data = [q]
}
}
if (query.hasQueryStringParam("m")) {
final List<String> legacy_queries = query.getQueryStringParams("m");
for (String q : legacy_queries) {
parseMTypeSubQuery(q, data_query); // depends on control dependency: [for], data = [q]
}
}
// TODO - testing out the graphite style expressions here with the "exp"
// param that could stand for experimental or expression ;)
if (expressions != null) {
if (query.hasQueryStringParam("exp")) {
final List<String> uri_expressions = query.getQueryStringParams("exp");
final List<String> metric_queries = new ArrayList<String>(
uri_expressions.size());
// parse the expressions into their trees. If one or more expressions
// are improper then it will toss an exception up
expressions.addAll(Expressions.parseExpressions(
uri_expressions, data_query, metric_queries)); // depends on control dependency: [if], data = [none]
// iterate over each of the parsed metric queries and store it in the
// TSQuery list so that we fetch the data for them.
for (final String mq: metric_queries) {
parseMTypeSubQuery(mq, data_query); // depends on control dependency: [for], data = [mq]
}
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Received a request with an expression but at the "
+ "wrong endpoint: " + query); // depends on control dependency: [if], data = [none]
}
}
if (data_query.getQueries() == null || data_query.getQueries().size() < 1) {
throw new BadRequestException("Missing sub queries");
}
// Filter out duplicate queries
Set<TSSubQuery> query_set = new LinkedHashSet<TSSubQuery>(data_query.getQueries());
data_query.getQueries().clear();
data_query.getQueries().addAll(query_set);
return data_query;
} } |
public class class_name {
public java.util.List<String> getDesiredShardLevelMetrics() {
if (desiredShardLevelMetrics == null) {
desiredShardLevelMetrics = new com.amazonaws.internal.SdkInternalList<String>();
}
return desiredShardLevelMetrics;
} } | public class class_name {
public java.util.List<String> getDesiredShardLevelMetrics() {
if (desiredShardLevelMetrics == null) {
desiredShardLevelMetrics = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return desiredShardLevelMetrics;
} } |
public class class_name {
public final List<HourRanges> normalize() {
final List<HourRange> today = new ArrayList<>();
final List<HourRange> tommorrow = new ArrayList<>();
for (final HourRange range : ranges) {
final List<HourRange> nr = range.normalize();
if (nr.size() == 1) {
today.add(nr.get(0));
} else if (nr.size() == 2) {
today.add(nr.get(0));
tommorrow.add(nr.get(1));
} else {
throw new IllegalStateException("Normalized hour range returned an unexpected number of elements: " + nr);
}
}
final List<HourRanges> list = new ArrayList<>();
list.add(new HourRanges(today.toArray(new HourRange[today.size()])));
if (tommorrow.size() > 0) {
list.add(new HourRanges(tommorrow.toArray(new HourRange[tommorrow.size()])));
}
return list;
} } | public class class_name {
public final List<HourRanges> normalize() {
final List<HourRange> today = new ArrayList<>();
final List<HourRange> tommorrow = new ArrayList<>();
for (final HourRange range : ranges) {
final List<HourRange> nr = range.normalize();
if (nr.size() == 1) {
today.add(nr.get(0)); // depends on control dependency: [if], data = [none]
} else if (nr.size() == 2) {
today.add(nr.get(0)); // depends on control dependency: [if], data = [none]
tommorrow.add(nr.get(1)); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException("Normalized hour range returned an unexpected number of elements: " + nr);
}
}
final List<HourRanges> list = new ArrayList<>();
list.add(new HourRanges(today.toArray(new HourRange[today.size()])));
if (tommorrow.size() > 0) {
list.add(new HourRanges(tommorrow.toArray(new HourRange[tommorrow.size()]))); // depends on control dependency: [if], data = [none]
}
return list;
} } |
public class class_name {
public DeterministicKey deriveNextChild(ImmutableList<ChildNumber> parentPath, boolean relative, boolean createParent, boolean privateDerivation) {
DeterministicKey parent = get(parentPath, relative, createParent);
int nAttempts = 0;
while (nAttempts++ < HDKeyDerivation.MAX_CHILD_DERIVATION_ATTEMPTS) {
try {
ChildNumber createChildNumber = getNextChildNumberToDerive(parent.getPath(), privateDerivation);
return deriveChild(parent, createChildNumber);
} catch (HDDerivationException ignore) { }
}
throw new HDDerivationException("Maximum number of child derivation attempts reached, this is probably an indication of a bug.");
} } | public class class_name {
public DeterministicKey deriveNextChild(ImmutableList<ChildNumber> parentPath, boolean relative, boolean createParent, boolean privateDerivation) {
DeterministicKey parent = get(parentPath, relative, createParent);
int nAttempts = 0;
while (nAttempts++ < HDKeyDerivation.MAX_CHILD_DERIVATION_ATTEMPTS) {
try {
ChildNumber createChildNumber = getNextChildNumberToDerive(parent.getPath(), privateDerivation);
return deriveChild(parent, createChildNumber); // depends on control dependency: [try], data = [none]
} catch (HDDerivationException ignore) { } // depends on control dependency: [catch], data = [none]
}
throw new HDDerivationException("Maximum number of child derivation attempts reached, this is probably an indication of a bug.");
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.