code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static String[] createHostTag() {
String[] hostTag = {MetricsTags.TAG_HOST, null};
try {
hostTag[1] = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
hostTag[1] = "unknown";
}
return hostTag;
} }
|
public class class_name {
public static String[] createHostTag() {
String[] hostTag = {MetricsTags.TAG_HOST, null};
try {
hostTag[1] = InetAddress.getLocalHost().getHostName(); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
hostTag[1] = "unknown";
} // depends on control dependency: [catch], data = [none]
return hostTag;
} }
|
public class class_name {
public void marshall(CreateLicenseConfigurationRequest createLicenseConfigurationRequest, ProtocolMarshaller protocolMarshaller) {
if (createLicenseConfigurationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createLicenseConfigurationRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createLicenseConfigurationRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(createLicenseConfigurationRequest.getLicenseCountingType(), LICENSECOUNTINGTYPE_BINDING);
protocolMarshaller.marshall(createLicenseConfigurationRequest.getLicenseCount(), LICENSECOUNT_BINDING);
protocolMarshaller.marshall(createLicenseConfigurationRequest.getLicenseCountHardLimit(), LICENSECOUNTHARDLIMIT_BINDING);
protocolMarshaller.marshall(createLicenseConfigurationRequest.getLicenseRules(), LICENSERULES_BINDING);
protocolMarshaller.marshall(createLicenseConfigurationRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateLicenseConfigurationRequest createLicenseConfigurationRequest, ProtocolMarshaller protocolMarshaller) {
if (createLicenseConfigurationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createLicenseConfigurationRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLicenseConfigurationRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLicenseConfigurationRequest.getLicenseCountingType(), LICENSECOUNTINGTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLicenseConfigurationRequest.getLicenseCount(), LICENSECOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLicenseConfigurationRequest.getLicenseCountHardLimit(), LICENSECOUNTHARDLIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLicenseConfigurationRequest.getLicenseRules(), LICENSERULES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLicenseConfigurationRequest.getTags(), TAGS_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 quickSort(double[] arrayToSort, double[] linkedArray, int left, int right) {
if (left < right) {
int middle = partition(arrayToSort, linkedArray, left, right);
quickSort(arrayToSort, linkedArray, left, middle);
quickSort(arrayToSort, linkedArray, middle + 1, right);
}
} }
|
public class class_name {
public static void quickSort(double[] arrayToSort, double[] linkedArray, int left, int right) {
if (left < right) {
int middle = partition(arrayToSort, linkedArray, left, right);
quickSort(arrayToSort, linkedArray, left, middle); // depends on control dependency: [if], data = [none]
quickSort(arrayToSort, linkedArray, middle + 1, right); // depends on control dependency: [if], data = [right)]
}
} }
|
public class class_name {
public void addTurtle(Turtle turtle)
{
if (turtle == null) { return; }
turtle.setFrame(this.getFrame());
turtle.setPanel(this);
this.turtles.add(turtle);
clearPainters();
configurePainters();
} }
|
public class class_name {
public void addTurtle(Turtle turtle)
{
if (turtle == null) { return; } // depends on control dependency: [if], data = [none]
turtle.setFrame(this.getFrame());
turtle.setPanel(this);
this.turtles.add(turtle);
clearPainters();
configurePainters();
} }
|
public class class_name {
@Override
protected void append(Event logEvent) {
if(initializationFailed) {
addError("Check the configuration and whether the configured stream " + streamName
+ " exists and is active. Failed to initialize kinesis logback appender: " + name);
return;
}
try {
String message = this.layout.doLayout(logEvent);
putMessage(message);
}
catch(Exception e) {
addError("Failed to schedule log entry for publishing into Kinesis stream: " + streamName, e);
}
} }
|
public class class_name {
@Override
protected void append(Event logEvent) {
if(initializationFailed) {
addError("Check the configuration and whether the configured stream " + streamName
+ " exists and is active. Failed to initialize kinesis logback appender: " + name); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try {
String message = this.layout.doLayout(logEvent);
putMessage(message); // depends on control dependency: [try], data = [none]
}
catch(Exception e) {
addError("Failed to schedule log entry for publishing into Kinesis stream: " + streamName, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private boolean okayToSendMessage(IRTMPEvent message) {
if (message instanceof IStreamData) {
final long now = System.currentTimeMillis();
// check client buffer size
if (isClientBufferFull(now)) {
return false;
}
// get pending message count
long pending = pendingMessages();
if (bufferCheckInterval > 0 && now >= nextCheckBufferUnderrun) {
if (pending > underrunTrigger) {
// client is playing behind speed, notify him
sendInsufficientBandwidthStatus(currentItem.get());
}
nextCheckBufferUnderrun = now + bufferCheckInterval;
}
// check for under run
if (pending > underrunTrigger) {
// too many messages already queued on the connection
return false;
}
return true;
} else {
String itemName = "Undefined";
// if current item exists get the name to help debug this issue
if (currentItem.get() != null) {
itemName = currentItem.get().getName();
}
Object[] errorItems = new Object[] { message.getClass(), message.getDataType(), itemName };
throw new RuntimeException(String.format("Expected IStreamData but got %s (type %s) for %s", errorItems));
}
} }
|
public class class_name {
private boolean okayToSendMessage(IRTMPEvent message) {
if (message instanceof IStreamData) {
final long now = System.currentTimeMillis();
// check client buffer size
if (isClientBufferFull(now)) {
return false; // depends on control dependency: [if], data = [none]
}
// get pending message count
long pending = pendingMessages();
if (bufferCheckInterval > 0 && now >= nextCheckBufferUnderrun) {
if (pending > underrunTrigger) {
// client is playing behind speed, notify him
sendInsufficientBandwidthStatus(currentItem.get()); // depends on control dependency: [if], data = [none]
}
nextCheckBufferUnderrun = now + bufferCheckInterval; // depends on control dependency: [if], data = [none]
}
// check for under run
if (pending > underrunTrigger) {
// too many messages already queued on the connection
return false; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
} else {
String itemName = "Undefined";
// if current item exists get the name to help debug this issue
if (currentItem.get() != null) {
itemName = currentItem.get().getName(); // depends on control dependency: [if], data = [none]
}
Object[] errorItems = new Object[] { message.getClass(), message.getDataType(), itemName };
throw new RuntimeException(String.format("Expected IStreamData but got %s (type %s) for %s", errorItems));
}
} }
|
public class class_name {
public final MutableObjectIterator<BinaryRow> getIterator() {
return new MutableObjectIterator<BinaryRow>() {
private final int size = size();
private int current = 0;
private int currentSegment = 0;
private int currentOffset = 0;
private MemorySegment currentIndexSegment = sortIndex.get(0);
@Override
public BinaryRow next(BinaryRow target) {
if (this.current < this.size) {
this.current++;
if (this.currentOffset > lastIndexEntryOffset) {
this.currentOffset = 0;
this.currentIndexSegment = sortIndex.get(++this.currentSegment);
}
long pointer = this.currentIndexSegment.getLong(this.currentOffset);
this.currentOffset += indexEntrySize;
try {
return getRecordFromBuffer(target, pointer);
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
} else {
return null;
}
}
@Override
public BinaryRow next() {
throw new RuntimeException("Not support!");
}
};
} }
|
public class class_name {
public final MutableObjectIterator<BinaryRow> getIterator() {
return new MutableObjectIterator<BinaryRow>() {
private final int size = size();
private int current = 0;
private int currentSegment = 0;
private int currentOffset = 0;
private MemorySegment currentIndexSegment = sortIndex.get(0);
@Override
public BinaryRow next(BinaryRow target) {
if (this.current < this.size) {
this.current++; // depends on control dependency: [if], data = [none]
if (this.currentOffset > lastIndexEntryOffset) {
this.currentOffset = 0; // depends on control dependency: [if], data = [none]
this.currentIndexSegment = sortIndex.get(++this.currentSegment); // depends on control dependency: [if], data = [none]
}
long pointer = this.currentIndexSegment.getLong(this.currentOffset);
this.currentOffset += indexEntrySize; // depends on control dependency: [if], data = [none]
try {
return getRecordFromBuffer(target, pointer); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
throw new RuntimeException(ioe);
} // depends on control dependency: [catch], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
}
@Override
public BinaryRow next() {
throw new RuntimeException("Not support!");
}
};
} }
|
public class class_name {
public EClass getGSPS() {
if (gspsEClass == null) {
gspsEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(483);
}
return gspsEClass;
} }
|
public class class_name {
public EClass getGSPS() {
if (gspsEClass == null) {
gspsEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(483); // depends on control dependency: [if], data = [none]
}
return gspsEClass;
} }
|
public class class_name {
ByteBuffer decryptChunk(ByteBuffer ciphertextChunk, SecretKey fileKey) {
assert ciphertextChunk.remaining() >= NONCE_SIZE + MAC_SIZE;
try {
// nonce:
final byte[] nonce = new byte[NONCE_SIZE];
final ByteBuffer chunkNonceBuf = ciphertextChunk.asReadOnlyBuffer();
chunkNonceBuf.position(0).limit(NONCE_SIZE);
chunkNonceBuf.get(nonce);
// payload:
final ByteBuffer payloadBuf = ciphertextChunk.asReadOnlyBuffer();
payloadBuf.position(NONCE_SIZE).limit(ciphertextChunk.limit() - MAC_SIZE);
// payload:
final Cipher cipher = CipherSupplier.AES_CTR.forDecryption(fileKey, new IvParameterSpec(nonce));
final ByteBuffer outBuf = ByteBuffer.allocate(cipher.getOutputSize(payloadBuf.remaining()));
cipher.doFinal(payloadBuf, outBuf);
// flip and return:
outBuf.flip();
return outBuf;
} catch (ShortBufferException e) {
throw new IllegalStateException("Buffer allocated for reported output size apparently not big enough.", e);
} catch (IllegalBlockSizeException | BadPaddingException e) {
throw new IllegalStateException("Unexpected exception for CTR ciphers.", e);
}
} }
|
public class class_name {
ByteBuffer decryptChunk(ByteBuffer ciphertextChunk, SecretKey fileKey) {
assert ciphertextChunk.remaining() >= NONCE_SIZE + MAC_SIZE;
try {
// nonce:
final byte[] nonce = new byte[NONCE_SIZE];
final ByteBuffer chunkNonceBuf = ciphertextChunk.asReadOnlyBuffer();
chunkNonceBuf.position(0).limit(NONCE_SIZE); // depends on control dependency: [try], data = [none]
chunkNonceBuf.get(nonce); // depends on control dependency: [try], data = [none]
// payload:
final ByteBuffer payloadBuf = ciphertextChunk.asReadOnlyBuffer();
payloadBuf.position(NONCE_SIZE).limit(ciphertextChunk.limit() - MAC_SIZE); // depends on control dependency: [try], data = [none]
// payload:
final Cipher cipher = CipherSupplier.AES_CTR.forDecryption(fileKey, new IvParameterSpec(nonce));
final ByteBuffer outBuf = ByteBuffer.allocate(cipher.getOutputSize(payloadBuf.remaining()));
cipher.doFinal(payloadBuf, outBuf); // depends on control dependency: [try], data = [none]
// flip and return:
outBuf.flip(); // depends on control dependency: [try], data = [none]
return outBuf; // depends on control dependency: [try], data = [none]
} catch (ShortBufferException e) {
throw new IllegalStateException("Buffer allocated for reported output size apparently not big enough.", e);
} catch (IllegalBlockSizeException | BadPaddingException e) { // depends on control dependency: [catch], data = [none]
throw new IllegalStateException("Unexpected exception for CTR ciphers.", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public com.google.protobuf.ByteString
getRequestMethodBytes() {
java.lang.Object ref = requestMethod_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
requestMethod_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
} }
|
public class class_name {
public com.google.protobuf.ByteString
getRequestMethodBytes() {
java.lang.Object ref = requestMethod_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
requestMethod_ = b; // depends on control dependency: [if], data = [none]
return b; // depends on control dependency: [if], data = [none]
} else {
return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void addIndexExemplars(ULocale locale) {
UnicodeSet exemplars = LocaleData.getExemplarSet(locale, 0, LocaleData.ES_INDEX);
if (exemplars != null) {
initialLabels.addAll(exemplars);
return;
}
// The locale data did not include explicit Index characters.
// Synthesize a set of them from the locale's standard exemplar characters.
exemplars = LocaleData.getExemplarSet(locale, 0, LocaleData.ES_STANDARD);
exemplars = exemplars.cloneAsThawed();
// question: should we add auxiliary exemplars?
if (exemplars.containsSome('a', 'z') || exemplars.size() == 0) {
exemplars.addAll('a', 'z');
}
if (exemplars.containsSome(0xAC00, 0xD7A3)) { // Hangul syllables
// cut down to small list
exemplars.remove(0xAC00, 0xD7A3).
add(0xAC00).add(0xB098).add(0xB2E4).add(0xB77C).
add(0xB9C8).add(0xBC14).add(0xC0AC).add(0xC544).
add(0xC790).add(0xCC28).add(0xCE74).add(0xD0C0).
add(0xD30C).add(0xD558);
}
if (exemplars.containsSome(0x1200, 0x137F)) { // Ethiopic block
// cut down to small list
// make use of the fact that Ethiopic is allocated in 8's, where
// the base is 0 mod 8.
UnicodeSet ethiopic = new UnicodeSet("[[:Block=Ethiopic:]&[:Script=Ethiopic:]]");
UnicodeSetIterator it = new UnicodeSetIterator(ethiopic);
while (it.next() && it.codepoint != UnicodeSetIterator.IS_STRING) {
if ((it.codepoint & 0x7) != 0) {
exemplars.remove(it.codepoint);
}
}
}
// Upper-case any that aren't already so.
// (We only do this for synthesized index characters.)
for (String item : exemplars) {
initialLabels.add(UCharacter.toUpperCase(locale, item));
}
} }
|
public class class_name {
private void addIndexExemplars(ULocale locale) {
UnicodeSet exemplars = LocaleData.getExemplarSet(locale, 0, LocaleData.ES_INDEX);
if (exemplars != null) {
initialLabels.addAll(exemplars); // depends on control dependency: [if], data = [(exemplars]
return; // depends on control dependency: [if], data = [none]
}
// The locale data did not include explicit Index characters.
// Synthesize a set of them from the locale's standard exemplar characters.
exemplars = LocaleData.getExemplarSet(locale, 0, LocaleData.ES_STANDARD);
exemplars = exemplars.cloneAsThawed();
// question: should we add auxiliary exemplars?
if (exemplars.containsSome('a', 'z') || exemplars.size() == 0) {
exemplars.addAll('a', 'z'); // depends on control dependency: [if], data = [none]
}
if (exemplars.containsSome(0xAC00, 0xD7A3)) { // Hangul syllables
// cut down to small list
exemplars.remove(0xAC00, 0xD7A3).
add(0xAC00).add(0xB098).add(0xB2E4).add(0xB77C).
add(0xB9C8).add(0xBC14).add(0xC0AC).add(0xC544).
add(0xC790).add(0xCC28).add(0xCE74).add(0xD0C0).
add(0xD30C).add(0xD558); // depends on control dependency: [if], data = [none]
}
if (exemplars.containsSome(0x1200, 0x137F)) { // Ethiopic block
// cut down to small list
// make use of the fact that Ethiopic is allocated in 8's, where
// the base is 0 mod 8.
UnicodeSet ethiopic = new UnicodeSet("[[:Block=Ethiopic:]&[:Script=Ethiopic:]]");
UnicodeSetIterator it = new UnicodeSetIterator(ethiopic);
while (it.next() && it.codepoint != UnicodeSetIterator.IS_STRING) {
if ((it.codepoint & 0x7) != 0) {
exemplars.remove(it.codepoint); // depends on control dependency: [if], data = [none]
}
}
}
// Upper-case any that aren't already so.
// (We only do this for synthesized index characters.)
for (String item : exemplars) {
initialLabels.add(UCharacter.toUpperCase(locale, item)); // depends on control dependency: [for], data = [item]
}
} }
|
public class class_name {
@Override
public T execute() {
try {
return getHttpClient().executeWithRetries(this);
} catch (InvalidStateException e) {
Optional<ApiError> conflictError = Iterables.tryFind(e.getErrors(), CONFLICT_ERROR);
if (conflictError.isPresent()) {
String id = conflictError.get().getLinks().get("conflicting_resource_id");
return handleConflict(getHttpClient(), id).execute();
} else {
throw Throwables.propagate(e);
}
}
} }
|
public class class_name {
@Override
public T execute() {
try {
return getHttpClient().executeWithRetries(this); // depends on control dependency: [try], data = [none]
} catch (InvalidStateException e) {
Optional<ApiError> conflictError = Iterables.tryFind(e.getErrors(), CONFLICT_ERROR);
if (conflictError.isPresent()) {
String id = conflictError.get().getLinks().get("conflicting_resource_id");
return handleConflict(getHttpClient(), id).execute(); // depends on control dependency: [if], data = [none]
} else {
throw Throwables.propagate(e);
}
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public EEnum getPGDYpgBase() {
if (pgdYpgBaseEEnum == null) {
pgdYpgBaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(61);
}
return pgdYpgBaseEEnum;
} }
|
public class class_name {
public EEnum getPGDYpgBase() {
if (pgdYpgBaseEEnum == null) {
pgdYpgBaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(61); // depends on control dependency: [if], data = [none]
}
return pgdYpgBaseEEnum;
} }
|
public class class_name {
public void markAsDead(Node node) {
if (!NodeStatus.DEAD.equals(node.getStatus())) {
socketToNodeMap.get(Utils.toKey(node)).markAsDead();
sendEvent(node, NodeEventType.MARKED_AS_DEAD);
}
} }
|
public class class_name {
public void markAsDead(Node node) {
if (!NodeStatus.DEAD.equals(node.getStatus())) {
socketToNodeMap.get(Utils.toKey(node)).markAsDead(); // depends on control dependency: [if], data = [none]
sendEvent(node, NodeEventType.MARKED_AS_DEAD); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Map<String, String> getSchemaLocations(Document doc)
{
Set<String> namespaces = new HashSet<>();
namespaces.addAll(LocationAwareXmlReader.getNamespaces(doc));
String schemaLocation;
try
{
schemaLocation = XmlUtil.xpathExtract(doc, "//@xsi:schemaLocation", objs);
}
catch (MarshallingException e)
{
throw new RuntimeException("Exception extracting xpath.", e);
}
Map<String, String> result = new HashMap<>();
if (StringUtils.isNotBlank(schemaLocation))
{
schemaLocation = StringUtils.trim(schemaLocation);
String[] locations = schemaLocation.split("\\s+");
for (int i = 0, j = locations.length - 1; i < j; i++)
{
if (namespaces.contains(locations[i]))
{
result.put(locations[i], locations[i + 1]);
}
}
}
for (String r : result.keySet())
{
namespaces.remove(r);
}
// if there are namespaces without namespace locations, load here.
if (namespaces.size() > 0)
{
for (String namespace : namespaces)
{
result.put(namespace, null);
}
}
return result;
} }
|
public class class_name {
public static Map<String, String> getSchemaLocations(Document doc)
{
Set<String> namespaces = new HashSet<>();
namespaces.addAll(LocationAwareXmlReader.getNamespaces(doc));
String schemaLocation;
try
{
schemaLocation = XmlUtil.xpathExtract(doc, "//@xsi:schemaLocation", objs);
}
catch (MarshallingException e)
{
throw new RuntimeException("Exception extracting xpath.", e);
}
Map<String, String> result = new HashMap<>();
if (StringUtils.isNotBlank(schemaLocation))
{
schemaLocation = StringUtils.trim(schemaLocation); // depends on control dependency: [if], data = [none]
String[] locations = schemaLocation.split("\\s+");
for (int i = 0, j = locations.length - 1; i < j; i++)
{
if (namespaces.contains(locations[i]))
{
result.put(locations[i], locations[i + 1]); // depends on control dependency: [if], data = [none]
}
}
}
for (String r : result.keySet())
{
namespaces.remove(r); // depends on control dependency: [for], data = [r]
}
// if there are namespaces without namespace locations, load here.
if (namespaces.size() > 0)
{
for (String namespace : namespaces)
{
result.put(namespace, null); // depends on control dependency: [for], data = [namespace]
}
}
return result;
} }
|
public class class_name {
public LongList add(long integer) {
if (end + 1 >= values.length) {
values = grow(values);
}
values[end] = integer;
end++;
return this;
} }
|
public class class_name {
public LongList add(long integer) {
if (end + 1 >= values.length) {
values = grow(values); // depends on control dependency: [if], data = [none]
}
values[end] = integer;
end++;
return this;
} }
|
public class class_name {
private AnnotationBulkDelete parseBulkDeleteQS(final HttpQuery query) {
final AnnotationBulkDelete settings = new AnnotationBulkDelete();
settings.start_time = query.getRequiredQueryStringParam("start_time");
settings.end_time = query.getQueryStringParam("end_time");
if (query.hasQueryStringParam("tsuids")) {
String[] tsuids = query.getQueryStringParam("tsuids").split(",");
settings.tsuids = new ArrayList<String>(tsuids.length);
for (String tsuid : tsuids) {
settings.tsuids.add(tsuid.trim());
}
}
if (query.hasQueryStringParam("global")) {
settings.global = true;
}
return settings;
} }
|
public class class_name {
private AnnotationBulkDelete parseBulkDeleteQS(final HttpQuery query) {
final AnnotationBulkDelete settings = new AnnotationBulkDelete();
settings.start_time = query.getRequiredQueryStringParam("start_time");
settings.end_time = query.getQueryStringParam("end_time");
if (query.hasQueryStringParam("tsuids")) {
String[] tsuids = query.getQueryStringParam("tsuids").split(",");
settings.tsuids = new ArrayList<String>(tsuids.length); // depends on control dependency: [if], data = [none]
for (String tsuid : tsuids) {
settings.tsuids.add(tsuid.trim()); // depends on control dependency: [for], data = [tsuid]
}
}
if (query.hasQueryStringParam("global")) {
settings.global = true; // depends on control dependency: [if], data = [none]
}
return settings;
} }
|
public class class_name {
public java.util.List<MaintenanceTrack> getMaintenanceTracks() {
if (maintenanceTracks == null) {
maintenanceTracks = new com.amazonaws.internal.SdkInternalList<MaintenanceTrack>();
}
return maintenanceTracks;
} }
|
public class class_name {
public java.util.List<MaintenanceTrack> getMaintenanceTracks() {
if (maintenanceTracks == null) {
maintenanceTracks = new com.amazonaws.internal.SdkInternalList<MaintenanceTrack>(); // depends on control dependency: [if], data = [none]
}
return maintenanceTracks;
} }
|
public class class_name {
public static List<String> findCacheKeysForImageUri(String imageUri, ImageMemoryCache memoryCache) {
List<String> values = new ArrayList<String>();
for (String key : memoryCache.getKeySet()) {
if (key.startsWith(imageUri)) {
values.add(key);
}
}
return values;
} }
|
public class class_name {
public static List<String> findCacheKeysForImageUri(String imageUri, ImageMemoryCache memoryCache) {
List<String> values = new ArrayList<String>();
for (String key : memoryCache.getKeySet()) {
if (key.startsWith(imageUri)) {
values.add(key); // depends on control dependency: [if], data = [none]
}
}
return values;
} }
|
public class class_name {
public double normalize() {
double propSum = this.getSum();
if (propSum == s.zero()) {
this.fill(s.divide(s.one(), s.fromReal(this.size())));
} else if (propSum == s.posInf()) {
int count = count(s.posInf());
if (count == 0) {
throw new RuntimeException("Unable to normalize since sum is infinite but contains no infinities: " + this.toString());
}
double constant = s.divide(s.one(), s.fromReal(count));
for (int d=0; d<this.size(); d++) {
if (this.getValue(d) == s.posInf()) {
this.setValue(d, constant);
} else {
this.setValue(d, s.zero());
}
}
} else {
this.divide(propSum);
assert !this.containsNaN();
}
return propSum;
} }
|
public class class_name {
public double normalize() {
double propSum = this.getSum();
if (propSum == s.zero()) {
this.fill(s.divide(s.one(), s.fromReal(this.size()))); // depends on control dependency: [if], data = [none]
} else if (propSum == s.posInf()) {
int count = count(s.posInf());
if (count == 0) {
throw new RuntimeException("Unable to normalize since sum is infinite but contains no infinities: " + this.toString());
}
double constant = s.divide(s.one(), s.fromReal(count));
for (int d=0; d<this.size(); d++) {
if (this.getValue(d) == s.posInf()) {
this.setValue(d, constant); // depends on control dependency: [if], data = [none]
} else {
this.setValue(d, s.zero()); // depends on control dependency: [if], data = [none]
}
}
} else {
this.divide(propSum); // depends on control dependency: [if], data = [(propSum]
assert !this.containsNaN(); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
return propSum;
} }
|
public class class_name {
@Override
public void run() {
// System.out.println("I am in thread!");
// All info are in AsyncCallObjec. It does everything itself
try {
aco.manage_reply(0);
} catch (final Exception e) {
System.err.println(e);
}
} }
|
public class class_name {
@Override
public void run() {
// System.out.println("I am in thread!");
// All info are in AsyncCallObjec. It does everything itself
try {
aco.manage_reply(0); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
System.err.println(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void changeCursor(@Nullable Cursor newCursor) {
Cursor oldCursor = mCursor;
if (mCursor != newCursor) {
int oldSize = 0;
int deltaSize = 0;
if (oldCursor != null) {
int oldCount = oldCursor.getCount();
oldSize = oldCount;
deltaSize -= oldCount;
oldCursor.close();
}
mCursor = newCursor;
int newSize = 0;
if (newCursor != null) {
int newCount = newCursor.getCount();
deltaSize += newCount;
newSize = newCount;
}
updateCursorObserver();
int changed = min(oldSize, newSize);
if (changed > 0) {
notifyItemRangeChanged(0, changed);
}
if (deltaSize < 0) {
notifyItemRangeRemoved(oldSize + deltaSize, abs(deltaSize));
} else if (deltaSize > 0) {
notifyItemRangeInserted(oldSize, abs(deltaSize));
}
}
} }
|
public class class_name {
private void changeCursor(@Nullable Cursor newCursor) {
Cursor oldCursor = mCursor;
if (mCursor != newCursor) {
int oldSize = 0;
int deltaSize = 0;
if (oldCursor != null) {
int oldCount = oldCursor.getCount();
oldSize = oldCount; // depends on control dependency: [if], data = [none]
deltaSize -= oldCount; // depends on control dependency: [if], data = [none]
oldCursor.close(); // depends on control dependency: [if], data = [none]
}
mCursor = newCursor; // depends on control dependency: [if], data = [none]
int newSize = 0;
if (newCursor != null) {
int newCount = newCursor.getCount();
deltaSize += newCount; // depends on control dependency: [if], data = [none]
newSize = newCount; // depends on control dependency: [if], data = [none]
}
updateCursorObserver(); // depends on control dependency: [if], data = [none]
int changed = min(oldSize, newSize);
if (changed > 0) {
notifyItemRangeChanged(0, changed); // depends on control dependency: [if], data = [none]
}
if (deltaSize < 0) {
notifyItemRangeRemoved(oldSize + deltaSize, abs(deltaSize)); // depends on control dependency: [if], data = [(deltaSize]
} else if (deltaSize > 0) {
notifyItemRangeInserted(oldSize, abs(deltaSize)); // depends on control dependency: [if], data = [(deltaSize]
}
}
} }
|
public class class_name {
public DescribeEventSubscriptionsResult withEventSubscriptionsList(EventSubscription... eventSubscriptionsList) {
if (this.eventSubscriptionsList == null) {
setEventSubscriptionsList(new com.amazonaws.internal.SdkInternalList<EventSubscription>(eventSubscriptionsList.length));
}
for (EventSubscription ele : eventSubscriptionsList) {
this.eventSubscriptionsList.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeEventSubscriptionsResult withEventSubscriptionsList(EventSubscription... eventSubscriptionsList) {
if (this.eventSubscriptionsList == null) {
setEventSubscriptionsList(new com.amazonaws.internal.SdkInternalList<EventSubscription>(eventSubscriptionsList.length)); // depends on control dependency: [if], data = [none]
}
for (EventSubscription ele : eventSubscriptionsList) {
this.eventSubscriptionsList.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private static void scaleDownFive(Slice decimal, int fiveScale, Slice result)
{
while (true) {
int powerFive = Math.min(fiveScale, MAX_POWER_OF_FIVE_INT);
fiveScale -= powerFive;
int divisor = POWERS_OF_FIVES_INT[powerFive];
divide(decimal, divisor, result);
decimal = result;
if (fiveScale == 0) {
return;
}
}
} }
|
public class class_name {
private static void scaleDownFive(Slice decimal, int fiveScale, Slice result)
{
while (true) {
int powerFive = Math.min(fiveScale, MAX_POWER_OF_FIVE_INT);
fiveScale -= powerFive; // depends on control dependency: [while], data = [none]
int divisor = POWERS_OF_FIVES_INT[powerFive];
divide(decimal, divisor, result); // depends on control dependency: [while], data = [none]
decimal = result; // depends on control dependency: [while], data = [none]
if (fiveScale == 0) {
return; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Pure
public static long longValue(CharSequence value) {
try {
return Long.decode(value.toString());
} catch (Throwable exception) {
// Silent exception.
}
return 0;
} }
|
public class class_name {
@Pure
public static long longValue(CharSequence value) {
try {
return Long.decode(value.toString()); // depends on control dependency: [try], data = [none]
} catch (Throwable exception) {
// Silent exception.
} // depends on control dependency: [catch], data = [none]
return 0;
} }
|
public class class_name {
@NonNull
@SuppressWarnings("WeakerAccess")
public SnackbarWrapper addCallbacks(List<Callback> callbacks) {
int callbacksSize = callbacks.size();
for (int i = 0; i < callbacksSize; i++) {
addCallback(callbacks.get(i));
}
return this;
} }
|
public class class_name {
@NonNull
@SuppressWarnings("WeakerAccess")
public SnackbarWrapper addCallbacks(List<Callback> callbacks) {
int callbacksSize = callbacks.size();
for (int i = 0; i < callbacksSize; i++) {
addCallback(callbacks.get(i)); // depends on control dependency: [for], data = [i]
}
return this;
} }
|
public class class_name {
public List<StringDoublePair> classifyInstanceDistribution(List<String> features) {
List<scala.Tuple2<String,Double>> r = maxEnt.decodeInstanceAsDistribution(features);
List<StringDoublePair> res = new ArrayList<StringDoublePair>();
for (scala.Tuple2<String,Double> el : r) {
res.add(new StringDoublePair(el._1, el._2));
}
return res;
} }
|
public class class_name {
public List<StringDoublePair> classifyInstanceDistribution(List<String> features) {
List<scala.Tuple2<String,Double>> r = maxEnt.decodeInstanceAsDistribution(features);
List<StringDoublePair> res = new ArrayList<StringDoublePair>();
for (scala.Tuple2<String,Double> el : r) {
res.add(new StringDoublePair(el._1, el._2));
// depends on control dependency: [for], data = [el]
}
return res;
} }
|
public class class_name {
VariableMap getStringMap() {
ImmutableMap.Builder<String, String> map = ImmutableMap.builder();
for (Result result : Iterables.filter(results.values(), USED_RESULTS)) {
map.put(result.replacement, result.original);
}
VariableMap stringMap = new VariableMap(map.build());
return stringMap;
} }
|
public class class_name {
VariableMap getStringMap() {
ImmutableMap.Builder<String, String> map = ImmutableMap.builder();
for (Result result : Iterables.filter(results.values(), USED_RESULTS)) {
map.put(result.replacement, result.original); // depends on control dependency: [for], data = [result]
}
VariableMap stringMap = new VariableMap(map.build());
return stringMap;
} }
|
public class class_name {
public String Stop(boolean crumbFlag) throws HttpResponseException, IOException {
try {
return client.get(url + "stop");
} catch (HttpResponseException ex) {
if (ex.getStatusCode() == HttpStatus.SC_METHOD_NOT_ALLOWED) {
stopPost(crumbFlag);
return "";
}
throw ex;
}
} }
|
public class class_name {
public String Stop(boolean crumbFlag) throws HttpResponseException, IOException {
try {
return client.get(url + "stop");
} catch (HttpResponseException ex) {
if (ex.getStatusCode() == HttpStatus.SC_METHOD_NOT_ALLOWED) {
stopPost(crumbFlag); // depends on control dependency: [if], data = [none]
return ""; // depends on control dependency: [if], data = [none]
}
throw ex;
}
} }
|
public class class_name {
public Pair<ListenableFuture<?>, Boolean> streamMore(SystemProcedureExecutionContext context,
List<DBBPool.BBContainer> outputBuffers,
int[] rowCountAccumulator)
{
ListenableFuture<?> writeFuture = null;
prepareBuffers(outputBuffers);
Pair<Long, int[]> serializeResult = context.tableStreamSerializeMore(m_tableId, m_type, outputBuffers);
if (serializeResult.getFirst() == SERIALIZATION_ERROR) {
// Cancel the snapshot here
for (DBBPool.BBContainer container : outputBuffers) {
container.discard();
}
SnapshotSerializationException ex = new SnapshotSerializationException("Snapshot of table " + m_tableId + " failed to complete.");
for (SnapshotTableTask task : m_tableTasks) {
task.m_target.reportSerializationFailure(ex);
}
return Pair.of(null, false);
}
if (serializeResult.getSecond()[0] > 0) {
if (rowCountAccumulator != null && rowCountAccumulator.length == 1) {
rowCountAccumulator[0] += getTupleDataRowCount(outputBuffers);
}
writeFuture = writeBlocksToTargets(outputBuffers, serializeResult.getSecond());
} else {
// Return all allocated snapshot output buffers
for (DBBPool.BBContainer container : outputBuffers) {
container.discard();
}
}
return Pair.of(writeFuture, serializeResult.getFirst() > 0);
} }
|
public class class_name {
public Pair<ListenableFuture<?>, Boolean> streamMore(SystemProcedureExecutionContext context,
List<DBBPool.BBContainer> outputBuffers,
int[] rowCountAccumulator)
{
ListenableFuture<?> writeFuture = null;
prepareBuffers(outputBuffers);
Pair<Long, int[]> serializeResult = context.tableStreamSerializeMore(m_tableId, m_type, outputBuffers);
if (serializeResult.getFirst() == SERIALIZATION_ERROR) {
// Cancel the snapshot here
for (DBBPool.BBContainer container : outputBuffers) {
container.discard(); // depends on control dependency: [for], data = [container]
}
SnapshotSerializationException ex = new SnapshotSerializationException("Snapshot of table " + m_tableId + " failed to complete.");
for (SnapshotTableTask task : m_tableTasks) {
task.m_target.reportSerializationFailure(ex); // depends on control dependency: [for], data = [task]
}
return Pair.of(null, false); // depends on control dependency: [if], data = [none]
}
if (serializeResult.getSecond()[0] > 0) {
if (rowCountAccumulator != null && rowCountAccumulator.length == 1) {
rowCountAccumulator[0] += getTupleDataRowCount(outputBuffers); // depends on control dependency: [if], data = [none]
}
writeFuture = writeBlocksToTargets(outputBuffers, serializeResult.getSecond()); // depends on control dependency: [if], data = [none]
} else {
// Return all allocated snapshot output buffers
for (DBBPool.BBContainer container : outputBuffers) {
container.discard(); // depends on control dependency: [for], data = [container]
}
}
return Pair.of(writeFuture, serializeResult.getFirst() > 0);
} }
|
public class class_name {
public boolean isJustBefore(SourceLocation that) {
if (!this.filePath.equals(that.filePath)) {
return false;
}
return this.getEndLine() == that.getBeginLine()
&& this.getEndColumn() + 1 == that.getBeginColumn();
} }
|
public class class_name {
public boolean isJustBefore(SourceLocation that) {
if (!this.filePath.equals(that.filePath)) {
return false; // depends on control dependency: [if], data = [none]
}
return this.getEndLine() == that.getBeginLine()
&& this.getEndColumn() + 1 == that.getBeginColumn();
} }
|
public class class_name {
@Override
public String parameterFromPath(String name) {
String encodedParameter = route.getPathParametersEncoded(
path()).get(name);
if (encodedParameter == null) {
return null;
} else {
// #514 - If the encoded parameter contains : it should be encoded manually.
// Some library don't meaning that the URI creation fails as : is not allowed.
if (encodedParameter.contains(":")) {
encodedParameter = encodedParameter.replace(":", "%3A");
}
return URI.create(encodedParameter).getPath();
}
} }
|
public class class_name {
@Override
public String parameterFromPath(String name) {
String encodedParameter = route.getPathParametersEncoded(
path()).get(name);
if (encodedParameter == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
// #514 - If the encoded parameter contains : it should be encoded manually.
// Some library don't meaning that the URI creation fails as : is not allowed.
if (encodedParameter.contains(":")) {
encodedParameter = encodedParameter.replace(":", "%3A"); // depends on control dependency: [if], data = [none]
}
return URI.create(encodedParameter).getPath(); // depends on control dependency: [if], data = [(encodedParameter]
}
} }
|
public class class_name {
private static void applyConfigs(final ClassLoader classloader, final GuiceConfig config)
{
// Load all the local configs
for (String configFile : getPropertyFiles(config))
{
try
{
for (PropertyFile properties : loadConfig(classloader, configFile))
config.setAll(properties);
}
catch (IOException e)
{
throw new IllegalArgumentException("Error loading configuration URLs from " + configFile, e);
}
}
// Load the network config (if enabled)
try
{
applyNetworkConfiguration(config);
}
catch (Throwable t)
{
throw new RuntimeException("Failed to retrieve configuration from network!", t);
}
} }
|
public class class_name {
private static void applyConfigs(final ClassLoader classloader, final GuiceConfig config)
{
// Load all the local configs
for (String configFile : getPropertyFiles(config))
{
try
{
for (PropertyFile properties : loadConfig(classloader, configFile))
config.setAll(properties);
}
catch (IOException e)
{
throw new IllegalArgumentException("Error loading configuration URLs from " + configFile, e);
} // depends on control dependency: [catch], data = [none]
}
// Load the network config (if enabled)
try
{
applyNetworkConfiguration(config); // depends on control dependency: [try], data = [none]
}
catch (Throwable t)
{
throw new RuntimeException("Failed to retrieve configuration from network!", t);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void parseProperties(JsonParser jp, Object[] values) throws IOException, SQLException {
jp.nextToken();//START_OBJECT {
while (jp.nextToken() != JsonToken.END_OBJECT) {
String fieldName = TableLocation.quoteIdentifier(jp.getText().toUpperCase(), isH2); //FIELD_NAME columnName
JsonToken value = jp.nextToken();
if (value == JsonToken.VALUE_STRING) {
values[cachedColumnIndex.get(fieldName)] = jp.getText();
} else if (value == JsonToken.VALUE_TRUE) {
values[cachedColumnIndex.get(fieldName)] = jp.getValueAsBoolean();
} else if (value == JsonToken.VALUE_FALSE) {
values[cachedColumnIndex.get(fieldName)] = jp.getValueAsBoolean();
} else if (value == JsonToken.VALUE_NUMBER_FLOAT) {
values[cachedColumnIndex.get(fieldName)] = jp.getValueAsDouble();
} else if (value == JsonToken.VALUE_NUMBER_INT) {
values[cachedColumnIndex.get(fieldName)] = jp.getBigIntegerValue();
} else if (value == JsonToken.START_ARRAY) {
ArrayList<Object> arrayList = parseArray(jp);
values[cachedColumnIndex.get(fieldName)] = arrayList.toArray();
} else if (value == JsonToken.START_OBJECT) {
String str = parseObject(jp);
values[cachedColumnIndex.get(fieldName)] = str;
} else if (value == JsonToken.VALUE_NULL) {
values[cachedColumnIndex.get(fieldName)] = "null";
}
else {
//ignore other value
}
}
} }
|
public class class_name {
private void parseProperties(JsonParser jp, Object[] values) throws IOException, SQLException {
jp.nextToken();//START_OBJECT {
while (jp.nextToken() != JsonToken.END_OBJECT) {
String fieldName = TableLocation.quoteIdentifier(jp.getText().toUpperCase(), isH2); //FIELD_NAME columnName
JsonToken value = jp.nextToken();
if (value == JsonToken.VALUE_STRING) {
values[cachedColumnIndex.get(fieldName)] = jp.getText(); // depends on control dependency: [if], data = [none]
} else if (value == JsonToken.VALUE_TRUE) {
values[cachedColumnIndex.get(fieldName)] = jp.getValueAsBoolean(); // depends on control dependency: [if], data = [none]
} else if (value == JsonToken.VALUE_FALSE) {
values[cachedColumnIndex.get(fieldName)] = jp.getValueAsBoolean(); // depends on control dependency: [if], data = [none]
} else if (value == JsonToken.VALUE_NUMBER_FLOAT) {
values[cachedColumnIndex.get(fieldName)] = jp.getValueAsDouble(); // depends on control dependency: [if], data = [none]
} else if (value == JsonToken.VALUE_NUMBER_INT) {
values[cachedColumnIndex.get(fieldName)] = jp.getBigIntegerValue(); // depends on control dependency: [if], data = [none]
} else if (value == JsonToken.START_ARRAY) {
ArrayList<Object> arrayList = parseArray(jp);
values[cachedColumnIndex.get(fieldName)] = arrayList.toArray(); // depends on control dependency: [if], data = [none]
} else if (value == JsonToken.START_OBJECT) {
String str = parseObject(jp);
values[cachedColumnIndex.get(fieldName)] = str; // depends on control dependency: [if], data = [none]
} else if (value == JsonToken.VALUE_NULL) {
values[cachedColumnIndex.get(fieldName)] = "null"; // depends on control dependency: [if], data = [none]
}
else {
//ignore other value
}
}
} }
|
public class class_name {
public static String normalizeDriveLetter(String file) {
if (file.length() > 2 && file.charAt(1) == ':') {
return Character.toUpperCase(file.charAt(0)) + file.substring(1);
} else if (file.length() > 3 && file.charAt(0) == '*'
&& file.charAt(2) == ':') {
// Handle a wildcard * at the beginning of the string.
return file.substring(0, 1) + Character.toUpperCase(file.charAt(1))
+ file.substring(2);
}
return file;
} }
|
public class class_name {
public static String normalizeDriveLetter(String file) {
if (file.length() > 2 && file.charAt(1) == ':') {
return Character.toUpperCase(file.charAt(0)) + file.substring(1); // depends on control dependency: [if], data = [none]
} else if (file.length() > 3 && file.charAt(0) == '*'
&& file.charAt(2) == ':') {
// Handle a wildcard * at the beginning of the string.
return file.substring(0, 1) + Character.toUpperCase(file.charAt(1))
+ file.substring(2); // depends on control dependency: [if], data = [none]
}
return file;
} }
|
public class class_name {
@Override
public IPv6Address[] spanWithPrefixBlocks() {
if(isSequential()) {
return spanWithPrefixBlocks(this);
}
@SuppressWarnings("unchecked")
ArrayList<IPv6Address> list = (ArrayList<IPv6Address>) spanWithBlocks(true);
return list.toArray(new IPv6Address[list.size()]);
} }
|
public class class_name {
@Override
public IPv6Address[] spanWithPrefixBlocks() {
if(isSequential()) {
return spanWithPrefixBlocks(this); // depends on control dependency: [if], data = [none]
}
@SuppressWarnings("unchecked")
ArrayList<IPv6Address> list = (ArrayList<IPv6Address>) spanWithBlocks(true);
return list.toArray(new IPv6Address[list.size()]);
} }
|
public class class_name {
public ResetCacheParameterGroupRequest withParameterNameValues(ParameterNameValue... parameterNameValues) {
if (this.parameterNameValues == null) {
setParameterNameValues(new com.amazonaws.internal.SdkInternalList<ParameterNameValue>(parameterNameValues.length));
}
for (ParameterNameValue ele : parameterNameValues) {
this.parameterNameValues.add(ele);
}
return this;
} }
|
public class class_name {
public ResetCacheParameterGroupRequest withParameterNameValues(ParameterNameValue... parameterNameValues) {
if (this.parameterNameValues == null) {
setParameterNameValues(new com.amazonaws.internal.SdkInternalList<ParameterNameValue>(parameterNameValues.length)); // depends on control dependency: [if], data = [none]
}
for (ParameterNameValue ele : parameterNameValues) {
this.parameterNameValues.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public MetricFilter metricsFilter() {
if (id() == null) {
return (name, metric) -> false;
}
return (name, metric) -> metricNames.contains(name);
} }
|
public class class_name {
public MetricFilter metricsFilter() {
if (id() == null) {
return (name, metric) -> false; // depends on control dependency: [if], data = [none]
}
return (name, metric) -> metricNames.contains(name);
} }
|
public class class_name {
@Override
protected void logImpl(LogLevel level,Object[] message,Throwable throwable)
{
//get log level
int levelValue=level.getValue();
Level jdkLevel=null;
switch(levelValue)
{
case LogLevel.DEBUG_LOG_LEVEL_VALUE:
jdkLevel=Level.FINEST;
break;
case LogLevel.ERROR_LOG_LEVEL_VALUE:
jdkLevel=Level.SEVERE;
break;
case LogLevel.INFO_LOG_LEVEL_VALUE:
default:
jdkLevel=Level.FINE;
break;
}
if(jdkLevel!=null)
{
//format log message (without exception)
String text=this.formatLogMessage(level,message,null);
//log
this.JDK_LOGGER.log(jdkLevel,text,throwable);
}
} }
|
public class class_name {
@Override
protected void logImpl(LogLevel level,Object[] message,Throwable throwable)
{
//get log level
int levelValue=level.getValue();
Level jdkLevel=null;
switch(levelValue)
{
case LogLevel.DEBUG_LOG_LEVEL_VALUE:
jdkLevel=Level.FINEST;
break;
case LogLevel.ERROR_LOG_LEVEL_VALUE:
jdkLevel=Level.SEVERE;
break;
case LogLevel.INFO_LOG_LEVEL_VALUE:
default:
jdkLevel=Level.FINE;
break;
}
if(jdkLevel!=null)
{
//format log message (without exception)
String text=this.formatLogMessage(level,message,null);
//log
this.JDK_LOGGER.log(jdkLevel,text,throwable); // depends on control dependency: [if], data = [(jdkLevel]
}
} }
|
public class class_name {
public static List<String> tokensToJavaStringList(Seq<KoreanToken> tokens, boolean keepSpace) {
Iterator<KoreanToken> tokenized = tokens.iterator();
List<String> output = new LinkedList<>();
while (tokenized.hasNext()) {
final KoreanToken token = tokenized.next();
if (keepSpace || token.pos() != KoreanPos.Space()) {
output.add(token.text());
}
}
return output;
} }
|
public class class_name {
public static List<String> tokensToJavaStringList(Seq<KoreanToken> tokens, boolean keepSpace) {
Iterator<KoreanToken> tokenized = tokens.iterator();
List<String> output = new LinkedList<>();
while (tokenized.hasNext()) {
final KoreanToken token = tokenized.next();
if (keepSpace || token.pos() != KoreanPos.Space()) {
output.add(token.text()); // depends on control dependency: [if], data = [none]
}
}
return output;
} }
|
public class class_name {
public static Table getTableObjectNameFromId(Database catalog, int tableId) {
for (Table table: catalog.getTables()) {
if (table.getRelativeIndex() == tableId) {
return table;
}
}
return null;
} }
|
public class class_name {
public static Table getTableObjectNameFromId(Database catalog, int tableId) {
for (Table table: catalog.getTables()) {
if (table.getRelativeIndex() == tableId) {
return table; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public final ByteBuffer asByteBuffer () {
final StringBuilder sb = new StringBuilder();
for (Map.Entry<OperationalTextKey , String> e : settingsMap.entrySet()) {
sb.append(e.getKey().value());
sb.append(KEY_VALUE_DELIMITER);
sb.append(e.getValue());
sb.append(PAIR_DELIMITER);
}
return ByteBuffer.wrap(sb.toString().getBytes());
} }
|
public class class_name {
public final ByteBuffer asByteBuffer () {
final StringBuilder sb = new StringBuilder();
for (Map.Entry<OperationalTextKey , String> e : settingsMap.entrySet()) {
sb.append(e.getKey().value()); // depends on control dependency: [for], data = [e]
sb.append(KEY_VALUE_DELIMITER); // depends on control dependency: [for], data = [e]
sb.append(e.getValue()); // depends on control dependency: [for], data = [e]
sb.append(PAIR_DELIMITER); // depends on control dependency: [for], data = [e]
}
return ByteBuffer.wrap(sb.toString().getBytes());
} }
|
public class class_name {
public List<Long> getQuantilesLowerBound(List<Double> quantiles)
{
checkArgument(Ordering.natural().isOrdered(quantiles), "quantiles must be sorted in increasing order");
for (double quantile : quantiles) {
checkArgument(quantile >= 0 && quantile <= 1, "quantile must be between [0,1]");
}
List<Double> reversedQuantiles = ImmutableList.copyOf(quantiles).reverse();
ImmutableList.Builder<Long> builder = ImmutableList.builder();
PeekingIterator<Double> iterator = Iterators.peekingIterator(reversedQuantiles.iterator());
postOrderTraversal(root, new Callback()
{
private double sum;
@Override
public boolean process(int node)
{
sum += counts[node];
while (iterator.hasNext() && sum > (1.0 - iterator.peek()) * weightedCount) {
iterator.next();
// we know the min value ever seen, so cap the percentile to provide better error
// bounds in this case
long value = Math.max(lowerBound(node), min);
builder.add(value);
}
return iterator.hasNext();
}
}, TraversalOrder.REVERSE);
// we finished the traversal without consuming all quantiles. This means the remaining quantiles
// correspond to the max known value
while (iterator.hasNext()) {
builder.add(min);
iterator.next();
}
return builder.build().reverse();
} }
|
public class class_name {
public List<Long> getQuantilesLowerBound(List<Double> quantiles)
{
checkArgument(Ordering.natural().isOrdered(quantiles), "quantiles must be sorted in increasing order");
for (double quantile : quantiles) {
checkArgument(quantile >= 0 && quantile <= 1, "quantile must be between [0,1]"); // depends on control dependency: [for], data = [quantile]
}
List<Double> reversedQuantiles = ImmutableList.copyOf(quantiles).reverse();
ImmutableList.Builder<Long> builder = ImmutableList.builder();
PeekingIterator<Double> iterator = Iterators.peekingIterator(reversedQuantiles.iterator());
postOrderTraversal(root, new Callback()
{
private double sum;
@Override
public boolean process(int node)
{
sum += counts[node];
while (iterator.hasNext() && sum > (1.0 - iterator.peek()) * weightedCount) {
iterator.next(); // depends on control dependency: [while], data = [none]
// we know the min value ever seen, so cap the percentile to provide better error
// bounds in this case
long value = Math.max(lowerBound(node), min);
builder.add(value); // depends on control dependency: [while], data = [none]
}
return iterator.hasNext();
}
}, TraversalOrder.REVERSE);
// we finished the traversal without consuming all quantiles. This means the remaining quantiles
// correspond to the max known value
while (iterator.hasNext()) {
builder.add(min); // depends on control dependency: [while], data = [none]
iterator.next(); // depends on control dependency: [while], data = [none]
}
return builder.build().reverse();
} }
|
public class class_name {
protected Optional<BufferedImage> getIcon(@NonNull String iconPath)
{
Optional<BufferedImage> optional = Optional.empty();
try
{
BufferedImage bufferedImage = ImageIO
.read(ClassExtensions.getResourceAsStream(iconPath));
optional = Optional.of(bufferedImage);
}
catch (IOException e)
{
String title = e.getLocalizedMessage();
String htmlMessage = "<html><body width='650'>" + "<h2>" + title + "</h2>" + "<p>"
+ e.getMessage();
JOptionPane.showMessageDialog(this, htmlMessage, title, JOptionPane.ERROR_MESSAGE);
log.log(Level.SEVERE, e.getMessage(), e);
}
return optional;
} }
|
public class class_name {
protected Optional<BufferedImage> getIcon(@NonNull String iconPath)
{
Optional<BufferedImage> optional = Optional.empty();
try
{
BufferedImage bufferedImage = ImageIO
.read(ClassExtensions.getResourceAsStream(iconPath));
optional = Optional.of(bufferedImage); // depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
String title = e.getLocalizedMessage();
String htmlMessage = "<html><body width='650'>" + "<h2>" + title + "</h2>" + "<p>"
+ e.getMessage();
JOptionPane.showMessageDialog(this, htmlMessage, title, JOptionPane.ERROR_MESSAGE);
log.log(Level.SEVERE, e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
return optional;
} }
|
public class class_name {
@Override
public synchronized void close () {
SmbTreeHandleImpl th = this.treeHandle;
if ( th != null ) {
this.treeHandle = null;
if ( this.transportContext.getConfig().isStrictResourceLifecycle() ) {
th.close();
}
}
} }
|
public class class_name {
@Override
public synchronized void close () {
SmbTreeHandleImpl th = this.treeHandle;
if ( th != null ) {
this.treeHandle = null; // depends on control dependency: [if], data = [none]
if ( this.transportContext.getConfig().isStrictResourceLifecycle() ) {
th.close(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private boolean hasConstantField(PackageDoc pkg) {
ClassDoc[] classes;
if (pkg.name().length() > 0) {
classes = pkg.allClasses();
} else {
classes = configuration.classDocCatalog.allClasses(
DocletConstants.DEFAULT_PACKAGE_NAME);
}
boolean found = false;
for (int j = 0; j < classes.length; j++){
if (classes[j].isIncluded() && hasConstantField(classes[j])) {
found = true;
}
}
return found;
} }
|
public class class_name {
private boolean hasConstantField(PackageDoc pkg) {
ClassDoc[] classes;
if (pkg.name().length() > 0) {
classes = pkg.allClasses(); // depends on control dependency: [if], data = [none]
} else {
classes = configuration.classDocCatalog.allClasses(
DocletConstants.DEFAULT_PACKAGE_NAME); // depends on control dependency: [if], data = [none]
}
boolean found = false;
for (int j = 0; j < classes.length; j++){
if (classes[j].isIncluded() && hasConstantField(classes[j])) {
found = true; // depends on control dependency: [if], data = [none]
}
}
return found;
} }
|
public class class_name {
private static boolean dependencyExists(Dependency dependency, List<Dependency> dependencies) {
for (Dependency d : dependencies) {
if (dependenciesEqual(dependency, d)) {
return true;
}
}
return false;
} }
|
public class class_name {
private static boolean dependencyExists(Dependency dependency, List<Dependency> dependencies) {
for (Dependency d : dependencies) {
if (dependenciesEqual(dependency, d)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
protected void handleCollision(CmsPositionBean p1, CmsPositionBean p2) {
CmsPositionBean positionToChange = p1;
if (p1.getTop() <= p2.getTop()) {
positionToChange = p2;
}
positionToChange.setTop(positionToChange.getTop() + 25);
} }
|
public class class_name {
protected void handleCollision(CmsPositionBean p1, CmsPositionBean p2) {
CmsPositionBean positionToChange = p1;
if (p1.getTop() <= p2.getTop()) {
positionToChange = p2; // depends on control dependency: [if], data = [none]
}
positionToChange.setTop(positionToChange.getTop() + 25);
} }
|
public class class_name {
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static long getUsableSpace(File path) {
if (path == null) {
return -1;
}
if (Version.hasGingerbread()) {
return path.getUsableSpace();
} else {
if (!path.exists()) {
return 0;
} else {
final StatFs stats = new StatFs(path.getPath());
return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
}
}
} }
|
public class class_name {
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static long getUsableSpace(File path) {
if (path == null) {
return -1; // depends on control dependency: [if], data = [none]
}
if (Version.hasGingerbread()) {
return path.getUsableSpace(); // depends on control dependency: [if], data = [none]
} else {
if (!path.exists()) {
return 0; // depends on control dependency: [if], data = [none]
} else {
final StatFs stats = new StatFs(path.getPath());
return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) {
if (MapUtil.isEmpty(params)) {
return null;
}
final String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull);
return new Digester(digestAlgorithm).digestHex(paramsStr);
} }
|
public class class_name {
public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) {
if (MapUtil.isEmpty(params)) {
return null;
// depends on control dependency: [if], data = [none]
}
final String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull);
return new Digester(digestAlgorithm).digestHex(paramsStr);
} }
|
public class class_name {
private String getInverseOneToOneProperty(String property, OgmEntityPersister otherSidePersister) {
for ( String candidate : otherSidePersister.getPropertyNames() ) {
Type candidateType = otherSidePersister.getPropertyType( candidate );
if ( candidateType.isEntityType()
&& ( ( (EntityType) candidateType ).isOneToOne()
&& isOneToOneMatching( this, property, (OneToOneType) candidateType ) ) ) {
return candidate;
}
}
return null;
} }
|
public class class_name {
private String getInverseOneToOneProperty(String property, OgmEntityPersister otherSidePersister) {
for ( String candidate : otherSidePersister.getPropertyNames() ) {
Type candidateType = otherSidePersister.getPropertyType( candidate );
if ( candidateType.isEntityType()
&& ( ( (EntityType) candidateType ).isOneToOne()
&& isOneToOneMatching( this, property, (OneToOneType) candidateType ) ) ) {
return candidate; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static void main(String... args) throws Exception {
String string = "SELECT :expr1, #($expr2.class),"
+ " WHERE #if(:expr3) {e = $expr3} #else {e IS NULL}"
+ "#for(variant in $expr4.bytes) { AND c = :variant}" // NL
+ " {AND d = :expr-5}? {AND f = $expr6}?" // NL
+ " BY #!(:expr7) ASC";
// 在输入中查找 PREFIX 字符
Matcher matcher = PATTERN_KEYWORD.matcher(string);
int position = 0;
while (matcher.find(position)) {
System.out.println("===============================");
System.out.println("group 0: " + matcher.group(0));
System.out.println("group 1: " + matcher.group(1));
System.out.println("group 2: " + matcher.group(2));
System.out.println("group 3: " + matcher.group(3));
position = matcher.end();
}
// 在循环表达式中查找
matcher = PATTERN_IN.matcher("variant in :expr5");
if (matcher.matches()) {
System.out.println("===============================");
System.out.println("group 0: " + matcher.group(0));
System.out.println("group 1: " + matcher.group(1));
System.out.println("group 2: " + matcher.group(2));
}
// 编译下列语句
ExqlPattern pattern = new ExqlCompiler(string).compile();
ExqlContext context = new ExqlContextImpl();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("expr1", "expr1");
map.put("expr2", "expr2");
map.put("expr3", "expr3");
map.put("expr4", "expr4");
map.put("expr5", "expr5");
// map.put("expr6", "expr6");
map.put("expr7", "expr7");
pattern.execute(context, map, map);
System.out.println(context.flushOut());
System.out.println(Arrays.toString(context.getArgs()));
} }
|
public class class_name {
public static void main(String... args) throws Exception {
String string = "SELECT :expr1, #($expr2.class),"
+ " WHERE #if(:expr3) {e = $expr3} #else {e IS NULL}"
+ "#for(variant in $expr4.bytes) { AND c = :variant}" // NL
+ " {AND d = :expr-5}? {AND f = $expr6}?" // NL
+ " BY #!(:expr7) ASC";
// 在输入中查找 PREFIX 字符
Matcher matcher = PATTERN_KEYWORD.matcher(string);
int position = 0;
while (matcher.find(position)) {
System.out.println("==============================="); // depends on control dependency: [while], data = [none]
System.out.println("group 0: " + matcher.group(0)); // depends on control dependency: [while], data = [none]
System.out.println("group 1: " + matcher.group(1)); // depends on control dependency: [while], data = [none]
System.out.println("group 2: " + matcher.group(2)); // depends on control dependency: [while], data = [none]
System.out.println("group 3: " + matcher.group(3)); // depends on control dependency: [while], data = [none]
position = matcher.end(); // depends on control dependency: [while], data = [none]
}
// 在循环表达式中查找
matcher = PATTERN_IN.matcher("variant in :expr5");
if (matcher.matches()) {
System.out.println("==============================="); // depends on control dependency: [if], data = [none]
System.out.println("group 0: " + matcher.group(0)); // depends on control dependency: [if], data = [none]
System.out.println("group 1: " + matcher.group(1)); // depends on control dependency: [if], data = [none]
System.out.println("group 2: " + matcher.group(2)); // depends on control dependency: [if], data = [none]
}
// 编译下列语句
ExqlPattern pattern = new ExqlCompiler(string).compile();
ExqlContext context = new ExqlContextImpl();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("expr1", "expr1");
map.put("expr2", "expr2");
map.put("expr3", "expr3");
map.put("expr4", "expr4");
map.put("expr5", "expr5");
// map.put("expr6", "expr6");
map.put("expr7", "expr7");
pattern.execute(context, map, map);
System.out.println(context.flushOut());
System.out.println(Arrays.toString(context.getArgs()));
} }
|
public class class_name {
public static Subject getJ2CInvocationSubject() {
Subject j2cSubject = null;
for (J2CIdentityService j2cIdentityService : j2cIdentityServices) {
if (j2cIdentityService.isJ2CThreadIdentityEnabled()) {
Subject subject = j2cIdentityService.getJ2CInvocationSubject();
if (subject != null) {
j2cSubject = subject;
break;
}
}
}
return j2cSubject;
} }
|
public class class_name {
public static Subject getJ2CInvocationSubject() {
Subject j2cSubject = null;
for (J2CIdentityService j2cIdentityService : j2cIdentityServices) {
if (j2cIdentityService.isJ2CThreadIdentityEnabled()) {
Subject subject = j2cIdentityService.getJ2CInvocationSubject();
if (subject != null) {
j2cSubject = subject; // depends on control dependency: [if], data = [none]
break;
}
}
}
return j2cSubject;
} }
|
public class class_name {
private boolean isSecuredByProperty(Server server) {
boolean isSecured = false;
Object value = server.getEndpoint().get("org.talend.tesb.endpoint.secured"); //Property name TBD
if (value instanceof String) {
try {
isSecured = Boolean.valueOf((String) value);
} catch (Exception ex) {
}
}
return isSecured;
} }
|
public class class_name {
private boolean isSecuredByProperty(Server server) {
boolean isSecured = false;
Object value = server.getEndpoint().get("org.talend.tesb.endpoint.secured"); //Property name TBD
if (value instanceof String) {
try {
isSecured = Boolean.valueOf((String) value); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
} // depends on control dependency: [catch], data = [none]
}
return isSecured;
} }
|
public class class_name {
public void plusHours(long delta)
{
if (delta != 0)
{
long result = getHour() + delta;
setHour((int) Math.floorMod(result, 24));
plusDays(Math.floorDiv(result, 24));
}
} }
|
public class class_name {
public void plusHours(long delta)
{
if (delta != 0)
{
long result = getHour() + delta;
setHour((int) Math.floorMod(result, 24));
// depends on control dependency: [if], data = [none]
plusDays(Math.floorDiv(result, 24));
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(AvailabilityZone availabilityZone, ProtocolMarshaller protocolMarshaller) {
if (availabilityZone == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(availabilityZone.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(AvailabilityZone availabilityZone, ProtocolMarshaller protocolMarshaller) {
if (availabilityZone == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(availabilityZone.getName(), NAME_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 PagedSearchResult discoverSearch(UploadSearchParams discoverSearchParams) {
PagedSearchResult result = searchOperations.discoverSearch(discoverSearchParams);
if(result!=null && enableAutoSolutionActionTrack) {
String reqId = result.getReqId();
this.sendSolutionActions("discoversearch", reqId);
}
return result;
} }
|
public class class_name {
@Override
public PagedSearchResult discoverSearch(UploadSearchParams discoverSearchParams) {
PagedSearchResult result = searchOperations.discoverSearch(discoverSearchParams);
if(result!=null && enableAutoSolutionActionTrack) {
String reqId = result.getReqId();
this.sendSolutionActions("discoversearch", reqId); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
@Override
public int compareTo(StructureName o) {
if ( this.equals(o))
return 0;
String pdb1 = null;
String pdb2 = null;
try {
pdb1 = this.getPdbId();
} catch (StructureException e) {}
try {
pdb2 = this.getPdbId();
} catch (StructureException e) {}
int comp = 0;
// Sort those with PDBIDs before those without
if( pdb1 == null ) {
if( pdb2 != null) {
return 1; // this > o
}
// both null
} else if( pdb2 == null){
return -1; // this < o
} else {
// neither null
comp = pdb1.compareTo(pdb2);
}
if( comp != 0 ) {
return comp;
}
// break tie with full identifiers
pdb1 = this.getIdentifier();
pdb2 = o.getIdentifier();
// Throws NPE for nulls
return pdb1.compareTo(pdb2);
} }
|
public class class_name {
@Override
public int compareTo(StructureName o) {
if ( this.equals(o))
return 0;
String pdb1 = null;
String pdb2 = null;
try {
pdb1 = this.getPdbId(); // depends on control dependency: [try], data = [none]
} catch (StructureException e) {} // depends on control dependency: [catch], data = [none]
try {
pdb2 = this.getPdbId(); // depends on control dependency: [try], data = [none]
} catch (StructureException e) {} // depends on control dependency: [catch], data = [none]
int comp = 0;
// Sort those with PDBIDs before those without
if( pdb1 == null ) {
if( pdb2 != null) {
return 1; // this > o // depends on control dependency: [if], data = [none]
}
// both null
} else if( pdb2 == null){
return -1; // this < o // depends on control dependency: [if], data = [none]
} else {
// neither null
comp = pdb1.compareTo(pdb2); // depends on control dependency: [if], data = [none]
}
if( comp != 0 ) {
return comp; // depends on control dependency: [if], data = [none]
}
// break tie with full identifiers
pdb1 = this.getIdentifier();
pdb2 = o.getIdentifier();
// Throws NPE for nulls
return pdb1.compareTo(pdb2);
} }
|
public class class_name {
@Override
public String digestParams(RestInvocation restInvocation) {
Params params = restInvocation.getParamsMap().get(FormParam.class);
Map<String, String> nameValues = params.asHttpHeaders();
nameValues.remove("signature");
Params newParams = Params.of();
for (Map.Entry<String, String> nameValue : nameValues.entrySet()) {
newParams.add(nameValue.getKey(), nameValue.getValue());
}
String message = newParams.asQueryString();
Mac mac = getMac();
mac.update(message.getBytes());
return String.format("%064x", new BigInteger(1, mac.doFinal()));
} }
|
public class class_name {
@Override
public String digestParams(RestInvocation restInvocation) {
Params params = restInvocation.getParamsMap().get(FormParam.class);
Map<String, String> nameValues = params.asHttpHeaders();
nameValues.remove("signature");
Params newParams = Params.of();
for (Map.Entry<String, String> nameValue : nameValues.entrySet()) {
newParams.add(nameValue.getKey(), nameValue.getValue()); // depends on control dependency: [for], data = [nameValue]
}
String message = newParams.asQueryString();
Mac mac = getMac();
mac.update(message.getBytes());
return String.format("%064x", new BigInteger(1, mac.doFinal()));
} }
|
public class class_name {
@Override
public FieldTextBuilder WHEN(final int depth, final FieldText fieldText) {
Validate.isTrue(depth >= 1, "Depth must be at least 1");
Validate.notNull(fieldText, "FieldText should not be null");
Validate.isTrue(fieldText.size() >= 1, "FieldText must have a size greater or equal to 1");
if(size() < 1) {
throw new IllegalStateException("Size must be greater than or equal to 1");
}
// We omit this 'optimization' because for large n it doesn't work, X WHENn A => 0, even if X = A
//if (fieldText == this || toString().equals(fieldText.toString())) {
// return this;
//}
if(fieldText == this) {
return binaryOperation("WHEN" + depth, new FieldTextWrapper(this));
}
if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) {
return setFieldText(MATCHNOTHING);
}
return binaryOperation("WHEN" + depth, fieldText);
} }
|
public class class_name {
@Override
public FieldTextBuilder WHEN(final int depth, final FieldText fieldText) {
Validate.isTrue(depth >= 1, "Depth must be at least 1");
Validate.notNull(fieldText, "FieldText should not be null");
Validate.isTrue(fieldText.size() >= 1, "FieldText must have a size greater or equal to 1");
if(size() < 1) {
throw new IllegalStateException("Size must be greater than or equal to 1");
}
// We omit this 'optimization' because for large n it doesn't work, X WHENn A => 0, even if X = A
//if (fieldText == this || toString().equals(fieldText.toString())) {
// return this;
//}
if(fieldText == this) {
return binaryOperation("WHEN" + depth, new FieldTextWrapper(this)); // depends on control dependency: [if], data = [this)]
}
if(MATCHNOTHING.equals(this) || MATCHNOTHING.equals(fieldText)) {
return setFieldText(MATCHNOTHING); // depends on control dependency: [if], data = [none]
}
return binaryOperation("WHEN" + depth, fieldText);
} }
|
public class class_name {
private static void profile(Task task, String message, int tries) {
for (int i = 0; i < tries; i++) {
long start = System.nanoTime();
task.run();
long finish = System.nanoTime();
System.out.println(
String.format("[Try %d] %-30s: %-5.2fms", i + 1, message, (finish - start) / 1000000.0)
);
}
} }
|
public class class_name {
private static void profile(Task task, String message, int tries) {
for (int i = 0; i < tries; i++) {
long start = System.nanoTime();
task.run(); // depends on control dependency: [for], data = [none]
long finish = System.nanoTime();
System.out.println(
String.format("[Try %d] %-30s: %-5.2fms", i + 1, message, (finish - start) / 1000000.0)
); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public static Boolean geomDisjoint(Geometry a, Geometry b) {
if(a==null || b==null) {
return null;
}
return a.disjoint(b);
} }
|
public class class_name {
public static Boolean geomDisjoint(Geometry a, Geometry b) {
if(a==null || b==null) {
return null; // depends on control dependency: [if], data = [none]
}
return a.disjoint(b);
} }
|
public class class_name {
private static void appendListProperty(List<Object> dest, Configuration config,
String key)
{
Object value = config.getProperty(key);
if (value != null)
{
if (value instanceof Collection)
{
Collection<?> col = (Collection<?>) value;
dest.addAll(col);
}
else
{
dest.add(value);
}
}
} }
|
public class class_name {
private static void appendListProperty(List<Object> dest, Configuration config,
String key)
{
Object value = config.getProperty(key);
if (value != null)
{
if (value instanceof Collection)
{
Collection<?> col = (Collection<?>) value;
dest.addAll(col); // depends on control dependency: [if], data = [none]
}
else
{
dest.add(value); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public LandmarkStorage setMaximumWeight(double maxWeight) {
if (maxWeight > 0) {
this.factor = maxWeight / PRECISION;
if (Double.isInfinite(factor) || Double.isNaN(factor))
throw new IllegalStateException("Illegal factor " + factor + " calculated from maximum weight " + maxWeight);
}
return this;
} }
|
public class class_name {
public LandmarkStorage setMaximumWeight(double maxWeight) {
if (maxWeight > 0) {
this.factor = maxWeight / PRECISION; // depends on control dependency: [if], data = [none]
if (Double.isInfinite(factor) || Double.isNaN(factor))
throw new IllegalStateException("Illegal factor " + factor + " calculated from maximum weight " + maxWeight);
}
return this;
} }
|
public class class_name {
public String escapeString(String str) {
try {
return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20");
} catch (UnsupportedEncodingException e) {
return str;
}
} }
|
public class class_name {
public String escapeString(String str) {
try {
return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
return str;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void inflateOverflowMenu(int menuId) {
mMenuId = menuId;
mMenuView.reset(menuId, actionMenuAvailWidth());
if (mIsFocused) {
mMenuView.hideIfRoomItems(false);
}
} }
|
public class class_name {
public void inflateOverflowMenu(int menuId) {
mMenuId = menuId;
mMenuView.reset(menuId, actionMenuAvailWidth());
if (mIsFocused) {
mMenuView.hideIfRoomItems(false); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void addPainter(Painter<T> painter)
{
Collection<Painter<T>> old = new ArrayList<Painter<T>>(getPainters());
this.painters.add(painter);
if (painter instanceof AbstractPainter)
{
((AbstractPainter<?>) painter).addPropertyChangeListener(handler);
}
setDirty(true);
firePropertyChange("painters", old, getPainters());
} }
|
public class class_name {
public void addPainter(Painter<T> painter)
{
Collection<Painter<T>> old = new ArrayList<Painter<T>>(getPainters());
this.painters.add(painter);
if (painter instanceof AbstractPainter)
{
((AbstractPainter<?>) painter).addPropertyChangeListener(handler); // depends on control dependency: [if], data = [none]
}
setDirty(true);
firePropertyChange("painters", old, getPainters());
} }
|
public class class_name {
public static GetSignedCookiesUrlTaskParameters deserialize(String taskParameters) {
JaxbJsonSerializer<GetSignedCookiesUrlTaskParameters> serializer =
new JaxbJsonSerializer<>(GetSignedCookiesUrlTaskParameters.class);
try {
GetSignedCookiesUrlTaskParameters params =
serializer.deserialize(taskParameters);
// Verify expected parameters
if (null == params.getSpaceId() || params.getSpaceId().isEmpty()) {
throw new TaskDataException(
"Task parameter 'spaceId' may not be empty");
} else if (null == params.getRedirectUrl() || params.getRedirectUrl().isEmpty()) {
throw new TaskDataException(
"Task parameter 'redirectUrl' may not be empty");
}
return params;
} catch (IOException e) {
throw new TaskDataException(
"Unable to parse task parameters due to: " + e.getMessage());
}
} }
|
public class class_name {
public static GetSignedCookiesUrlTaskParameters deserialize(String taskParameters) {
JaxbJsonSerializer<GetSignedCookiesUrlTaskParameters> serializer =
new JaxbJsonSerializer<>(GetSignedCookiesUrlTaskParameters.class);
try {
GetSignedCookiesUrlTaskParameters params =
serializer.deserialize(taskParameters);
// Verify expected parameters
if (null == params.getSpaceId() || params.getSpaceId().isEmpty()) {
throw new TaskDataException(
"Task parameter 'spaceId' may not be empty");
} else if (null == params.getRedirectUrl() || params.getRedirectUrl().isEmpty()) {
throw new TaskDataException(
"Task parameter 'redirectUrl' may not be empty");
}
return params; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new TaskDataException(
"Unable to parse task parameters due to: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(DescribeDefaultParametersRequest describeDefaultParametersRequest, ProtocolMarshaller protocolMarshaller) {
if (describeDefaultParametersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeDefaultParametersRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(describeDefaultParametersRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeDefaultParametersRequest describeDefaultParametersRequest, ProtocolMarshaller protocolMarshaller) {
if (describeDefaultParametersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeDefaultParametersRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeDefaultParametersRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public O withForwardedFields(String... forwardedFields) {
if (this.udfSemantics == null) {
// extract semantic properties from function annotations
setSemanticProperties(extractSemanticAnnotations(getFunction().getClass()));
}
if (this.udfSemantics == null
|| this.analyzedUdfSemantics) { // discard analyzed semantic properties
setSemanticProperties(new SingleInputSemanticProperties());
SemanticPropUtil.getSemanticPropsSingleFromString(this.udfSemantics, forwardedFields, null, null, this.getInputType(), this.getResultType());
} else {
if (udfWithForwardedFieldsAnnotation(getFunction().getClass())) {
// refuse semantic information as it would override the function annotation
throw new SemanticProperties.InvalidSemanticAnnotationException("Forwarded field information " +
"has already been added by a function annotation for this operator. " +
"Cannot overwrite function annotations.");
} else {
SemanticPropUtil.getSemanticPropsSingleFromString(this.udfSemantics, forwardedFields, null, null, this.getInputType(), this.getResultType());
}
}
@SuppressWarnings("unchecked")
O returnType = (O) this;
return returnType;
} }
|
public class class_name {
public O withForwardedFields(String... forwardedFields) {
if (this.udfSemantics == null) {
// extract semantic properties from function annotations
setSemanticProperties(extractSemanticAnnotations(getFunction().getClass())); // depends on control dependency: [if], data = [none]
}
if (this.udfSemantics == null
|| this.analyzedUdfSemantics) { // discard analyzed semantic properties
setSemanticProperties(new SingleInputSemanticProperties()); // depends on control dependency: [if], data = [none]
SemanticPropUtil.getSemanticPropsSingleFromString(this.udfSemantics, forwardedFields, null, null, this.getInputType(), this.getResultType()); // depends on control dependency: [if], data = [(this.udfSemantics]
} else {
if (udfWithForwardedFieldsAnnotation(getFunction().getClass())) {
// refuse semantic information as it would override the function annotation
throw new SemanticProperties.InvalidSemanticAnnotationException("Forwarded field information " +
"has already been added by a function annotation for this operator. " +
"Cannot overwrite function annotations.");
} else {
SemanticPropUtil.getSemanticPropsSingleFromString(this.udfSemantics, forwardedFields, null, null, this.getInputType(), this.getResultType()); // depends on control dependency: [if], data = [none]
}
}
@SuppressWarnings("unchecked")
O returnType = (O) this;
return returnType;
} }
|
public class class_name {
public DbModule getDbModule(final Module module) {
final DbModule dbModule = new DbModule();
dbModule.setName(module.getName());
dbModule.setVersion(module.getVersion());
dbModule.setPromoted(module.isPromoted());
dbModule.setSubmodule(module.isSubmodule());
dbModule.setCreatedDateTime(module.getCreatedDateTime());
dbModule.setUpdatedDateTime(module.getUpdatedDateTime());
// Artifact
for (final Artifact artifact : module.getArtifacts()) {
final DbArtifact dbArtifact = getDbArtifact(artifact);
dbModule.addArtifact(dbArtifact);
}
// Dependencies
for (final Dependency dependency : module.getDependencies()) {
dbModule.addDependency(dependency.getTarget().getGavc(), dependency.getScope());
}
// SubModules
final StringBuilder sb = new StringBuilder();
for (final Module submodule : module.getSubmodules()) {
final DbModule dbSubmodule = getDbModule(submodule);
dbModule.addSubmodule(dbSubmodule);
sb.setLength(0);
}
return dbModule;
} }
|
public class class_name {
public DbModule getDbModule(final Module module) {
final DbModule dbModule = new DbModule();
dbModule.setName(module.getName());
dbModule.setVersion(module.getVersion());
dbModule.setPromoted(module.isPromoted());
dbModule.setSubmodule(module.isSubmodule());
dbModule.setCreatedDateTime(module.getCreatedDateTime());
dbModule.setUpdatedDateTime(module.getUpdatedDateTime());
// Artifact
for (final Artifact artifact : module.getArtifacts()) {
final DbArtifact dbArtifact = getDbArtifact(artifact);
dbModule.addArtifact(dbArtifact); // depends on control dependency: [for], data = [none]
}
// Dependencies
for (final Dependency dependency : module.getDependencies()) {
dbModule.addDependency(dependency.getTarget().getGavc(), dependency.getScope()); // depends on control dependency: [for], data = [dependency]
}
// SubModules
final StringBuilder sb = new StringBuilder();
for (final Module submodule : module.getSubmodules()) {
final DbModule dbSubmodule = getDbModule(submodule);
dbModule.addSubmodule(dbSubmodule); // depends on control dependency: [for], data = [none]
sb.setLength(0); // depends on control dependency: [for], data = [none]
}
return dbModule;
} }
|
public class class_name {
public void marshall(SendAutomationSignalRequest sendAutomationSignalRequest, ProtocolMarshaller protocolMarshaller) {
if (sendAutomationSignalRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sendAutomationSignalRequest.getAutomationExecutionId(), AUTOMATIONEXECUTIONID_BINDING);
protocolMarshaller.marshall(sendAutomationSignalRequest.getSignalType(), SIGNALTYPE_BINDING);
protocolMarshaller.marshall(sendAutomationSignalRequest.getPayload(), PAYLOAD_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(SendAutomationSignalRequest sendAutomationSignalRequest, ProtocolMarshaller protocolMarshaller) {
if (sendAutomationSignalRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sendAutomationSignalRequest.getAutomationExecutionId(), AUTOMATIONEXECUTIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sendAutomationSignalRequest.getSignalType(), SIGNALTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sendAutomationSignalRequest.getPayload(), PAYLOAD_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 String doubleChar(final String str, final char c)
{
if (isEmpty(str)) {
return str;
}
int start = 0;
int end = str.indexOf(c, start);
if (end == INDEX_NOT_FOUND) {
return str;
}
final StringBuilder buf = new StringBuilder(str.length() + 1);
do {
end += 1;
buf.append(str.substring(start, end)).append(c);
start = end;
end = str.indexOf(c, start);
} while (end != INDEX_NOT_FOUND);
buf.append(str.substring(start));
return buf.toString();
} }
|
public class class_name {
public static String doubleChar(final String str, final char c)
{
if (isEmpty(str)) {
return str; // depends on control dependency: [if], data = [none]
}
int start = 0;
int end = str.indexOf(c, start);
if (end == INDEX_NOT_FOUND) {
return str; // depends on control dependency: [if], data = [none]
}
final StringBuilder buf = new StringBuilder(str.length() + 1);
do {
end += 1;
buf.append(str.substring(start, end)).append(c);
start = end;
end = str.indexOf(c, start);
} while (end != INDEX_NOT_FOUND);
buf.append(str.substring(start));
return buf.toString();
} }
|
public class class_name {
@Override
public void execute()
{
if ( "pom".equals( project.getPackaging() ) )
{
getLog().info( "Skipping SCoverage execution for project with packaging type 'pom'" );
return;
}
if ( skip )
{
getLog().info( "Skipping Scoverage execution" );
return;
}
long ts = System.currentTimeMillis();
SCoverageForkedLifecycleConfigurator.afterForkedLifecycleExit( project, reactorProjects );
long te = System.currentTimeMillis();
getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) );
} }
|
public class class_name {
@Override
public void execute()
{
if ( "pom".equals( project.getPackaging() ) )
{
getLog().info( "Skipping SCoverage execution for project with packaging type 'pom'" ); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if ( skip )
{
getLog().info( "Skipping Scoverage execution" ); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
long ts = System.currentTimeMillis();
SCoverageForkedLifecycleConfigurator.afterForkedLifecycleExit( project, reactorProjects );
long te = System.currentTimeMillis();
getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) );
} }
|
public class class_name {
private static LoggerOutput getMQLightOutput(String defaultOutput, String type) {
String requiredOutput = System.getenv("MQLIGHT_JAVA_LOG_STREAM");
if (requiredOutput == null || requiredOutput.trim().length() == 0) requiredOutput = defaultOutput;
final LoggerOutput result;
if (requiredOutput.equals("stdout")) {
result = new LoggerOutput(requiredOutput, "", System.out);
} else if (requiredOutput.equals("stderr")) {
result = new LoggerOutput(requiredOutput, "", System.err);
} else {
final String logFileCount = System.getenv("MQLIGHT_JAVA_LOG_FILE_COUNT");
final String logFileLimit = System.getenv("MQLIGHT_JAVA_LOG_FILE_LIMIT");
PrintStream outputStream = null;
try {
outputStream = new PrintStream(new File(requiredOutput+"."+type), outputEncoding);
} catch (FileNotFoundException | UnsupportedEncodingException e) {
final ClientRuntimeException exception =
new ClientRuntimeException("Unable to log to file: \'" + requiredOutput+"."+type + "\': " + e.getLocalizedMessage());
throw exception;
}
result = new LoggerOutput(requiredOutput, type, outputStream, logFileCount, logFileLimit);
}
return result;
} }
|
public class class_name {
private static LoggerOutput getMQLightOutput(String defaultOutput, String type) {
String requiredOutput = System.getenv("MQLIGHT_JAVA_LOG_STREAM");
if (requiredOutput == null || requiredOutput.trim().length() == 0) requiredOutput = defaultOutput;
final LoggerOutput result;
if (requiredOutput.equals("stdout")) {
result = new LoggerOutput(requiredOutput, "", System.out); // depends on control dependency: [if], data = [none]
} else if (requiredOutput.equals("stderr")) {
result = new LoggerOutput(requiredOutput, "", System.err); // depends on control dependency: [if], data = [none]
} else {
final String logFileCount = System.getenv("MQLIGHT_JAVA_LOG_FILE_COUNT");
final String logFileLimit = System.getenv("MQLIGHT_JAVA_LOG_FILE_LIMIT");
PrintStream outputStream = null;
try {
outputStream = new PrintStream(new File(requiredOutput+"."+type), outputEncoding); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException | UnsupportedEncodingException e) {
final ClientRuntimeException exception =
new ClientRuntimeException("Unable to log to file: \'" + requiredOutput+"."+type + "\': " + e.getLocalizedMessage());
throw exception;
} // depends on control dependency: [catch], data = [none]
result = new LoggerOutput(requiredOutput, type, outputStream, logFileCount, logFileLimit); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public static @CheckForNull String getValidTimezone(String timezone) {
String[] validIDs = TimeZone.getAvailableIDs();
for (String str : validIDs) {
if (str != null && str.equals(timezone)) {
return timezone;
}
}
return null;
} }
|
public class class_name {
public static @CheckForNull String getValidTimezone(String timezone) {
String[] validIDs = TimeZone.getAvailableIDs();
for (String str : validIDs) {
if (str != null && str.equals(timezone)) {
return timezone; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
protected void train(InstanceContentEvent inEvent) {
Instance trainInst = inEvent.getInstance();
for (int i = 0; i < sizeEnsemble; i++) {
int k = MiscUtils.poisson(1.0, this.random);
if (k > 0) {
Instance weightedInst = trainInst.copy();
weightedInst.setWeight(trainInst.weight() * k);
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
inEvent.getInstanceIndex(), weightedInst, true, false);
instanceContentEvent.setClassifierIndex(i);
instanceContentEvent.setEvaluationIndex(inEvent.getEvaluationIndex());
trainingStream.put(instanceContentEvent);
}
}
} }
|
public class class_name {
protected void train(InstanceContentEvent inEvent) {
Instance trainInst = inEvent.getInstance();
for (int i = 0; i < sizeEnsemble; i++) {
int k = MiscUtils.poisson(1.0, this.random);
if (k > 0) {
Instance weightedInst = trainInst.copy();
weightedInst.setWeight(trainInst.weight() * k); // depends on control dependency: [if], data = [none]
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
inEvent.getInstanceIndex(), weightedInst, true, false);
instanceContentEvent.setClassifierIndex(i); // depends on control dependency: [if], data = [none]
instanceContentEvent.setEvaluationIndex(inEvent.getEvaluationIndex()); // depends on control dependency: [if], data = [none]
trainingStream.put(instanceContentEvent); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static int getInt(Object obj, String fieldName) {
try {
return getField(obj.getClass(), fieldName).getInt(obj);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
public static int getInt(Object obj, String fieldName) {
try {
return getField(obj.getClass(), fieldName).getInt(obj); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
@Pure
public int indexOf(Object obj) {
if (this.clazz.isInstance(obj)) {
return this.grid.indexOf(this.clazz.cast(obj));
}
return -1;
} }
|
public class class_name {
@Override
@Pure
public int indexOf(Object obj) {
if (this.clazz.isInstance(obj)) {
return this.grid.indexOf(this.clazz.cast(obj)); // depends on control dependency: [if], data = [none]
}
return -1;
} }
|
public class class_name {
private void _processValue (@Nonnull final CValuePropertyInfo aProperty, final ClassOutline aClassOutline)
{
final String sPropertyName = aProperty.getName (false);
final XSComponent aDefinition = aProperty.getSchemaComponent ();
if (aDefinition instanceof RestrictionSimpleTypeImpl)
{
final RestrictionSimpleTypeImpl aParticle = (RestrictionSimpleTypeImpl) aDefinition;
final XSSimpleType aSimpleType = aParticle.asSimpleType ();
final JFieldVar aFieldVar = aClassOutline.implClass.fields ().get (sPropertyName);
// if (particle.isRequired()) {
// if (!hasAnnotation(var, NotNull.class)) {
// if (notNullAnnotations) {
// var.annotate(NotNull.class);
// }
// }
// }
_processType (aSimpleType, aFieldVar);
}
} }
|
public class class_name {
private void _processValue (@Nonnull final CValuePropertyInfo aProperty, final ClassOutline aClassOutline)
{
final String sPropertyName = aProperty.getName (false);
final XSComponent aDefinition = aProperty.getSchemaComponent ();
if (aDefinition instanceof RestrictionSimpleTypeImpl)
{
final RestrictionSimpleTypeImpl aParticle = (RestrictionSimpleTypeImpl) aDefinition;
final XSSimpleType aSimpleType = aParticle.asSimpleType ();
final JFieldVar aFieldVar = aClassOutline.implClass.fields ().get (sPropertyName);
// if (particle.isRequired()) {
// if (!hasAnnotation(var, NotNull.class)) {
// if (notNullAnnotations) {
// var.annotate(NotNull.class);
// }
// }
// }
_processType (aSimpleType, aFieldVar); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void writeEntitySets(XMLStreamWriter writer) throws XMLStreamException, ODataRenderException {
List<EntitySet> entitySets = getEntityContainer().getEntitySets();
LOG.debug("Number of entity sets to be written in service document are {}", entitySets.size());
for (EntitySet entitySet : entitySets) {
if (entitySet.isIncludedInServiceDocument()) {
writeElement(writer, null, SERVICE_COLLECTION, null, entitySet.getName(), entitySet.getName());
}
}
} }
|
public class class_name {
private void writeEntitySets(XMLStreamWriter writer) throws XMLStreamException, ODataRenderException {
List<EntitySet> entitySets = getEntityContainer().getEntitySets();
LOG.debug("Number of entity sets to be written in service document are {}", entitySets.size());
for (EntitySet entitySet : entitySets) {
if (entitySet.isIncludedInServiceDocument()) {
writeElement(writer, null, SERVICE_COLLECTION, null, entitySet.getName(), entitySet.getName()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void incrementUnreadNotification(final AbstractNotificationView view,
final EventContainer<?> newEventContainer) {
if (!view.equals(currentView) || newEventContainer.getUnreadNotificationMessageKey() == null) {
return;
}
NotificationUnreadValue notificationUnreadValue = unreadNotifications.get(newEventContainer.getClass());
if (notificationUnreadValue == null) {
notificationUnreadValue = new NotificationUnreadValue(0,
newEventContainer.getUnreadNotificationMessageKey());
unreadNotifications.put(newEventContainer.getClass(), notificationUnreadValue);
}
notificationUnreadValue.incrementUnreadNotifications();
unreadNotificationCounter++;
refreshCaption();
} }
|
public class class_name {
public void incrementUnreadNotification(final AbstractNotificationView view,
final EventContainer<?> newEventContainer) {
if (!view.equals(currentView) || newEventContainer.getUnreadNotificationMessageKey() == null) {
return; // depends on control dependency: [if], data = [none]
}
NotificationUnreadValue notificationUnreadValue = unreadNotifications.get(newEventContainer.getClass());
if (notificationUnreadValue == null) {
notificationUnreadValue = new NotificationUnreadValue(0,
newEventContainer.getUnreadNotificationMessageKey()); // depends on control dependency: [if], data = [none]
unreadNotifications.put(newEventContainer.getClass(), notificationUnreadValue); // depends on control dependency: [if], data = [none]
}
notificationUnreadValue.incrementUnreadNotifications();
unreadNotificationCounter++;
refreshCaption();
} }
|
public class class_name {
public Map<String, Object> getSharedVars()
{
if(sharedVars==null) {
sharedVars = new HashMap<String, Object>();
}
return sharedVars;
} }
|
public class class_name {
public Map<String, Object> getSharedVars()
{
if(sharedVars==null) {
sharedVars = new HashMap<String, Object>();
// depends on control dependency: [if], data = [none]
}
return sharedVars;
} }
|
public class class_name {
public static String getSheetNameFromFullCellRefName(
final String fullName) {
if ((fullName != null) && (fullName.contains("!"))) {
return fullName.substring(0, fullName.indexOf('!'));
}
return null;
} }
|
public class class_name {
public static String getSheetNameFromFullCellRefName(
final String fullName) {
if ((fullName != null) && (fullName.contains("!"))) {
return fullName.substring(0, fullName.indexOf('!'));
// depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@Override // override for Javadoc and performance
public boolean isAfter(ChronoLocalDateTime<?> other) {
if (other instanceof LocalDateTime) {
return compareTo0((LocalDateTime) other) > 0;
}
return super.isAfter(other);
} }
|
public class class_name {
@Override // override for Javadoc and performance
public boolean isAfter(ChronoLocalDateTime<?> other) {
if (other instanceof LocalDateTime) {
return compareTo0((LocalDateTime) other) > 0; // depends on control dependency: [if], data = [none]
}
return super.isAfter(other);
} }
|
public class class_name {
public void performRecovery(ObjectManagerState objectManagerState)
throws ObjectManagerException {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"performRecovery",
objectManagerState);
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
"logicalUnitOfWork=" + logicalUnitOfWork + "(LogicalUnitOfWork)"
+ "\n transactionState=" + transactionState + "(int)"
+ "\n tokensToAdd=" + tokensToAdd + "(java.util.Collection)"
+ "\n tokensToReplace=" + tokensToReplace + "(java.util.Collecton)"
+ "\n serializedBytesToReplace=" + serializedBytesToReplace + "(java.util.Collection)"
+ "\n tokensToOptimisticReplace=" + tokensToOptimisticReplace + "(java.util.Collection)"
+ "\n tokensToDelete=" + tokensToDelete + "(java.util.Collection)"
+ "\n tokensToNotify=" + tokensToNotify + "(java.util.Collection)");
// In principle we should test to see if objectManagerState.checkpointEndSee is true,
// because if it is we dont need to do this processing because the transaction is
// already in its correct state, however there is also no harm in processing this again.
// We have started an new checkpoint but not completed it.
// Redo the operations of the ManagedObject using its original Transaction.
Transaction transactionForRecovery = objectManagerState.getTransaction(logicalUnitOfWork);
// Recover the Added ManagedObjects.
for (java.util.Iterator tokenIterator = tokensToAdd.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
// If a subsequent transaction has deleted the ManagedObject we dont need to recover it.
if (existingManagedObject != null) {
// Revert to constructed state.
existingManagedObject.state = ManagedObject.stateConstructed;
transactionForRecovery.addFromCheckpoint(existingManagedObject);
} // if(existingManagedObject != null).
} // for ... tokensToAdd.
// Recover the Replace ManagedObjects.
java.util.Iterator serializedBytesIterator = serializedBytesToReplace.iterator();
for (java.util.Iterator tokenIterator = tokensToReplace.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
byte[] managedObjectBytes = (byte[]) serializedBytesIterator.next();
ManagedObject replacementManagedObject = ManagedObject.restoreFromSerializedBytes(managedObjectBytes,
objectManagerState);
// If a subsequent transaction has deleted the ManagedObject we dont need to recover it.
if (existingManagedObject != null) {
// Replace what we already have with this version.
transactionForRecovery.lock(existingManagedObject);
// Make the underlying object the way it was when we made the original transaction.replace()
// call.
token.setManagedObject(replacementManagedObject);
transactionForRecovery.replaceFromCheckpoint(existingManagedObject,
managedObjectBytes);
} // if(existingManagedObject != null).
} // for ... tokensToReplace.
// Recover the Optimistic Replace ManagedObjects.
for (java.util.Iterator tokenIterator = tokensToOptimisticReplace.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
// If a subsequent transaction has deleted the ManagedObject we dont need to recover it.
if (existingManagedObject != null) {
transactionForRecovery.optimisticReplaceFromCheckpoint(existingManagedObject);
} // if(existingManagedObject != null).
} // for ... tokensToOptimisticReplace.
// Recover the Delete ManagedObjects.
for (java.util.Iterator tokenIterator = tokensToDelete.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
// If the object has already been deleted we need not do anything.
if (existingManagedObject != null) {
transactionForRecovery.deleteFromCheckpoint(existingManagedObject);
} // if(existingManagedObject != null).
} // for ... tokensToDelete.
// Recover the Notify ManagedObjects.
for (java.util.Iterator tokenIterator = tokensToNotify.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
// If the object has already been deleted we need not do anything.
if (existingManagedObject != null) {
transactionForRecovery.notifyFromCheckpoint(token);
} // if(existingManagedObject != null).
} // for ... tokensToNotify.
transactionForRecovery.internalTransaction.resetState(transactionState);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"performRecovery");
} }
|
public class class_name {
public void performRecovery(ObjectManagerState objectManagerState)
throws ObjectManagerException {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"performRecovery",
objectManagerState);
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
"logicalUnitOfWork=" + logicalUnitOfWork + "(LogicalUnitOfWork)"
+ "\n transactionState=" + transactionState + "(int)"
+ "\n tokensToAdd=" + tokensToAdd + "(java.util.Collection)"
+ "\n tokensToReplace=" + tokensToReplace + "(java.util.Collecton)"
+ "\n serializedBytesToReplace=" + serializedBytesToReplace + "(java.util.Collection)"
+ "\n tokensToOptimisticReplace=" + tokensToOptimisticReplace + "(java.util.Collection)"
+ "\n tokensToDelete=" + tokensToDelete + "(java.util.Collection)"
+ "\n tokensToNotify=" + tokensToNotify + "(java.util.Collection)");
// In principle we should test to see if objectManagerState.checkpointEndSee is true,
// because if it is we dont need to do this processing because the transaction is
// already in its correct state, however there is also no harm in processing this again.
// We have started an new checkpoint but not completed it.
// Redo the operations of the ManagedObject using its original Transaction.
Transaction transactionForRecovery = objectManagerState.getTransaction(logicalUnitOfWork);
// Recover the Added ManagedObjects.
for (java.util.Iterator tokenIterator = tokensToAdd.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
// If a subsequent transaction has deleted the ManagedObject we dont need to recover it.
if (existingManagedObject != null) {
// Revert to constructed state.
existingManagedObject.state = ManagedObject.stateConstructed; // depends on control dependency: [if], data = [none]
transactionForRecovery.addFromCheckpoint(existingManagedObject); // depends on control dependency: [if], data = [(existingManagedObject]
} // if(existingManagedObject != null).
} // for ... tokensToAdd.
// Recover the Replace ManagedObjects.
java.util.Iterator serializedBytesIterator = serializedBytesToReplace.iterator();
for (java.util.Iterator tokenIterator = tokensToReplace.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
byte[] managedObjectBytes = (byte[]) serializedBytesIterator.next();
ManagedObject replacementManagedObject = ManagedObject.restoreFromSerializedBytes(managedObjectBytes,
objectManagerState);
// If a subsequent transaction has deleted the ManagedObject we dont need to recover it.
if (existingManagedObject != null) {
// Replace what we already have with this version.
transactionForRecovery.lock(existingManagedObject); // depends on control dependency: [if], data = [(existingManagedObject]
// Make the underlying object the way it was when we made the original transaction.replace()
// call.
token.setManagedObject(replacementManagedObject); // depends on control dependency: [if], data = [none]
transactionForRecovery.replaceFromCheckpoint(existingManagedObject,
managedObjectBytes); // depends on control dependency: [if], data = [none]
} // if(existingManagedObject != null).
} // for ... tokensToReplace.
// Recover the Optimistic Replace ManagedObjects.
for (java.util.Iterator tokenIterator = tokensToOptimisticReplace.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
// If a subsequent transaction has deleted the ManagedObject we dont need to recover it.
if (existingManagedObject != null) {
transactionForRecovery.optimisticReplaceFromCheckpoint(existingManagedObject); // depends on control dependency: [if], data = [(existingManagedObject]
} // if(existingManagedObject != null).
} // for ... tokensToOptimisticReplace.
// Recover the Delete ManagedObjects.
for (java.util.Iterator tokenIterator = tokensToDelete.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
// If the object has already been deleted we need not do anything.
if (existingManagedObject != null) {
transactionForRecovery.deleteFromCheckpoint(existingManagedObject); // depends on control dependency: [if], data = [(existingManagedObject]
} // if(existingManagedObject != null).
} // for ... tokensToDelete.
// Recover the Notify ManagedObjects.
for (java.util.Iterator tokenIterator = tokensToNotify.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
// If the object has already been deleted we need not do anything.
if (existingManagedObject != null) {
transactionForRecovery.notifyFromCheckpoint(token); // depends on control dependency: [if], data = [none]
} // if(existingManagedObject != null).
} // for ... tokensToNotify.
transactionForRecovery.internalTransaction.resetState(transactionState);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"performRecovery");
} }
|
public class class_name {
public static Configuration createConfiguration(UnderFileSystemConfiguration conf) {
Preconditions.checkNotNull(conf, "conf");
Configuration hdfsConf = new Configuration();
// Load HDFS site properties from the given file and overwrite the default HDFS conf,
// the path of this file can be passed through --option
for (String path : conf.get(PropertyKey.UNDERFS_HDFS_CONFIGURATION).split(":")) {
hdfsConf.addResource(new Path(path));
}
// On Hadoop 2.x this is strictly unnecessary since it uses ServiceLoader to automatically
// discover available file system implementations. However this configuration setting is
// required for earlier Hadoop versions plus it is still honoured as an override even in 2.x so
// if present propagate it to the Hadoop configuration
String ufsHdfsImpl = conf.get(PropertyKey.UNDERFS_HDFS_IMPL);
if (!StringUtils.isEmpty(ufsHdfsImpl)) {
hdfsConf.set("fs.hdfs.impl", ufsHdfsImpl);
}
// Disable HDFS client caching so that input configuration is respected. Configurable from
// system property
hdfsConf.set("fs.hdfs.impl.disable.cache",
System.getProperty("fs.hdfs.impl.disable.cache", "true"));
// Set all parameters passed through --option
for (Map.Entry<String, String> entry : conf.getMountSpecificConf().entrySet()) {
hdfsConf.set(entry.getKey(), entry.getValue());
}
return hdfsConf;
} }
|
public class class_name {
public static Configuration createConfiguration(UnderFileSystemConfiguration conf) {
Preconditions.checkNotNull(conf, "conf");
Configuration hdfsConf = new Configuration();
// Load HDFS site properties from the given file and overwrite the default HDFS conf,
// the path of this file can be passed through --option
for (String path : conf.get(PropertyKey.UNDERFS_HDFS_CONFIGURATION).split(":")) {
hdfsConf.addResource(new Path(path)); // depends on control dependency: [for], data = [path]
}
// On Hadoop 2.x this is strictly unnecessary since it uses ServiceLoader to automatically
// discover available file system implementations. However this configuration setting is
// required for earlier Hadoop versions plus it is still honoured as an override even in 2.x so
// if present propagate it to the Hadoop configuration
String ufsHdfsImpl = conf.get(PropertyKey.UNDERFS_HDFS_IMPL);
if (!StringUtils.isEmpty(ufsHdfsImpl)) {
hdfsConf.set("fs.hdfs.impl", ufsHdfsImpl); // depends on control dependency: [if], data = [none]
}
// Disable HDFS client caching so that input configuration is respected. Configurable from
// system property
hdfsConf.set("fs.hdfs.impl.disable.cache",
System.getProperty("fs.hdfs.impl.disable.cache", "true"));
// Set all parameters passed through --option
for (Map.Entry<String, String> entry : conf.getMountSpecificConf().entrySet()) {
hdfsConf.set(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
return hdfsConf;
} }
|
public class class_name {
private Object getPropertyTypeValue(Class propertyType, Object value) {
if (propertyType.equals(String.class)) {
return value.toString();
} else if (propertyType.equals(Boolean.class) || propertyType.equals(Boolean.TYPE)) {
Boolean arg = null;
if (value instanceof Boolean) {
arg = (Boolean) value;
} else {
arg = Boolean.parseBoolean(value.toString());
}
return arg;
} else if (propertyType.equals(Short.class) || propertyType.equals(Short.TYPE)) {
Short arg = null;
if (value instanceof Short) {
arg = (Short) value;
} else {
arg = Short.parseShort(value.toString());
}
return arg;
} else if (propertyType.equals(Integer.class) || propertyType.equals(Integer.TYPE)) {
Integer arg = null;
if (value instanceof Integer) {
arg = (Integer) value;
} else {
arg = Integer.parseInt(value.toString());
}
return arg;
} else if (propertyType.equals(Long.class) || propertyType.equals(Long.TYPE)) {
Long arg = null;
if (value instanceof Long) {
arg = (Long) value;
} else {
arg = Long.parseLong(value.toString());
}
return arg;
} else if (propertyType.equals(Float.class) || propertyType.equals(Float.TYPE)) {
Float arg = null;
if (value instanceof Float) {
arg = (Float) value;
} else {
arg = Float.parseFloat(value.toString());
}
return arg;
} else if (propertyType.equals(Double.class) || propertyType.equals(Double.TYPE)) {
Double arg = null;
if (value instanceof Double) {
arg = (Double) value;
} else {
arg = Double.parseDouble(value.toString());
}
return arg;
} else { // Object
return value;
}
} }
|
public class class_name {
private Object getPropertyTypeValue(Class propertyType, Object value) {
if (propertyType.equals(String.class)) {
return value.toString(); // depends on control dependency: [if], data = [none]
} else if (propertyType.equals(Boolean.class) || propertyType.equals(Boolean.TYPE)) {
Boolean arg = null;
if (value instanceof Boolean) {
arg = (Boolean) value; // depends on control dependency: [if], data = [none]
} else {
arg = Boolean.parseBoolean(value.toString()); // depends on control dependency: [if], data = [none]
}
return arg; // depends on control dependency: [if], data = [none]
} else if (propertyType.equals(Short.class) || propertyType.equals(Short.TYPE)) {
Short arg = null;
if (value instanceof Short) {
arg = (Short) value; // depends on control dependency: [if], data = [none]
} else {
arg = Short.parseShort(value.toString()); // depends on control dependency: [if], data = [none]
}
return arg; // depends on control dependency: [if], data = [none]
} else if (propertyType.equals(Integer.class) || propertyType.equals(Integer.TYPE)) {
Integer arg = null;
if (value instanceof Integer) {
arg = (Integer) value; // depends on control dependency: [if], data = [none]
} else {
arg = Integer.parseInt(value.toString()); // depends on control dependency: [if], data = [none]
}
return arg; // depends on control dependency: [if], data = [none]
} else if (propertyType.equals(Long.class) || propertyType.equals(Long.TYPE)) {
Long arg = null;
if (value instanceof Long) {
arg = (Long) value; // depends on control dependency: [if], data = [none]
} else {
arg = Long.parseLong(value.toString()); // depends on control dependency: [if], data = [none]
}
return arg; // depends on control dependency: [if], data = [none]
} else if (propertyType.equals(Float.class) || propertyType.equals(Float.TYPE)) {
Float arg = null;
if (value instanceof Float) {
arg = (Float) value; // depends on control dependency: [if], data = [none]
} else {
arg = Float.parseFloat(value.toString()); // depends on control dependency: [if], data = [none]
}
return arg; // depends on control dependency: [if], data = [none]
} else if (propertyType.equals(Double.class) || propertyType.equals(Double.TYPE)) {
Double arg = null;
if (value instanceof Double) {
arg = (Double) value; // depends on control dependency: [if], data = [none]
} else {
arg = Double.parseDouble(value.toString()); // depends on control dependency: [if], data = [none]
}
return arg; // depends on control dependency: [if], data = [none]
} else { // Object
return value; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
try {
Object objData = Converter.convertObjectToDatatype(strString, this.getDataClass(), null, m_ibScale);
if (objData == null)
if (this.getDataClass() != Boolean.class)
if (!(Number.class.isAssignableFrom(this.getDataClass())))
if (this.getDataClass() != java.util.Date.class)
objData = Constants.BLANK; // To set a null internally, you must call setData directly
return this.setData(objData, bDisplayOption, iMoveMode);
} catch (Exception ex) {
String strError = ex.getMessage();
if (strError == null)
strError = ex.getClass().getName();
if (this.getRecord() != null)
if (this.getRecord().getTask() != null)
return this.getRecord().getTask().setLastError(strError);
return Constants.ERROR_RETURN;
}
} }
|
public class class_name {
public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
try {
Object objData = Converter.convertObjectToDatatype(strString, this.getDataClass(), null, m_ibScale);
if (objData == null)
if (this.getDataClass() != Boolean.class)
if (!(Number.class.isAssignableFrom(this.getDataClass())))
if (this.getDataClass() != java.util.Date.class)
objData = Constants.BLANK; // To set a null internally, you must call setData directly
return this.setData(objData, bDisplayOption, iMoveMode); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
String strError = ex.getMessage();
if (strError == null)
strError = ex.getClass().getName();
if (this.getRecord() != null)
if (this.getRecord().getTask() != null)
return this.getRecord().getTask().setLastError(strError);
return Constants.ERROR_RETURN;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected synchronized void fetchAd() {
Context context = mContext.get();
if (context != null) {
Log.i(TAG, "Fetching Ad now");
if(lockFetch.getAndSet(true))
return;
mFetchingAdsCnt++;
adLoader.loadAd(getAdRequest()); //Fetching the ads item
} else {
mFetchFailCount++;
Log.i(TAG, "Context is null, not fetching Ad");
}
} }
|
public class class_name {
protected synchronized void fetchAd() {
Context context = mContext.get();
if (context != null) {
Log.i(TAG, "Fetching Ad now"); // depends on control dependency: [if], data = [none]
if(lockFetch.getAndSet(true))
return;
mFetchingAdsCnt++; // depends on control dependency: [if], data = [none]
adLoader.loadAd(getAdRequest()); //Fetching the ads item // depends on control dependency: [if], data = [none]
} else {
mFetchFailCount++; // depends on control dependency: [if], data = [none]
Log.i(TAG, "Context is null, not fetching Ad"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean hasHashChanged(Hasher hasher, RegData regDatum) {
String urlExternalForm = regDatum.getURLExternalForm();
Boolean modified = mUrlExternalForm2Modified.get(urlExternalForm);
if (modified != null) {
return modified;
}
// Check hash
String newHash = hasher.hashURL(urlExternalForm);
modified = !newHash.equals(regDatum.getHash());
mUrlExternalForm2Modified.put(urlExternalForm, modified);
return modified;
} }
|
public class class_name {
private boolean hasHashChanged(Hasher hasher, RegData regDatum) {
String urlExternalForm = regDatum.getURLExternalForm();
Boolean modified = mUrlExternalForm2Modified.get(urlExternalForm);
if (modified != null) {
return modified; // depends on control dependency: [if], data = [none]
}
// Check hash
String newHash = hasher.hashURL(urlExternalForm);
modified = !newHash.equals(regDatum.getHash());
mUrlExternalForm2Modified.put(urlExternalForm, modified);
return modified;
} }
|
public class class_name {
public static <T> void forEachWithIndex(List<T> list, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure)
{
ListIterate.rangeCheck(from, to, list.size());
if (list instanceof RandomAccess)
{
RandomAccessListIterate.forEachWithIndex(list, from, to, objectIntProcedure);
}
else
{
if (from <= to)
{
ListIterator<T> iterator = list.listIterator(from);
for (int i = from; i <= to; i++)
{
objectIntProcedure.value(iterator.next(), i);
}
}
else
{
ListIterator<T> iterator = list.listIterator(from + 1);
for (int i = from; i >= to; i--)
{
objectIntProcedure.value(iterator.previous(), i);
}
}
}
} }
|
public class class_name {
public static <T> void forEachWithIndex(List<T> list, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure)
{
ListIterate.rangeCheck(from, to, list.size());
if (list instanceof RandomAccess)
{
RandomAccessListIterate.forEachWithIndex(list, from, to, objectIntProcedure); // depends on control dependency: [if], data = [none]
}
else
{
if (from <= to)
{
ListIterator<T> iterator = list.listIterator(from);
for (int i = from; i <= to; i++)
{
objectIntProcedure.value(iterator.next(), i); // depends on control dependency: [for], data = [i]
}
}
else
{
ListIterator<T> iterator = list.listIterator(from + 1);
for (int i = from; i >= to; i--)
{
objectIntProcedure.value(iterator.previous(), i); // depends on control dependency: [for], data = [i]
}
}
}
} }
|
public class class_name {
@Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
Log.d(TAG, "Element " + position + " set.");
// Get element from your dataset at this position and replace the contents of the view
// with that element
Log.e("jus", jarr.get(position).asJsonObject().getString("pic"));
viewHolder.niv.setImageUrl(jarr.get(position).asJsonObject().getString("pic"), imageLoader);
viewHolder.txt1.setText(position + " : " + jarr.get(position).asJsonObject().getString
("txt1"));
/// COOL ANIM
View v = (View) viewHolder.niv.getParent().getParent();
if (v != null && !positionsMapper.get(position) && position > lastPosition) {
speed = scrollListener.getSpeed();
animDuration = (((int) speed) == 0) ? ANIM_DEFAULT_SPEED : (long) ((1 / speed) * 3000);
Log.d(TAG, "scroll speed/dur : " + speed + " / " + animDuration);
//animDuration = ANIM_DEFAULT_SPEED;
if (animDuration > ANIM_DEFAULT_SPEED)
animDuration = ANIM_DEFAULT_SPEED;
lastPosition = position;
v.setTranslationX(0.0F);
v.setTranslationY(height);
v.setRotationX(35.0F);
v.setScaleX(0.7F);
v.setScaleY(0.55F);
ViewPropertyAnimator localViewPropertyAnimator =
v.animate().rotationX(0.0F).rotationY(0.0F).translationX(0).translationY(0)
.setDuration(animDuration).scaleX(
1.0F).scaleY(1.0F).setInterpolator(interpolator);
localViewPropertyAnimator.setStartDelay(0).start();
positionsMapper.put(position, true);
}
} }
|
public class class_name {
@Override
public void onBindViewHolder(ViewHolder viewHolder, final int position) {
Log.d(TAG, "Element " + position + " set.");
// Get element from your dataset at this position and replace the contents of the view
// with that element
Log.e("jus", jarr.get(position).asJsonObject().getString("pic"));
viewHolder.niv.setImageUrl(jarr.get(position).asJsonObject().getString("pic"), imageLoader);
viewHolder.txt1.setText(position + " : " + jarr.get(position).asJsonObject().getString
("txt1"));
/// COOL ANIM
View v = (View) viewHolder.niv.getParent().getParent();
if (v != null && !positionsMapper.get(position) && position > lastPosition) {
speed = scrollListener.getSpeed(); // depends on control dependency: [if], data = [none]
animDuration = (((int) speed) == 0) ? ANIM_DEFAULT_SPEED : (long) ((1 / speed) * 3000); // depends on control dependency: [if], data = [none]
Log.d(TAG, "scroll speed/dur : " + speed + " / " + animDuration); // depends on control dependency: [if], data = [none]
//animDuration = ANIM_DEFAULT_SPEED;
if (animDuration > ANIM_DEFAULT_SPEED)
animDuration = ANIM_DEFAULT_SPEED;
lastPosition = position; // depends on control dependency: [if], data = [none]
v.setTranslationX(0.0F); // depends on control dependency: [if], data = [none]
v.setTranslationY(height); // depends on control dependency: [if], data = [none]
v.setRotationX(35.0F); // depends on control dependency: [if], data = [none]
v.setScaleX(0.7F); // depends on control dependency: [if], data = [none]
v.setScaleY(0.55F); // depends on control dependency: [if], data = [none]
ViewPropertyAnimator localViewPropertyAnimator =
v.animate().rotationX(0.0F).rotationY(0.0F).translationX(0).translationY(0)
.setDuration(animDuration).scaleX(
1.0F).scaleY(1.0F).setInterpolator(interpolator);
localViewPropertyAnimator.setStartDelay(0).start(); // depends on control dependency: [if], data = [none]
positionsMapper.put(position, true); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public final EObject entryRuleXListLiteral() throws RecognitionException {
EObject current = null;
EObject iv_ruleXListLiteral = null;
try {
// InternalSARL.g:13856:53: (iv_ruleXListLiteral= ruleXListLiteral EOF )
// InternalSARL.g:13857:2: iv_ruleXListLiteral= ruleXListLiteral EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXListLiteralRule());
}
pushFollow(FOLLOW_1);
iv_ruleXListLiteral=ruleXListLiteral();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleXListLiteral;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject entryRuleXListLiteral() throws RecognitionException {
EObject current = null;
EObject iv_ruleXListLiteral = null;
try {
// InternalSARL.g:13856:53: (iv_ruleXListLiteral= ruleXListLiteral EOF )
// InternalSARL.g:13857:2: iv_ruleXListLiteral= ruleXListLiteral EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXListLiteralRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleXListLiteral=ruleXListLiteral();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleXListLiteral; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
private void cleanup_heartbeat_filters() {
Enumeration channel_names = channel_map.keys();
while (channel_names.hasMoreElements()) {
String name = (String) channel_names.nextElement();
EventChannelStruct eventChannelStruct = channel_map.get(name);
if (eventChannelStruct.consumer instanceof NotifdEventConsumer) {
try {
int filter_id = eventChannelStruct.heartbeat_filter_id;
Filter filter =
eventChannelStruct.structuredProxyPushSupplier.get_filter(filter_id);
eventChannelStruct.structuredProxyPushSupplier.remove_filter(filter_id);
filter.destroy();
} catch (FilterNotFound e) {
// do nothing
}
}
}
} }
|
public class class_name {
private void cleanup_heartbeat_filters() {
Enumeration channel_names = channel_map.keys();
while (channel_names.hasMoreElements()) {
String name = (String) channel_names.nextElement();
EventChannelStruct eventChannelStruct = channel_map.get(name);
if (eventChannelStruct.consumer instanceof NotifdEventConsumer) {
try {
int filter_id = eventChannelStruct.heartbeat_filter_id;
Filter filter =
eventChannelStruct.structuredProxyPushSupplier.get_filter(filter_id);
eventChannelStruct.structuredProxyPushSupplier.remove_filter(filter_id); // depends on control dependency: [try], data = [none]
filter.destroy(); // depends on control dependency: [try], data = [none]
} catch (FilterNotFound e) {
// do nothing
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
protected Dataset<Sequence> getDataset(SequenceFeaturizer<Annotation> featurizer) {
Corpus c = Corpus
.builder()
.corpusType(corpusType)
.source(corpus)
.format(corpusFormat)
.build();
AnnotatableType[] required = required();
if (required.length > 0) {
c = c.annotate(required);
}
return c.asSequenceDataSet(new BIOLabelMaker(trainingAnnotation, validTags()), featurizer);
} }
|
public class class_name {
protected Dataset<Sequence> getDataset(SequenceFeaturizer<Annotation> featurizer) {
Corpus c = Corpus
.builder()
.corpusType(corpusType)
.source(corpus)
.format(corpusFormat)
.build();
AnnotatableType[] required = required();
if (required.length > 0) {
c = c.annotate(required); // depends on control dependency: [if], data = [none]
}
return c.asSequenceDataSet(new BIOLabelMaker(trainingAnnotation, validTags()), featurizer);
} }
|
public class class_name {
static String makeMessage(ImmutableList<String> messages, ImmutableList<Fact> facts) {
int longestKeyLength = 0;
boolean seenNewlineInValue = false;
for (Fact fact : facts) {
if (fact.value != null) {
longestKeyLength = max(longestKeyLength, fact.key.length());
// TODO(cpovirk): Look for other kinds of newlines.
seenNewlineInValue |= fact.value.contains("\n");
}
}
StringBuilder builder = new StringBuilder();
for (String message : messages) {
builder.append(message);
builder.append('\n');
}
/*
* *Usually* the first fact is printed at the beginning of a new line. However, when this
* exception is the cause of another exception, that exception will print it starting after
* "Caused by: " on the same line. The other exception sometimes also reuses this message as its
* own message. In both of those scenarios, the first line doesn't start at column 0, so the
* horizontal alignment is thrown off.
*
* There's not much we can do about this, short of always starting with a newline (which would
* leave a blank line at the beginning of the message in the normal case).
*/
for (Fact fact : facts) {
if (fact.value == null) {
builder.append(fact.key);
} else if (seenNewlineInValue) {
builder.append(fact.key);
builder.append(":\n");
builder.append(indent(fact.value));
} else {
builder.append(padEnd(fact.key, longestKeyLength, ' '));
builder.append(": ");
builder.append(fact.value);
}
builder.append('\n');
}
builder.setLength(builder.length() - 1); // remove trailing \n
return builder.toString();
} }
|
public class class_name {
static String makeMessage(ImmutableList<String> messages, ImmutableList<Fact> facts) {
int longestKeyLength = 0;
boolean seenNewlineInValue = false;
for (Fact fact : facts) {
if (fact.value != null) {
longestKeyLength = max(longestKeyLength, fact.key.length()); // depends on control dependency: [if], data = [none]
// TODO(cpovirk): Look for other kinds of newlines.
seenNewlineInValue |= fact.value.contains("\n"); // depends on control dependency: [if], data = [none]
}
}
StringBuilder builder = new StringBuilder();
for (String message : messages) {
builder.append(message); // depends on control dependency: [for], data = [message]
builder.append('\n'); // depends on control dependency: [for], data = [none]
}
/*
* *Usually* the first fact is printed at the beginning of a new line. However, when this
* exception is the cause of another exception, that exception will print it starting after
* "Caused by: " on the same line. The other exception sometimes also reuses this message as its
* own message. In both of those scenarios, the first line doesn't start at column 0, so the
* horizontal alignment is thrown off.
*
* There's not much we can do about this, short of always starting with a newline (which would
* leave a blank line at the beginning of the message in the normal case).
*/
for (Fact fact : facts) {
if (fact.value == null) {
builder.append(fact.key); // depends on control dependency: [if], data = [none]
} else if (seenNewlineInValue) {
builder.append(fact.key); // depends on control dependency: [if], data = [none]
builder.append(":\n"); // depends on control dependency: [if], data = [none]
builder.append(indent(fact.value)); // depends on control dependency: [if], data = [none]
} else {
builder.append(padEnd(fact.key, longestKeyLength, ' ')); // depends on control dependency: [if], data = [none]
builder.append(": "); // depends on control dependency: [if], data = [none]
builder.append(fact.value); // depends on control dependency: [if], data = [none]
}
builder.append('\n'); // depends on control dependency: [for], data = [none]
}
builder.setLength(builder.length() - 1); // remove trailing \n
return builder.toString();
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public void run(IAction action) {
assert(selectedItems != null);
for (Iterator it = selectedItems.iterator(); it.hasNext();) {
Object oneItem = it.next();
if (oneItem instanceof IFile) {
processUpdate((IFile)oneItem);
}
}
PlatformUtils.updateDecoration();
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public void run(IAction action) {
assert(selectedItems != null);
for (Iterator it = selectedItems.iterator(); it.hasNext();) {
Object oneItem = it.next();
if (oneItem instanceof IFile) {
processUpdate((IFile)oneItem); // depends on control dependency: [if], data = [none]
}
}
PlatformUtils.updateDecoration();
} }
|
public class class_name {
final void cleanStack() {
for (Completion p = null, q = stack; q != null;) {
Completion s = q.next;
if (q.isLive()) {
p = q;
q = s;
}
else if (p == null) {
casStack(q, s);
q = stack;
}
else {
p.next = s;
if (p.isLive())
q = s;
else {
p = null; // restart
q = stack;
}
}
}
} }
|
public class class_name {
final void cleanStack() {
for (Completion p = null, q = stack; q != null;) {
Completion s = q.next;
if (q.isLive()) {
p = q; // depends on control dependency: [if], data = [none]
q = s; // depends on control dependency: [if], data = [none]
}
else if (p == null) {
casStack(q, s); // depends on control dependency: [if], data = [none]
q = stack; // depends on control dependency: [if], data = [none]
}
else {
p.next = s; // depends on control dependency: [if], data = [none]
if (p.isLive())
q = s;
else {
p = null; // restart // depends on control dependency: [if], data = [none]
q = stack; // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
protected ConsumerSession createCoreConsumer(SICoreConnection _coreConn, ConsumerProperties _props) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createCoreConsumer", new Object[]{_coreConn, _props});
if (DEVT_DEBUG) System.out.println("Overidden create!");
ConsumerSession dcs = null;
// Determine the correct subscription name to use (concatenation
// of clientID and subName.
String clientID = _props.getClientID();
String subName = _props.getSubName();
String durableSubHome = _props.getDurableSubscriptionHome();
String coreSubscriptionName = JmsInternalsFactory.getSharedUtils().getCoreDurableSubName(clientID, subName);
if (DEVT_DEBUG) System.out.println("SUBSCRIBE: "+coreSubscriptionName);
if (DEVT_DEBUG) System.out.println(_props.debug());
// Retrieve the destination object for repeated use.
JmsDestinationImpl cccDest = (JmsDestinationImpl)_props.getJmsDestination();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Trace out all the parameters to the create call.
SibTr.debug(this, tc, "subscriptionName: "+coreSubscriptionName+", destName: "+cccDest.getDestName()+", discrim: "+cccDest.getDestDiscrim()+", selector: "+_props.getSelector());
SibTr.debug(this, tc, "readAhead: "+_props.readAhead()+", supportsMultiple: "+_props.supportsMultipleConsumers()+", noLocal: "+_props.noLocal()+", durableSubHome: "+_props.getDurableSubscriptionHome());
// Check the values for supportsMultiple and readAhead to
// see if they conflict. This may happen if the user has explicitly
// set readAhead ON, then cloned their application server. This might
// result in all the messages being streamed to a single consumer
// rather than being shared equally across them. (192474).
// The concerning situations are where both supportsMultiple and
// readAhead are set to the same thing. By using XOR (^) and
// comparing for false we can see if they are set to the same thing.
if (!(_props.supportsMultipleConsumers() ^ _props.readAhead())) {
// They are both set to the same thing.
if (_props.supportsMultipleConsumers()) {
// They are both set to true. This means all the messages might
// be streamed to a single consumer.
SibTr.debug(this, tc, "WARNING: shareDurableSubs and readAhead are both ON."
+ " This could lead to all messages being streamed to a single consumer, which is inefficient.");
}
else {
// They are both set to false. This means that we are not
// streaming messages to the consumer, even though we are
// guaranteed that there is only one. This might not give
// optimum performance.
SibTr.debug(this, tc, "WARNING: shareDurableSubs and readAhead are both OFF."
+ " This prevents the readAhead optimisation from taking place to pass messages pre-emptively to the single consumer."
+ " Performance would be improved if readAhead was DEFAULT or ON");
}
}
} // end of stuff only done if Trace enabled
/*
* We are about to attempt to create or attach the durable subscription.
*
* If the parameters we pass in do not match the ones that were used to
* create the subscription then we will need to alter the subscription,
* which is done by delete and re-create.
*
* For an alter request we have the following behaviour;
* createDurableSubscription throws SIDestinationAlreadyExistsException
* deleteDurableSubscription
* createDurableSubscription
*
* The following do-while loop handles the retry of the create.
*
* d245910 - The original code would throw an exception to the application
* if a create/connect sequence failed. This has been changed to retry.
*
*/
byte create_state = NOT_TRIED;
// Need to create a destination address object for this subscriber call.
SIDestinationAddress sida = cccDest.getConsumerSIDestinationAddress();
// Need to create a selection criteria object for this subscriber call.
SelectionCriteria selectionCriteria = null;
try {
selectionCriteria = selectionCriteriaFactory.createSelectionCriteria(cccDest.getDestDiscrim(), // discriminator (topic)
_props.getSelector(), // selector string
SelectorDomain.JMS // selector domain
);
}
catch(SIErrorException sice) {
// No FFDC code needed
// SIErrorException is described as a "should never happen" indicator.
// No further detail is given in the javadoc for createSelectionCriteria,
// so ExceptionReceived seems appropriate for this case.
// d238447 FFDC Review. Generate FFDC for this case.
throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0221",
new Object[] {sice, "JmsDurableSubscriberImpl.createCoreConsumer (#10)"},
sice,
"JmsDurableSubscriberImpl.createCoreConsumer#10",
this,
tc
);
}
// This do-while loop handles the retry.
do {
try {
// This block is used if we are going round the loop for a second time
// to do the subscription altering.
if (create_state == REQUEST_ALTER) {
// We have been through the loop once already, and the create call
// failed due to a DestAlreadyExists exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Try to delete subscription: "+coreSubscriptionName);
// Delete the subscription
_coreConn.deleteDurableSubscription(coreSubscriptionName, durableSubHome);
// Now we need to create it again.
create_state = TRY_CREATE;
}
// This block is used when going round the loop for a second time
// to do the durable sub create.
if (create_state == TRY_CREATE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Try to create subscription: "+coreSubscriptionName);
_coreConn.createDurableSubscription(coreSubscriptionName,
durableSubHome,
sida,
selectionCriteria,
_props.supportsMultipleConsumers(),
_props.noLocal(),
null // alternateUserID
);
}
// Attempt to connect to the durable subscription. Note that this
// is separate to the act of creation.
dcs = _coreConn.createConsumerSessionForDurableSubscription(coreSubscriptionName,
durableSubHome,
sida,
selectionCriteria,
_props.supportsMultipleConsumers(),
_props.noLocal(),
null,
_props.readAhead(),
Reliability.NONE,
false, // bifurcatable
null // alternateUserID
);
// The operation succeeded as we expected.
create_state = COMPLETE;
}
catch (SIDurableSubscriptionMismatchException daee) {
// No FFDC code needed
// Name of this durable subscription clashes with an existing destination.
// (ie we just attempted to alter the subscription)
if (create_state != REQUEST_ALTER) {
// This is the first time we have seen this exception type.
// It most likely means that we need to alter the subscription.
create_state = REQUEST_ALTER;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Exception received from createDurableSubscription: ", daee);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Now try to alter the subscription");
}
else {
// d222942 review
// I don't think we can ever get to this code block (create_state == REQUEST_ALTER)
// since create_state is changed from REQUEST_ALTER to TRY_CREATE after the call to
// deleteSubscription, which has to have succeeded before a call to
// createConsumerSessionForDurableSubscription would be attempted.
// d245910 Matt and JBK agree we can't get here with current code, but rather than
// delete the block, we'll leave it here but with a stronger debug message. This
// should protect us against future code changes that might bring this case into play.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "SHOULDN'T HAVE GOT HERE, PLEASE REPORT/INVESTIGATE");
// NB. Must throw exception here to avoid infinite looping!
// d238447 FFDC Review. Generate FFDC for this case.
throw (JMSException) JmsErrorUtils.newThrowable(InvalidDestinationException.class,
"EXCEPTION_RECEIVED_CWSIA0221",
new Object[] {daee, "JmsDurableSubscriberImpl.createCoreConsumer (#1)"},
daee,
"JmsDurableSubscriberImpl.createCoreConsumer#1",
this,
tc
);
}
}
catch(SIConnectionUnavailableException oce) {
// No FFDC code needed
// Method invoked on a closed connection
// d222942 review
// Looks like this could happen as part of 'normal' operation if
// the connection was closed from one thread whilst another was
// calling createDurableSubscriber.
// New message for connection closed during method.
// NB. Must throw exception here to avoid infinite looping!
// d238447 FFDC review. Since this can happen during normal operation, we shouldn't generate an FFDC.
throw (JMSException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
"CONN_CLOSED_CWSIA0222",
null,
oce,
null, // null probeId = no FFDC.
this,
tc
);
}
catch(SIDestinationLockedException dle) {
// No FFDC code needed
// Destination is not accepting consumers - probably means that there is
// already an active subscriber for this durable subscription
// NB. Must throw exception here to avoid infinite looping!
// d238447 FFDC review. App error, not internal, so no FFDC.
throw (JMSException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
"DEST_LOCKED_CWSIA0223",
null,
dle,
null, // null probeId = no FFDC.
this,
tc
);
}
catch(SIDurableSubscriptionNotFoundException dnfe) {
// No FFDC code needed
// The destination cannot be found (no durable subscription).
// At this point we try to create it.
if (create_state != TRY_CREATE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The durable subscription could not be found - create it");
create_state = TRY_CREATE;
}
else {
// d222942 review
// To get here implies that createDurableSubscription succeeded, and then
// createConsumerSessionForDurableSubscription failed with a notFoundException.
// d245910: This can happen when other threads are also calling unsubscribe, as in the testcase
// written for d245910. ThreadA does the create, then gets switched out, ThreadB does an
// unsubscribe, ThreadA switches back in and finds the subscription gone, so ends up here.
// Using the same logic as for SIDurableSubscriptionAlreadyExistsException, it makes
// sense to reset to NOT_TRIED and start over again.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The durable subscription was not found after create. Resetting to NOT_TRIED");
create_state = NOT_TRIED;
}
}
catch(SINotAuthorizedException nae) {
// No FFDC code needed
// Not Authorized
// d238447 FFDC Review. Not an internal error, no FFDC required.
// NB. Must throw exception here to avoid infinite looping!
throw (JMSException) JmsErrorUtils.newThrowable(JMSSecurityException.class,
"NOT_AUTH_CWSIA0224",
null,
nae,
null, // null probeId = no FFDC
this,
tc
);
}
catch(SISelectorSyntaxException nae) {
// No FFDC code needed
// Invalid selector
// d238447 FFDC Review. Not an internal error, no FFDC required.
// NB. Must throw exception here to avoid infinite looping!
throw (JMSException) JmsErrorUtils.newThrowable(InvalidSelectorException.class,
"BAD_SELECT_CWSIA0225",
null,
nae,
null,
this,
tc
);
}
catch (SIDurableSubscriptionAlreadyExistsException saee) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
SibTr.debug(this, tc, "Subscription already exists - this may be a timing issue with multiple clients,"
+" since the first time we tried to connect to it, it didn't exist!"
+" Resetting create_state to NOT_TRIED");
}
// d222942 review
// Not sure I like the logic here - we are effectively throwing an exception
// at the application that is the result of our implementation issues. Better
// would be to reset this client to the beginning of the connect/create/alter
// cycle, with the probable outcome that the app' will get a 'subscription in use'
// exception which is more palatable. There exists the possibility that this client
// will connect to a new subscription created by a different client, but only if
// both subscriptions are identical, in which case it doesn't matter which
// client created it.
// Code used to be.............
// NB. Must throw exception here to avoid infinite looping!
// throw (JMSException) JmsErrorUtils.newThrowable(
// InvalidSelectorException.class,
// "EXCEPTION_RECEIVED_CWSIA0221",
// new Object[] {saee, "JmsDurableSubscriberImpl.createCoreConsumer (#8)"},
// saee,
// "JmsDurableSubscriberImpl.createCoreConsumer#8",
// this,
// tc
// );
// d245910 As discussed above, reset to not-tried and go around again.
create_state = NOT_TRIED;
}
catch (SINotPossibleInCurrentConfigurationException npcc) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The topicSpace is non-permanent or does not exist.");
// d238447 FFDC Review. Not an internal error, no FFDC required.
// NB. Must throw exception here to avoid infinite looping!
throw (JMSException) JmsErrorUtils.newThrowable(InvalidDestinationException.class,
"BAD_TOPICSPACE_CWSIA0226",
null,
npcc,
null, // null probeId = no FFDC
this,
tc
);
}
catch (SIException sice) {
// No FFDC code needed
// Misc other exception (Store, Comms, Core).
// d238447 FFDC review. FFDC generation seems reasonable for this case.
// NB. Must throw exception here to avoid infinite looping!
throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0221",
new Object[] {sice, "JmsDurableSubscriberImpl.createCoreConsumer (#9)"},
sice,
"JmsDurableSubscriberImpl.createCoreConsumer#9",
this,
tc
);
}
// If the first createDurableSubscription call failed, then at this
// point create_state will be REQUEST_ALTER, and we will loop round
// again. (Presumably it may alse be NOT_TRIED).
// If the operation succeeded for either reason (direct success or
// success after alter) then the state will be COMPLETE.
// Any other outcome will result in an exception being thrown so
// we will not leave this loop in the regular fashion.
} while (create_state != COMPLETE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createCoreConsumer(SICoreConnection, ConsumerProperties)", dcs);
return dcs;
} }
|
public class class_name {
protected ConsumerSession createCoreConsumer(SICoreConnection _coreConn, ConsumerProperties _props) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createCoreConsumer", new Object[]{_coreConn, _props});
if (DEVT_DEBUG) System.out.println("Overidden create!");
ConsumerSession dcs = null;
// Determine the correct subscription name to use (concatenation
// of clientID and subName.
String clientID = _props.getClientID();
String subName = _props.getSubName();
String durableSubHome = _props.getDurableSubscriptionHome();
String coreSubscriptionName = JmsInternalsFactory.getSharedUtils().getCoreDurableSubName(clientID, subName);
if (DEVT_DEBUG) System.out.println("SUBSCRIBE: "+coreSubscriptionName);
if (DEVT_DEBUG) System.out.println(_props.debug());
// Retrieve the destination object for repeated use.
JmsDestinationImpl cccDest = (JmsDestinationImpl)_props.getJmsDestination();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Trace out all the parameters to the create call.
SibTr.debug(this, tc, "subscriptionName: "+coreSubscriptionName+", destName: "+cccDest.getDestName()+", discrim: "+cccDest.getDestDiscrim()+", selector: "+_props.getSelector());
SibTr.debug(this, tc, "readAhead: "+_props.readAhead()+", supportsMultiple: "+_props.supportsMultipleConsumers()+", noLocal: "+_props.noLocal()+", durableSubHome: "+_props.getDurableSubscriptionHome());
// Check the values for supportsMultiple and readAhead to
// see if they conflict. This may happen if the user has explicitly
// set readAhead ON, then cloned their application server. This might
// result in all the messages being streamed to a single consumer
// rather than being shared equally across them. (192474).
// The concerning situations are where both supportsMultiple and
// readAhead are set to the same thing. By using XOR (^) and
// comparing for false we can see if they are set to the same thing.
if (!(_props.supportsMultipleConsumers() ^ _props.readAhead())) {
// They are both set to the same thing.
if (_props.supportsMultipleConsumers()) {
// They are both set to true. This means all the messages might
// be streamed to a single consumer.
SibTr.debug(this, tc, "WARNING: shareDurableSubs and readAhead are both ON."
+ " This could lead to all messages being streamed to a single consumer, which is inefficient."); // depends on control dependency: [if], data = [none]
}
else {
// They are both set to false. This means that we are not
// streaming messages to the consumer, even though we are
// guaranteed that there is only one. This might not give
// optimum performance.
SibTr.debug(this, tc, "WARNING: shareDurableSubs and readAhead are both OFF."
+ " This prevents the readAhead optimisation from taking place to pass messages pre-emptively to the single consumer."
+ " Performance would be improved if readAhead was DEFAULT or ON"); // depends on control dependency: [if], data = [none]
}
}
} // end of stuff only done if Trace enabled
/*
* We are about to attempt to create or attach the durable subscription.
*
* If the parameters we pass in do not match the ones that were used to
* create the subscription then we will need to alter the subscription,
* which is done by delete and re-create.
*
* For an alter request we have the following behaviour;
* createDurableSubscription throws SIDestinationAlreadyExistsException
* deleteDurableSubscription
* createDurableSubscription
*
* The following do-while loop handles the retry of the create.
*
* d245910 - The original code would throw an exception to the application
* if a create/connect sequence failed. This has been changed to retry.
*
*/
byte create_state = NOT_TRIED;
// Need to create a destination address object for this subscriber call.
SIDestinationAddress sida = cccDest.getConsumerSIDestinationAddress();
// Need to create a selection criteria object for this subscriber call.
SelectionCriteria selectionCriteria = null;
try {
selectionCriteria = selectionCriteriaFactory.createSelectionCriteria(cccDest.getDestDiscrim(), // discriminator (topic)
_props.getSelector(), // selector string
SelectorDomain.JMS // selector domain
);
}
catch(SIErrorException sice) {
// No FFDC code needed
// SIErrorException is described as a "should never happen" indicator.
// No further detail is given in the javadoc for createSelectionCriteria,
// so ExceptionReceived seems appropriate for this case.
// d238447 FFDC Review. Generate FFDC for this case.
throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0221",
new Object[] {sice, "JmsDurableSubscriberImpl.createCoreConsumer (#10)"},
sice,
"JmsDurableSubscriberImpl.createCoreConsumer#10",
this,
tc
);
}
// This do-while loop handles the retry.
do {
try {
// This block is used if we are going round the loop for a second time
// to do the subscription altering.
if (create_state == REQUEST_ALTER) {
// We have been through the loop once already, and the create call
// failed due to a DestAlreadyExists exception.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Try to delete subscription: "+coreSubscriptionName);
// Delete the subscription
_coreConn.deleteDurableSubscription(coreSubscriptionName, durableSubHome); // depends on control dependency: [if], data = [none]
// Now we need to create it again.
create_state = TRY_CREATE; // depends on control dependency: [if], data = [none]
}
// This block is used when going round the loop for a second time
// to do the durable sub create.
if (create_state == TRY_CREATE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Try to create subscription: "+coreSubscriptionName);
_coreConn.createDurableSubscription(coreSubscriptionName,
durableSubHome,
sida,
selectionCriteria,
_props.supportsMultipleConsumers(),
_props.noLocal(),
null // alternateUserID
); // depends on control dependency: [if], data = [none]
}
// Attempt to connect to the durable subscription. Note that this
// is separate to the act of creation.
dcs = _coreConn.createConsumerSessionForDurableSubscription(coreSubscriptionName,
durableSubHome,
sida,
selectionCriteria,
_props.supportsMultipleConsumers(),
_props.noLocal(),
null,
_props.readAhead(),
Reliability.NONE,
false, // bifurcatable
null // alternateUserID
); // depends on control dependency: [try], data = [none]
// The operation succeeded as we expected.
create_state = COMPLETE; // depends on control dependency: [try], data = [none]
}
catch (SIDurableSubscriptionMismatchException daee) {
// No FFDC code needed
// Name of this durable subscription clashes with an existing destination.
// (ie we just attempted to alter the subscription)
if (create_state != REQUEST_ALTER) {
// This is the first time we have seen this exception type.
// It most likely means that we need to alter the subscription.
create_state = REQUEST_ALTER; // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Exception received from createDurableSubscription: ", daee);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Now try to alter the subscription");
}
else {
// d222942 review
// I don't think we can ever get to this code block (create_state == REQUEST_ALTER)
// since create_state is changed from REQUEST_ALTER to TRY_CREATE after the call to
// deleteSubscription, which has to have succeeded before a call to
// createConsumerSessionForDurableSubscription would be attempted.
// d245910 Matt and JBK agree we can't get here with current code, but rather than
// delete the block, we'll leave it here but with a stronger debug message. This
// should protect us against future code changes that might bring this case into play.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "SHOULDN'T HAVE GOT HERE, PLEASE REPORT/INVESTIGATE");
// NB. Must throw exception here to avoid infinite looping!
// d238447 FFDC Review. Generate FFDC for this case.
throw (JMSException) JmsErrorUtils.newThrowable(InvalidDestinationException.class,
"EXCEPTION_RECEIVED_CWSIA0221",
new Object[] {daee, "JmsDurableSubscriberImpl.createCoreConsumer (#1)"},
daee,
"JmsDurableSubscriberImpl.createCoreConsumer#1",
this,
tc
);
}
}
catch(SIConnectionUnavailableException oce) {
// No FFDC code needed
// Method invoked on a closed connection
// d222942 review
// Looks like this could happen as part of 'normal' operation if
// the connection was closed from one thread whilst another was
// calling createDurableSubscriber.
// New message for connection closed during method.
// NB. Must throw exception here to avoid infinite looping!
// d238447 FFDC review. Since this can happen during normal operation, we shouldn't generate an FFDC.
throw (JMSException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
"CONN_CLOSED_CWSIA0222",
null,
oce,
null, // null probeId = no FFDC.
this,
tc
); // depends on control dependency: [if], data = [none]
}
catch(SIDestinationLockedException dle) {
// No FFDC code needed
// Destination is not accepting consumers - probably means that there is
// already an active subscriber for this durable subscription
// NB. Must throw exception here to avoid infinite looping!
// d238447 FFDC review. App error, not internal, so no FFDC.
throw (JMSException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
"DEST_LOCKED_CWSIA0223",
null,
dle,
null, // null probeId = no FFDC.
this,
tc
);
}
catch(SIDurableSubscriptionNotFoundException dnfe) {
// No FFDC code needed
// The destination cannot be found (no durable subscription).
// At this point we try to create it.
if (create_state != TRY_CREATE) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The durable subscription could not be found - create it");
create_state = TRY_CREATE; // depends on control dependency: [if], data = [none]
}
else {
// d222942 review
// To get here implies that createDurableSubscription succeeded, and then
// createConsumerSessionForDurableSubscription failed with a notFoundException.
// d245910: This can happen when other threads are also calling unsubscribe, as in the testcase
// written for d245910. ThreadA does the create, then gets switched out, ThreadB does an
// unsubscribe, ThreadA switches back in and finds the subscription gone, so ends up here.
// Using the same logic as for SIDurableSubscriptionAlreadyExistsException, it makes
// sense to reset to NOT_TRIED and start over again.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The durable subscription was not found after create. Resetting to NOT_TRIED");
create_state = NOT_TRIED; // depends on control dependency: [if], data = [none]
}
}
catch(SINotAuthorizedException nae) {
// No FFDC code needed
// Not Authorized
// d238447 FFDC Review. Not an internal error, no FFDC required.
// NB. Must throw exception here to avoid infinite looping!
throw (JMSException) JmsErrorUtils.newThrowable(JMSSecurityException.class,
"NOT_AUTH_CWSIA0224",
null,
nae,
null, // null probeId = no FFDC
this,
tc
);
}
catch(SISelectorSyntaxException nae) {
// No FFDC code needed
// Invalid selector
// d238447 FFDC Review. Not an internal error, no FFDC required.
// NB. Must throw exception here to avoid infinite looping!
throw (JMSException) JmsErrorUtils.newThrowable(InvalidSelectorException.class,
"BAD_SELECT_CWSIA0225",
null,
nae,
null,
this,
tc
);
}
catch (SIDurableSubscriptionAlreadyExistsException saee) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
SibTr.debug(this, tc, "Subscription already exists - this may be a timing issue with multiple clients,"
+" since the first time we tried to connect to it, it didn't exist!"
+" Resetting create_state to NOT_TRIED"); // depends on control dependency: [if], data = [none]
}
// d222942 review
// Not sure I like the logic here - we are effectively throwing an exception
// at the application that is the result of our implementation issues. Better
// would be to reset this client to the beginning of the connect/create/alter
// cycle, with the probable outcome that the app' will get a 'subscription in use'
// exception which is more palatable. There exists the possibility that this client
// will connect to a new subscription created by a different client, but only if
// both subscriptions are identical, in which case it doesn't matter which
// client created it.
// Code used to be.............
// NB. Must throw exception here to avoid infinite looping!
// throw (JMSException) JmsErrorUtils.newThrowable(
// InvalidSelectorException.class,
// "EXCEPTION_RECEIVED_CWSIA0221",
// new Object[] {saee, "JmsDurableSubscriberImpl.createCoreConsumer (#8)"},
// saee,
// "JmsDurableSubscriberImpl.createCoreConsumer#8",
// this,
// tc
// );
// d245910 As discussed above, reset to not-tried and go around again.
create_state = NOT_TRIED;
}
catch (SINotPossibleInCurrentConfigurationException npcc) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "The topicSpace is non-permanent or does not exist.");
// d238447 FFDC Review. Not an internal error, no FFDC required.
// NB. Must throw exception here to avoid infinite looping!
throw (JMSException) JmsErrorUtils.newThrowable(InvalidDestinationException.class,
"BAD_TOPICSPACE_CWSIA0226",
null,
npcc,
null, // null probeId = no FFDC
this,
tc
);
}
catch (SIException sice) {
// No FFDC code needed
// Misc other exception (Store, Comms, Core).
// d238447 FFDC review. FFDC generation seems reasonable for this case.
// NB. Must throw exception here to avoid infinite looping!
throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
"EXCEPTION_RECEIVED_CWSIA0221",
new Object[] {sice, "JmsDurableSubscriberImpl.createCoreConsumer (#9)"},
sice,
"JmsDurableSubscriberImpl.createCoreConsumer#9",
this,
tc
);
}
// If the first createDurableSubscription call failed, then at this
// point create_state will be REQUEST_ALTER, and we will loop round
// again. (Presumably it may alse be NOT_TRIED).
// If the operation succeeded for either reason (direct success or
// success after alter) then the state will be COMPLETE.
// Any other outcome will result in an exception being thrown so
// we will not leave this loop in the regular fashion.
} while (create_state != COMPLETE); // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createCoreConsumer(SICoreConnection, ConsumerProperties)", dcs);
return dcs;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.