code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
void writeDocument(OutputStream outStream, Document doc) {
DOMImplementationRegistry domRegistry = null;
try {
domRegistry = DOMImplementationRegistry.newInstance();
// Fortify Mod: Broaden try block to capture all potential exceptions
// } catch (Exception e) {
// LOGR.warning(e.getMessage());
// }
DOMImplementationLS impl = (DOMImplementationLS) domRegistry
.getDOMImplementation("LS");
LSSerializer writer = impl.createLSSerializer();
writer.getDomConfig().setParameter("xml-declaration", false);
writer.getDomConfig().setParameter("format-pretty-print", true);
LSOutput output = impl.createLSOutput();
output.setEncoding("UTF-8");
output.setByteStream(outStream);
writer.write(doc, output);
} catch (Exception e) {
LOGR.warning(e.getMessage());
}
} } | public class class_name {
void writeDocument(OutputStream outStream, Document doc) {
DOMImplementationRegistry domRegistry = null;
try {
domRegistry = DOMImplementationRegistry.newInstance();
// depends on control dependency: [try], data = [none]
// Fortify Mod: Broaden try block to capture all potential exceptions
// } catch (Exception e) {
// LOGR.warning(e.getMessage());
// }
DOMImplementationLS impl = (DOMImplementationLS) domRegistry
.getDOMImplementation("LS");
LSSerializer writer = impl.createLSSerializer();
writer.getDomConfig().setParameter("xml-declaration", false);
// depends on control dependency: [try], data = [none]
writer.getDomConfig().setParameter("format-pretty-print", true);
// depends on control dependency: [try], data = [none]
LSOutput output = impl.createLSOutput();
output.setEncoding("UTF-8");
// depends on control dependency: [try], data = [none]
output.setByteStream(outStream);
// depends on control dependency: [try], data = [none]
writer.write(doc, output);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGR.warning(e.getMessage());
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public com.ibm.websphere.cache.CacheEntry setEntry(CacheEntry cacheEntry, int source,
boolean ignoreCounting, boolean coordinate, boolean incRefcount) {
final String methodName = "setEntry()";
Object id = null;
com.ibm.websphere.cache.CacheEntry newEntry = null;
if (cacheEntry != null) {
id = cacheEntry.getIdObject();
com.ibm.ws.cache.EntryInfo ei = new com.ibm.ws.cache.EntryInfo();
ei.copyMetadata(cacheEntry);
this.coreCache.put(ei, cacheEntry.getValue());
if (incRefcount) {
newEntry = this.coreCache.get(id);
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id);
}
return newEntry;
} } | public class class_name {
@Override
public com.ibm.websphere.cache.CacheEntry setEntry(CacheEntry cacheEntry, int source,
boolean ignoreCounting, boolean coordinate, boolean incRefcount) {
final String methodName = "setEntry()";
Object id = null;
com.ibm.websphere.cache.CacheEntry newEntry = null;
if (cacheEntry != null) {
id = cacheEntry.getIdObject(); // depends on control dependency: [if], data = [none]
com.ibm.ws.cache.EntryInfo ei = new com.ibm.ws.cache.EntryInfo();
ei.copyMetadata(cacheEntry); // depends on control dependency: [if], data = [(cacheEntry]
this.coreCache.put(ei, cacheEntry.getValue()); // depends on control dependency: [if], data = [none]
if (incRefcount) {
newEntry = this.coreCache.get(id); // depends on control dependency: [if], data = [none]
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " id=" + id); // depends on control dependency: [if], data = [none]
}
return newEntry;
} } |
public class class_name {
public static String read(InputStream in) {
InputStreamReader reader;
try {
reader = new InputStreamReader(in, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e.getMessage(), e);
}
return read(reader);
} } | public class class_name {
public static String read(InputStream in) {
InputStreamReader reader;
try {
reader = new InputStreamReader(in, "UTF-8"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
return read(reader);
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void mergeResponsesArrayList(ArrayList<Object> originalList, ArrayList<Object> shardList)
throws IOException {
// get keys from original
HashMap<String, Object> originalKeyList = new HashMap<>();
for (Object item : originalList) {
if (item instanceof NamedList<?>) {
NamedList<Object> itemList = (NamedList<Object>) item;
Object key = itemList.get("key");
if ((key != null) && (key instanceof String)) {
originalKeyList.put((String) key, item);
}
}
}
for (Object item : shardList) {
if (item instanceof NamedList<?>) {
NamedList<Object> itemList = (NamedList<Object>) item;
Object key = itemList.get("key");
// item with key
if ((key != null) && (key instanceof String)) {
// merge
if (originalKeyList.containsKey(key)) {
Object originalItem = originalKeyList.get(key);
if (originalItem.getClass().equals(item.getClass())) {
mergeResponsesNamedList((NamedList<Object>) originalItem, (NamedList<Object>) item);
} else {
// ignore?
}
// add
} else {
Object clonedItem = adjustablePartsCloned(item);
originalList.add(clonedItem);
originalKeyList.put((String) key, clonedItem);
}
} else {
originalList.add(item);
}
} else {
originalList.add(item);
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private void mergeResponsesArrayList(ArrayList<Object> originalList, ArrayList<Object> shardList)
throws IOException {
// get keys from original
HashMap<String, Object> originalKeyList = new HashMap<>();
for (Object item : originalList) {
if (item instanceof NamedList<?>) {
NamedList<Object> itemList = (NamedList<Object>) item;
Object key = itemList.get("key");
if ((key != null) && (key instanceof String)) {
originalKeyList.put((String) key, item); // depends on control dependency: [if], data = [none]
}
}
}
for (Object item : shardList) {
if (item instanceof NamedList<?>) {
NamedList<Object> itemList = (NamedList<Object>) item;
Object key = itemList.get("key");
// item with key
if ((key != null) && (key instanceof String)) {
// merge
if (originalKeyList.containsKey(key)) {
Object originalItem = originalKeyList.get(key);
if (originalItem.getClass().equals(item.getClass())) {
mergeResponsesNamedList((NamedList<Object>) originalItem, (NamedList<Object>) item); // depends on control dependency: [if], data = [none]
} else {
// ignore?
}
// add
} else {
Object clonedItem = adjustablePartsCloned(item);
originalList.add(clonedItem); // depends on control dependency: [if], data = [none]
originalKeyList.put((String) key, clonedItem); // depends on control dependency: [if], data = [none]
}
} else {
originalList.add(item); // depends on control dependency: [if], data = [none]
}
} else {
originalList.add(item); // depends on control dependency: [if], data = [)]
}
}
} } |
public class class_name {
public StructureIdentifier getBaseIdentifier() throws StructureException {
if( base == null ) {
switch(mySource) {
case CATH:
base = CathFactory.getCathDatabase().getDescriptionByCathId(getIdentifier());
break;
case ECOD:
try {
base = EcodFactory.getEcodDatabase().getDomainsById(name);
} catch (IOException e) {
throw new StructureException("Unable to get ECOD domain "+name,e);
}
break;
case SCOP:
// Fuzzy matching of the domain name to the current default factory
base = guessScopDomain(getIdentifier(),ScopFactory.getSCOP());
if(base == null) {
// Guessing didn't work, so just use the PDBID and Chain from name
// Guess that '_' means 'whole structure'
if (chainName.equals("_")) {
base = new SubstructureIdentifier(pdbId);
} else {
base = new SubstructureIdentifier(pdbId,ResidueRange.parseMultiple(chainName));
}
logger.error("Unable to find {}, so using {}",name,base);
}
break;
case FILE:
try {
String[] prefix = name.split(":", 2);
String filename;
if(prefix.length > 1) {
filename = prefix[1];
} else {
filename = name;
}
filename = FileDownloadUtils.expandUserHome(filename);
base = new URLIdentifier(new File(filename).toURI().toURL());
} catch (MalformedURLException e) {
// Should never happen
throw new StructureException("Unable to get URL for file: "+name,e);
}
break;
case URL:
try {
base = new URLIdentifier(name);
} catch (MalformedURLException e) {
throw new StructureException("Invalid URL: "+name,e);
}
break;
case PDP:
try {
PDPProvider provider = new RemotePDPProvider(false);
base = provider.getPDPDomain(name);
} catch (IOException e) {
throw new StructureException("Unable to fetch PDP domain "+name, e);
}
break;
case BIO:
base = new BioAssemblyIdentifier(name);
break;
case PDB:
base = new SubstructureIdentifier(getIdentifier());
break;
default:
throw new IllegalStateException("Unimplemented source: "+mySource);
}
}
return base;
} } | public class class_name {
public StructureIdentifier getBaseIdentifier() throws StructureException {
if( base == null ) {
switch(mySource) {
case CATH:
base = CathFactory.getCathDatabase().getDescriptionByCathId(getIdentifier());
break;
case ECOD:
try {
base = EcodFactory.getEcodDatabase().getDomainsById(name); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new StructureException("Unable to get ECOD domain "+name,e);
} // depends on control dependency: [catch], data = [none]
break;
case SCOP:
// Fuzzy matching of the domain name to the current default factory
base = guessScopDomain(getIdentifier(),ScopFactory.getSCOP());
if(base == null) {
// Guessing didn't work, so just use the PDBID and Chain from name
// Guess that '_' means 'whole structure'
if (chainName.equals("_")) {
base = new SubstructureIdentifier(pdbId); // depends on control dependency: [if], data = [none]
} else {
base = new SubstructureIdentifier(pdbId,ResidueRange.parseMultiple(chainName)); // depends on control dependency: [if], data = [none]
}
logger.error("Unable to find {}, so using {}",name,base); // depends on control dependency: [if], data = [none]
}
break;
case FILE:
try {
String[] prefix = name.split(":", 2);
String filename;
if(prefix.length > 1) {
filename = prefix[1]; // depends on control dependency: [if], data = [none]
} else {
filename = name; // depends on control dependency: [if], data = [none]
}
filename = FileDownloadUtils.expandUserHome(filename); // depends on control dependency: [try], data = [none]
base = new URLIdentifier(new File(filename).toURI().toURL()); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
// Should never happen
throw new StructureException("Unable to get URL for file: "+name,e);
} // depends on control dependency: [catch], data = [none]
break;
case URL:
try {
base = new URLIdentifier(name); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
throw new StructureException("Invalid URL: "+name,e);
} // depends on control dependency: [catch], data = [none]
break;
case PDP:
try {
PDPProvider provider = new RemotePDPProvider(false);
base = provider.getPDPDomain(name); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new StructureException("Unable to fetch PDP domain "+name, e);
} // depends on control dependency: [catch], data = [none]
break;
case BIO:
base = new BioAssemblyIdentifier(name);
break;
case PDB:
base = new SubstructureIdentifier(getIdentifier());
break;
default:
throw new IllegalStateException("Unimplemented source: "+mySource);
}
}
return base;
} } |
public class class_name {
public static boolean keyMatch2(String key1, String key2) {
key2 = key2.replace("/*", "/.*");
Pattern p = Pattern.compile("(.*):[^/]+(.*)");
while (true) {
if (!key2.contains("/:")) {
break;
}
key2 = "^" + p.matcher(key2).replaceAll("$1[^/]+$2") + "$";
}
return regexMatch(key1, key2);
} } | public class class_name {
public static boolean keyMatch2(String key1, String key2) {
key2 = key2.replace("/*", "/.*");
Pattern p = Pattern.compile("(.*):[^/]+(.*)");
while (true) {
if (!key2.contains("/:")) {
break;
}
key2 = "^" + p.matcher(key2).replaceAll("$1[^/]+$2") + "$"; // depends on control dependency: [while], data = [none]
}
return regexMatch(key1, key2);
} } |
public class class_name {
public void process( int c_x , int c_y , TupleDesc_B feature ) {
if( BoofMiscOps.checkInside(image,c_x, c_y, definition.radius) ) {
processInside(c_x,c_y,feature);
} else {
processBorder(c_x,c_y,feature);
}
} } | public class class_name {
public void process( int c_x , int c_y , TupleDesc_B feature ) {
if( BoofMiscOps.checkInside(image,c_x, c_y, definition.radius) ) {
processInside(c_x,c_y,feature); // depends on control dependency: [if], data = [none]
} else {
processBorder(c_x,c_y,feature); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
Object getEnvEntryType(EnvEntry envEntry)
throws InjectionConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
Object type = null;
String typeName = envEntry.getTypeName();
if (typeName != null)
{
for (Class<?> typeClass : ENV_ENTRY_TYPES)
{
if (typeName.equals(typeClass.getName()))
{
type = typeClass;
break;
}
}
if (type == null)
{
if (ivNameSpaceConfig.getClassLoader() == null)
{
// F743-32443 - We don't have a class loader, so we can't
// validate the type. Store it as a string for now;
// EnvEntryEnumSerializable will validate it later when used.
type = typeName;
}
else
{
Class<?> classType = loadClass(typeName);
if (classType == null || !classType.isEnum())
{
Tr.error(tc, "INVALID_ENV_ENTRY_TYPE_CWNEN0064E",
envEntry.getName(), ivModule, ivApplication, typeName);
throw new InjectionConfigurationException("A type, which is not valid, has been specified for the " +
envEntry.getName() + " simple environment entry in the " +
ivModule + " module of the " + ivApplication +
" application: '" + typeName + "'.");
}
type = classType;
}
}
}
// d654504
else
{
// Default to type of Object, to avoid later NPE when checking to
// see if the specified injection type is compatible with the
// variable we are injecting into.
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "EnvEntry XML type is not set.");
}
}
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "env-entry-type = " +
((type == null) ? "null" : type.getClass().getName()));
return type;
} } | public class class_name {
Object getEnvEntryType(EnvEntry envEntry)
throws InjectionConfigurationException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
Object type = null;
String typeName = envEntry.getTypeName();
if (typeName != null)
{
for (Class<?> typeClass : ENV_ENTRY_TYPES)
{
if (typeName.equals(typeClass.getName()))
{
type = typeClass; // depends on control dependency: [if], data = [none]
break;
}
}
if (type == null)
{
if (ivNameSpaceConfig.getClassLoader() == null)
{
// F743-32443 - We don't have a class loader, so we can't
// validate the type. Store it as a string for now;
// EnvEntryEnumSerializable will validate it later when used.
type = typeName; // depends on control dependency: [if], data = [none]
}
else
{
Class<?> classType = loadClass(typeName);
if (classType == null || !classType.isEnum())
{
Tr.error(tc, "INVALID_ENV_ENTRY_TYPE_CWNEN0064E",
envEntry.getName(), ivModule, ivApplication, typeName); // depends on control dependency: [if], data = [none]
throw new InjectionConfigurationException("A type, which is not valid, has been specified for the " +
envEntry.getName() + " simple environment entry in the " +
ivModule + " module of the " + ivApplication +
" application: '" + typeName + "'.");
}
type = classType; // depends on control dependency: [if], data = [none]
}
}
}
// d654504
else
{
// Default to type of Object, to avoid later NPE when checking to
// see if the specified injection type is compatible with the
// variable we are injecting into.
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "EnvEntry XML type is not set.");
}
}
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "env-entry-type = " +
((type == null) ? "null" : type.getClass().getName()));
return type;
} } |
public class class_name {
public void marshall(EndpointSummary endpointSummary, ProtocolMarshaller protocolMarshaller) {
if (endpointSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(endpointSummary.getEndpointName(), ENDPOINTNAME_BINDING);
protocolMarshaller.marshall(endpointSummary.getEndpointArn(), ENDPOINTARN_BINDING);
protocolMarshaller.marshall(endpointSummary.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(endpointSummary.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING);
protocolMarshaller.marshall(endpointSummary.getEndpointStatus(), ENDPOINTSTATUS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(EndpointSummary endpointSummary, ProtocolMarshaller protocolMarshaller) {
if (endpointSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(endpointSummary.getEndpointName(), ENDPOINTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(endpointSummary.getEndpointArn(), ENDPOINTARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(endpointSummary.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(endpointSummary.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(endpointSummary.getEndpointStatus(), ENDPOINTSTATUS_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 MtasSpanQuery getQuery() throws ParseException {
MtasSpanQuery q = null;
// match any word (try to avoid...)
if (wordCondition.isEmpty()) {
q = new MtasSpanMatchAllQuery(wordCondition.field());
// only positive queries
} else if (wordCondition.isSimplePositive()) {
if (wordCondition.isSingle()) {
q = wordCondition.getPositiveQuery(0);
} else {
if (wordCondition.type().equals(MtasCQLParserWordCondition.TYPE_AND)) {
q = new MtasSpanAndQuery(wordCondition.getPositiveQuery().toArray(
new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
} else if (wordCondition.type()
.equals(MtasCQLParserWordCondition.TYPE_OR)) {
q = new MtasSpanOrQuery(wordCondition.getPositiveQuery().toArray(
new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
} else {
throw new ParseException("unknown type " + wordCondition.type());
}
}
// only negative queries
} else if (wordCondition.isSimpleNegative()) {
throw new ParseException("shouldn't be simple negative");
// both positive and negative queries
} else {
if (wordCondition.type().equals(MtasCQLParserWordCondition.TYPE_AND)) {
MtasSpanQuery qPositive;
MtasSpanQuery qNegative;
if (wordCondition.getPositiveQuery().size() == 1) {
qPositive = wordCondition.getPositiveQuery(0);
} else {
qPositive = new MtasSpanAndQuery(
wordCondition.getPositiveQuery().toArray(
new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
}
if (wordCondition.getNegativeQuery().size() == 1) {
qNegative = wordCondition.getNegativeQuery(0);
} else {
qNegative = new MtasSpanOrQuery(
wordCondition.getNegativeQuery().toArray(
new MtasSpanQuery[wordCondition.getNegativeQuery().size()]));
}
q = new MtasSpanNotQuery(qPositive, qNegative);
} else if (wordCondition.type()
.equals(MtasCQLParserWordCondition.TYPE_OR)) {
MtasSpanQuery qPositive;
MtasSpanQuery qNegative;
if (wordCondition.getPositiveQuery().size() == 1) {
qPositive = wordCondition.getPositiveQuery(0);
} else {
qPositive = new MtasSpanOrQuery(
wordCondition.getPositiveQuery().toArray(
new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
}
if (wordCondition.getNegativeQuery().size() == 1) {
qNegative = wordCondition.getNegativeQuery(0);
} else {
qNegative = new MtasSpanAndQuery(
wordCondition.getNegativeQuery().toArray(
new MtasSpanQuery[wordCondition.getNegativeQuery().size()]));
}
q = new MtasSpanNotQuery(qPositive, qNegative);
} else {
throw new ParseException("unknown type " + wordCondition.type());
}
}
if (not) {
MtasSpanQuery qPositive = new MtasSpanMatchAllQuery(
wordCondition.field());
q = new MtasSpanNotQuery(qPositive, q);
}
return q;
} } | public class class_name {
@Override
public MtasSpanQuery getQuery() throws ParseException {
MtasSpanQuery q = null;
// match any word (try to avoid...)
if (wordCondition.isEmpty()) {
q = new MtasSpanMatchAllQuery(wordCondition.field());
// only positive queries
} else if (wordCondition.isSimplePositive()) {
if (wordCondition.isSingle()) {
q = wordCondition.getPositiveQuery(0); // depends on control dependency: [if], data = [none]
} else {
if (wordCondition.type().equals(MtasCQLParserWordCondition.TYPE_AND)) {
q = new MtasSpanAndQuery(wordCondition.getPositiveQuery().toArray(
new MtasSpanQuery[wordCondition.getPositiveQuery().size()])); // depends on control dependency: [if], data = [none]
} else if (wordCondition.type()
.equals(MtasCQLParserWordCondition.TYPE_OR)) {
q = new MtasSpanOrQuery(wordCondition.getPositiveQuery().toArray(
new MtasSpanQuery[wordCondition.getPositiveQuery().size()])); // depends on control dependency: [if], data = [none]
} else {
throw new ParseException("unknown type " + wordCondition.type());
}
}
// only negative queries
} else if (wordCondition.isSimpleNegative()) {
throw new ParseException("shouldn't be simple negative");
// both positive and negative queries
} else {
if (wordCondition.type().equals(MtasCQLParserWordCondition.TYPE_AND)) {
MtasSpanQuery qPositive;
MtasSpanQuery qNegative;
if (wordCondition.getPositiveQuery().size() == 1) {
qPositive = wordCondition.getPositiveQuery(0);
} else {
qPositive = new MtasSpanAndQuery(
wordCondition.getPositiveQuery().toArray(
new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
}
if (wordCondition.getNegativeQuery().size() == 1) {
qNegative = wordCondition.getNegativeQuery(0);
} else {
qNegative = new MtasSpanOrQuery(
wordCondition.getNegativeQuery().toArray(
new MtasSpanQuery[wordCondition.getNegativeQuery().size()]));
}
q = new MtasSpanNotQuery(qPositive, qNegative);
} else if (wordCondition.type()
.equals(MtasCQLParserWordCondition.TYPE_OR)) {
MtasSpanQuery qPositive;
MtasSpanQuery qNegative;
if (wordCondition.getPositiveQuery().size() == 1) {
qPositive = wordCondition.getPositiveQuery(0);
} else {
qPositive = new MtasSpanOrQuery(
wordCondition.getPositiveQuery().toArray(
new MtasSpanQuery[wordCondition.getPositiveQuery().size()]));
}
if (wordCondition.getNegativeQuery().size() == 1) {
qNegative = wordCondition.getNegativeQuery(0);
} else {
qNegative = new MtasSpanAndQuery(
wordCondition.getNegativeQuery().toArray(
new MtasSpanQuery[wordCondition.getNegativeQuery().size()]));
}
q = new MtasSpanNotQuery(qPositive, qNegative);
} else {
throw new ParseException("unknown type " + wordCondition.type());
}
}
if (not) {
MtasSpanQuery qPositive = new MtasSpanMatchAllQuery(
wordCondition.field());
q = new MtasSpanNotQuery(qPositive, q);
}
return q;
} } |
public class class_name {
@Override
public String paramsAsHidden() {
StringBuffer result = new StringBuffer(512);
String activeTab = getTabParameterOrder().get(getActiveTab() - 1);
Map<String, Object> params = paramValues();
Iterator<Entry<String, Object>> i = params.entrySet().iterator();
while (i.hasNext()) {
Entry<String, Object> entry = i.next();
String param = entry.getKey();
if (!param.startsWith(activeTab)) {
// add only parameters which are not displayed in currently active tab
result.append("<input type=\"hidden\" name=\"");
result.append(param);
result.append("\" value=\"");
result.append(
CmsEncoder.encode(entry.getValue().toString(), getCms().getRequestContext().getEncoding()));
result.append("\">\n");
}
}
return result.toString();
} } | public class class_name {
@Override
public String paramsAsHidden() {
StringBuffer result = new StringBuffer(512);
String activeTab = getTabParameterOrder().get(getActiveTab() - 1);
Map<String, Object> params = paramValues();
Iterator<Entry<String, Object>> i = params.entrySet().iterator();
while (i.hasNext()) {
Entry<String, Object> entry = i.next();
String param = entry.getKey();
if (!param.startsWith(activeTab)) {
// add only parameters which are not displayed in currently active tab
result.append("<input type=\"hidden\" name=\""); // depends on control dependency: [if], data = [none]
result.append(param); // depends on control dependency: [if], data = [none]
result.append("\" value=\""); // depends on control dependency: [if], data = [none]
result.append(
CmsEncoder.encode(entry.getValue().toString(), getCms().getRequestContext().getEncoding())); // depends on control dependency: [if], data = [none]
result.append("\">\n"); // depends on control dependency: [if], data = [none]
}
}
return result.toString();
} } |
public class class_name {
public NumberExpression<T> abs() {
if (abs == null) {
abs = Expressions.numberOperation(getType(), MathOps.ABS, mixin);
}
return abs;
} } | public class class_name {
public NumberExpression<T> abs() {
if (abs == null) {
abs = Expressions.numberOperation(getType(), MathOps.ABS, mixin); // depends on control dependency: [if], data = [none]
}
return abs;
} } |
public class class_name {
private boolean isHighestAlert(Alert alert) {
if (alert.getConfidence() == Alert.CONFIDENCE_FALSE_POSITIVE) {
return false;
}
if (highestAlert == null) {
return true;
}
return alert.getRisk() > highestAlert.getRisk();
} } | public class class_name {
private boolean isHighestAlert(Alert alert) {
if (alert.getConfidence() == Alert.CONFIDENCE_FALSE_POSITIVE) {
return false;
// depends on control dependency: [if], data = [none]
}
if (highestAlert == null) {
return true;
// depends on control dependency: [if], data = [none]
}
return alert.getRisk() > highestAlert.getRisk();
} } |
public class class_name {
public static void mkdirs(final File outdir, final String path) {
File d = new File(outdir, path);
if (!d.exists()) {
d.mkdirs();
}
} } | public class class_name {
public static void mkdirs(final File outdir, final String path) {
File d = new File(outdir, path);
if (!d.exists()) {
d.mkdirs();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static List<Point2D_F64> randomNorm( Point2D_F64 mean , DMatrix covariance , int count ,
Random rand ,
@Nullable List<Point2D_F64> output )
{
if( output == null )
output = new ArrayList<>();
// extract values of covariance
double cxx = covariance.get(0,0);
double cxy = covariance.get(0,1);
double cyy = covariance.get(1,1);
// perform cholesky decomposition
double sxx = Math.sqrt(cxx);
double sxy = cxy/cxx;
double syy = Math.sqrt(cyy-sxy*sxy);
for (int i = 0; i < count; i++) {
Point2D_F64 p = new Point2D_F64();
double x = rand.nextGaussian();
double y = rand.nextGaussian();
p.x = mean.x + sxx*x + sxy*y;
p.y = mean.y + sxy*x + syy*y;
output.add(p);
}
return output;
} } | public class class_name {
public static List<Point2D_F64> randomNorm( Point2D_F64 mean , DMatrix covariance , int count ,
Random rand ,
@Nullable List<Point2D_F64> output )
{
if( output == null )
output = new ArrayList<>();
// extract values of covariance
double cxx = covariance.get(0,0);
double cxy = covariance.get(0,1);
double cyy = covariance.get(1,1);
// perform cholesky decomposition
double sxx = Math.sqrt(cxx);
double sxy = cxy/cxx;
double syy = Math.sqrt(cyy-sxy*sxy);
for (int i = 0; i < count; i++) {
Point2D_F64 p = new Point2D_F64();
double x = rand.nextGaussian();
double y = rand.nextGaussian();
p.x = mean.x + sxx*x + sxy*y; // depends on control dependency: [for], data = [none]
p.y = mean.y + sxy*x + syy*y; // depends on control dependency: [for], data = [none]
output.add(p); // depends on control dependency: [for], data = [none]
}
return output;
} } |
public class class_name {
public File getPropertiesFile() {
final String path = line.getOptionValue(ARGUMENT.PROP);
if (path != null) {
return new File(path);
}
return null;
} } | public class class_name {
public File getPropertiesFile() {
final String path = line.getOptionValue(ARGUMENT.PROP);
if (path != null) {
return new File(path); // depends on control dependency: [if], data = [(path]
}
return null;
} } |
public class class_name {
public static ArrayList<IAtomContainer> projectList(List<List<CDKRMap>> rMapsList, IAtomContainer graph, int key) {
ArrayList<IAtomContainer> graphList = new ArrayList<IAtomContainer>();
for (List<CDKRMap> rMapList : rMapsList) {
IAtomContainer atomContainer = project(rMapList, graph, key);
graphList.add(atomContainer);
}
return graphList;
} } | public class class_name {
public static ArrayList<IAtomContainer> projectList(List<List<CDKRMap>> rMapsList, IAtomContainer graph, int key) {
ArrayList<IAtomContainer> graphList = new ArrayList<IAtomContainer>();
for (List<CDKRMap> rMapList : rMapsList) {
IAtomContainer atomContainer = project(rMapList, graph, key);
graphList.add(atomContainer); // depends on control dependency: [for], data = [none]
}
return graphList;
} } |
public class class_name {
public void add(File dest, File file, int position) {
if (dest.exists() && !dest.isDirectory()) {
String fn = file.getName().toLowerCase();
int opacityType = fn.endsWith(".png") || fn.endsWith("gif") ?
BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB;
Image destImg;
try {
destImg = ImageIO.read(dest);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
int width = destImg.getWidth(null);
int height = destImg.getHeight(null);
final BufferedImage image = new BufferedImage(width, height, opacityType);
Image src;
try {
src = ImageIO.read(file);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
int ww = src.getWidth(null);
int hh = src.getHeight(null);
int WW, HH;
switch (position) {
case 1:
WW = 0;
HH = 0;
break;
case 2:
WW = (width - ww) / 2;
HH = 0;
break;
case 3:
WW = width - ww;
HH = 0;
break;
case 4:
WW = 0;
HH = (height - hh) / 2;
break;
case 5:
WW = (width - ww) / 2;
HH = (height - hh) / 2;
break;
case 6:
WW = width - ww;
HH = (height - hh) / 2;
break;
case 7:
WW = 0;
HH = height - hh;
break;
case 8:
WW = (width - ww) / 2;
HH = height - hh;
break;
default:
WW = width - ww;
HH = height - hh;
}
Graphics g = image.createGraphics();
g.drawImage(src, WW, HH, ww, hh, null);
g.dispose();
}
} } | public class class_name {
public void add(File dest, File file, int position) {
if (dest.exists() && !dest.isDirectory()) {
String fn = file.getName().toLowerCase();
int opacityType = fn.endsWith(".png") || fn.endsWith("gif") ?
BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB;
Image destImg;
try {
destImg = ImageIO.read(dest); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
int width = destImg.getWidth(null);
int height = destImg.getHeight(null);
final BufferedImage image = new BufferedImage(width, height, opacityType);
Image src;
try {
src = ImageIO.read(file); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
int ww = src.getWidth(null);
int hh = src.getHeight(null);
int WW, HH;
switch (position) {
case 1:
WW = 0;
HH = 0;
break;
case 2:
WW = (width - ww) / 2;
HH = 0;
break;
case 3:
WW = width - ww;
HH = 0;
break;
case 4:
WW = 0;
HH = (height - hh) / 2;
break;
case 5:
WW = (width - ww) / 2;
HH = (height - hh) / 2;
break;
case 6:
WW = width - ww;
HH = (height - hh) / 2;
break;
case 7:
WW = 0;
HH = height - hh;
break;
case 8:
WW = (width - ww) / 2;
HH = height - hh;
break;
default:
WW = width - ww;
HH = height - hh;
}
Graphics g = image.createGraphics();
g.drawImage(src, WW, HH, ww, hh, null); // depends on control dependency: [if], data = [none]
g.dispose(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static int fillRows(Row[] rows, TypeDescription schema, VectorizedRowBatch batch, int[] selectedFields) {
int rowsToRead = Math.min((int) batch.count(), rows.length);
List<TypeDescription> fieldTypes = schema.getChildren();
// read each selected field
for (int fieldIdx = 0; fieldIdx < selectedFields.length; fieldIdx++) {
int orcIdx = selectedFields[fieldIdx];
readField(rows, fieldIdx, fieldTypes.get(orcIdx), batch.cols[orcIdx], rowsToRead);
}
return rowsToRead;
} } | public class class_name {
static int fillRows(Row[] rows, TypeDescription schema, VectorizedRowBatch batch, int[] selectedFields) {
int rowsToRead = Math.min((int) batch.count(), rows.length);
List<TypeDescription> fieldTypes = schema.getChildren();
// read each selected field
for (int fieldIdx = 0; fieldIdx < selectedFields.length; fieldIdx++) {
int orcIdx = selectedFields[fieldIdx];
readField(rows, fieldIdx, fieldTypes.get(orcIdx), batch.cols[orcIdx], rowsToRead); // depends on control dependency: [for], data = [fieldIdx]
}
return rowsToRead;
} } |
public class class_name {
private static boolean canSkipEscaping(
ImmutableList<SoyJavaPrintDirective> directives, @Nullable ContentKind kind) {
if (kind == null) {
return false;
}
for (SoyJavaPrintDirective directive : directives) {
if (!(directive instanceof ShortCircuitable)
|| !((ShortCircuitable) directive).isNoopForKind(kind)) {
return false;
}
}
return true;
} } | public class class_name {
private static boolean canSkipEscaping(
ImmutableList<SoyJavaPrintDirective> directives, @Nullable ContentKind kind) {
if (kind == null) {
return false; // depends on control dependency: [if], data = [none]
}
for (SoyJavaPrintDirective directive : directives) {
if (!(directive instanceof ShortCircuitable)
|| !((ShortCircuitable) directive).isNoopForKind(kind)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public CmsToolUserData getUserData(CmsWorkplace wp) {
CmsToolUserData userData = wp.getSettings().getToolUserData();
if (userData == null) {
userData = new CmsToolUserData();
userData.setRootKey(ROOTKEY_DEFAULT);
Iterator<CmsToolRootHandler> it = getToolRoots().iterator();
while (it.hasNext()) {
CmsToolRootHandler root = it.next();
userData.setCurrentToolPath(root.getKey(), TOOLPATH_SEPARATOR);
userData.setBaseTool(root.getKey(), TOOLPATH_SEPARATOR);
}
wp.getSettings().setToolUserData(userData);
}
return userData;
} } | public class class_name {
public CmsToolUserData getUserData(CmsWorkplace wp) {
CmsToolUserData userData = wp.getSettings().getToolUserData();
if (userData == null) {
userData = new CmsToolUserData(); // depends on control dependency: [if], data = [none]
userData.setRootKey(ROOTKEY_DEFAULT); // depends on control dependency: [if], data = [none]
Iterator<CmsToolRootHandler> it = getToolRoots().iterator();
while (it.hasNext()) {
CmsToolRootHandler root = it.next();
userData.setCurrentToolPath(root.getKey(), TOOLPATH_SEPARATOR); // depends on control dependency: [while], data = [none]
userData.setBaseTool(root.getKey(), TOOLPATH_SEPARATOR); // depends on control dependency: [while], data = [none]
}
wp.getSettings().setToolUserData(userData); // depends on control dependency: [if], data = [(userData]
}
return userData;
} } |
public class class_name {
private boolean checkEeTaxNumber(final String ptaxNumber) {
final int checkSum = ptaxNumber.charAt(10) - '0';
int calculatedCheckSum = ((ptaxNumber.charAt(0) - '0') * 1 //
+ (ptaxNumber.charAt(1) - '0') * 2 //
+ (ptaxNumber.charAt(2) - '0') * 3 //
+ (ptaxNumber.charAt(3) - '0') * 4 //
+ (ptaxNumber.charAt(4) - '0') * 5 //
+ (ptaxNumber.charAt(5) - '0') * 6 //
+ (ptaxNumber.charAt(6) - '0') * 7 //
+ (ptaxNumber.charAt(7) - '0') * 8 //
+ (ptaxNumber.charAt(8) - '0') * 9 //
+ (ptaxNumber.charAt(9) - '0') * 1) //
% MODULO_11;
if (calculatedCheckSum == 10) {
calculatedCheckSum = ((ptaxNumber.charAt(0) - '0') * 3 //
+ (ptaxNumber.charAt(1) - '0') * 4 //
+ (ptaxNumber.charAt(2) - '0') * 5 //
+ (ptaxNumber.charAt(3) - '0') * 6 //
+ (ptaxNumber.charAt(4) - '0') * 7 //
+ (ptaxNumber.charAt(5) - '0') * 8 //
+ (ptaxNumber.charAt(6) - '0') * 9 //
+ (ptaxNumber.charAt(7) - '0') * 1 //
+ (ptaxNumber.charAt(8) - '0') * 2 //
+ (ptaxNumber.charAt(9) - '0') * 3) //
% MODULO_11 % 10;
}
return checkSum == calculatedCheckSum;
} } | public class class_name {
private boolean checkEeTaxNumber(final String ptaxNumber) {
final int checkSum = ptaxNumber.charAt(10) - '0';
int calculatedCheckSum = ((ptaxNumber.charAt(0) - '0') * 1 //
+ (ptaxNumber.charAt(1) - '0') * 2 //
+ (ptaxNumber.charAt(2) - '0') * 3 //
+ (ptaxNumber.charAt(3) - '0') * 4 //
+ (ptaxNumber.charAt(4) - '0') * 5 //
+ (ptaxNumber.charAt(5) - '0') * 6 //
+ (ptaxNumber.charAt(6) - '0') * 7 //
+ (ptaxNumber.charAt(7) - '0') * 8 //
+ (ptaxNumber.charAt(8) - '0') * 9 //
+ (ptaxNumber.charAt(9) - '0') * 1) //
% MODULO_11;
if (calculatedCheckSum == 10) {
calculatedCheckSum = ((ptaxNumber.charAt(0) - '0') * 3 //
+ (ptaxNumber.charAt(1) - '0') * 4 //
+ (ptaxNumber.charAt(2) - '0') * 5 //
+ (ptaxNumber.charAt(3) - '0') * 6 //
+ (ptaxNumber.charAt(4) - '0') * 7 //
+ (ptaxNumber.charAt(5) - '0') * 8 //
+ (ptaxNumber.charAt(6) - '0') * 9 //
+ (ptaxNumber.charAt(7) - '0') * 1 //
+ (ptaxNumber.charAt(8) - '0') * 2 //
+ (ptaxNumber.charAt(9) - '0') * 3) //
% MODULO_11 % 10;
// depends on control dependency: [if], data = [none]
}
return checkSum == calculatedCheckSum;
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void processImageLocations(final BuildData buildData) {
final List<Integer> topicIds = buildData.getBuildDatabase().getTopicIds();
for (final Integer topicId : topicIds) {
final ITopicNode topicNode = buildData.getBuildDatabase().getTopicNodesForTopicID(topicId).get(0);
final BaseTopicWrapper<?> topic = topicNode.getTopic();
if (log.isDebugEnabled()) log.debug("\tProcessing SpecTopic " + topicNode.getId() + (topicNode.getRevision() != null ? (", " +
"Revision " + topicNode.getRevision()) : ""));
/*
* Images have to be in the image folder in Publican. Here we loop through all the imagedata elements and fix up any
* reference to an image that is not in the images folder.
*/
final List<Node> images = XMLUtilities.getChildNodes(topicNode.getXMLDocument(), "imagedata", "inlinegraphic");
for (final Node imageNode : images) {
final NamedNodeMap attributes = imageNode.getAttributes();
if (attributes != null) {
final Node fileRefAttribute = attributes.getNamedItem("fileref");
if (fileRefAttribute != null && (fileRefAttribute.getNodeValue() == null || fileRefAttribute.getNodeValue().isEmpty()
)) {
fileRefAttribute.setNodeValue("images/" + BuilderConstants.FAILPENGUIN_PNG_NAME + ".jpg");
buildData.getImageLocations().add(new TopicImageData(topic, fileRefAttribute.getNodeValue()));
} else if (fileRefAttribute != null && fileRefAttribute.getNodeValue() != null) {
final String fileRefValue = fileRefAttribute.getNodeValue();
if (BuilderConstants.IMAGE_FILE_REF_PATTERN.matcher(fileRefValue).matches()) {
if (fileRefValue.startsWith("./images/")) {
fileRefAttribute.setNodeValue(fileRefValue.substring(2));
} else if (!fileRefValue.startsWith("images/")) {
fileRefAttribute.setNodeValue("images/" + fileRefValue);
}
buildData.getImageLocations().add(new TopicImageData(topic, fileRefAttribute.getNodeValue()));
} else if (!BuilderConstants.COMMON_CONTENT_FILE_REF_PATTERN.matcher(fileRefValue).matches()) {
// The file isn't common content or a pressgang image so mark it as a missing image.
fileRefAttribute.setNodeValue("images/" + BuilderConstants.FAILPENGUIN_PNG_NAME + ".jpg");
buildData.getImageLocations().add(new TopicImageData(topic, fileRefAttribute.getNodeValue()));
}
}
}
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private void processImageLocations(final BuildData buildData) {
final List<Integer> topicIds = buildData.getBuildDatabase().getTopicIds();
for (final Integer topicId : topicIds) {
final ITopicNode topicNode = buildData.getBuildDatabase().getTopicNodesForTopicID(topicId).get(0);
final BaseTopicWrapper<?> topic = topicNode.getTopic();
if (log.isDebugEnabled()) log.debug("\tProcessing SpecTopic " + topicNode.getId() + (topicNode.getRevision() != null ? (", " +
"Revision " + topicNode.getRevision()) : ""));
/*
* Images have to be in the image folder in Publican. Here we loop through all the imagedata elements and fix up any
* reference to an image that is not in the images folder.
*/
final List<Node> images = XMLUtilities.getChildNodes(topicNode.getXMLDocument(), "imagedata", "inlinegraphic");
for (final Node imageNode : images) {
final NamedNodeMap attributes = imageNode.getAttributes();
if (attributes != null) {
final Node fileRefAttribute = attributes.getNamedItem("fileref");
if (fileRefAttribute != null && (fileRefAttribute.getNodeValue() == null || fileRefAttribute.getNodeValue().isEmpty()
)) {
fileRefAttribute.setNodeValue("images/" + BuilderConstants.FAILPENGUIN_PNG_NAME + ".jpg"); // depends on control dependency: [if], data = []
buildData.getImageLocations().add(new TopicImageData(topic, fileRefAttribute.getNodeValue())); // depends on control dependency: [if], data = []
} else if (fileRefAttribute != null && fileRefAttribute.getNodeValue() != null) {
final String fileRefValue = fileRefAttribute.getNodeValue();
if (BuilderConstants.IMAGE_FILE_REF_PATTERN.matcher(fileRefValue).matches()) {
if (fileRefValue.startsWith("./images/")) {
fileRefAttribute.setNodeValue(fileRefValue.substring(2)); // depends on control dependency: [if], data = [none]
} else if (!fileRefValue.startsWith("images/")) {
fileRefAttribute.setNodeValue("images/" + fileRefValue); // depends on control dependency: [if], data = [none]
}
buildData.getImageLocations().add(new TopicImageData(topic, fileRefAttribute.getNodeValue())); // depends on control dependency: [if], data = [none]
} else if (!BuilderConstants.COMMON_CONTENT_FILE_REF_PATTERN.matcher(fileRefValue).matches()) {
// The file isn't common content or a pressgang image so mark it as a missing image.
fileRefAttribute.setNodeValue("images/" + BuilderConstants.FAILPENGUIN_PNG_NAME + ".jpg"); // depends on control dependency: [if], data = [none]
buildData.getImageLocations().add(new TopicImageData(topic, fileRefAttribute.getNodeValue())); // depends on control dependency: [if], data = [none]
}
}
}
}
}
} } |
public class class_name {
public List<String> mergeAndGetDictionary()
{
final Set<String> mergedDictionary = new HashSet<>();
mergedDictionary.addAll(keySerde.getDictionary());
for (File dictFile : dictionaryFiles) {
try (
final MappingIterator<String> dictIterator = spillMapper.readValues(
spillMapper.getFactory().createParser(new LZ4BlockInputStream(new FileInputStream(dictFile))),
spillMapper.getTypeFactory().constructType(String.class)
)
) {
while (dictIterator.hasNext()) {
mergedDictionary.add(dictIterator.next());
}
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
return new ArrayList<>(mergedDictionary);
} } | public class class_name {
public List<String> mergeAndGetDictionary()
{
final Set<String> mergedDictionary = new HashSet<>();
mergedDictionary.addAll(keySerde.getDictionary());
for (File dictFile : dictionaryFiles) {
try (
final MappingIterator<String> dictIterator = spillMapper.readValues(
spillMapper.getFactory().createParser(new LZ4BlockInputStream(new FileInputStream(dictFile))),
spillMapper.getTypeFactory().constructType(String.class)
)
) {
while (dictIterator.hasNext()) {
mergedDictionary.add(dictIterator.next()); // depends on control dependency: [while], data = [none]
}
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
return new ArrayList<>(mergedDictionary);
} } |
public class class_name {
TypeInformation<?>[] getQualifierTypes(String family) {
Map<String, TypeInformation<?>> qualifierMap = familyMap.get(family);
if (qualifierMap == null) {
throw new IllegalArgumentException("Family " + family + " does not exist in schema.");
}
TypeInformation<?>[] typeInformation = new TypeInformation[qualifierMap.size()];
int i = 0;
for (TypeInformation<?> typeInfo : qualifierMap.values()) {
typeInformation[i] = typeInfo;
i++;
}
return typeInformation;
} } | public class class_name {
TypeInformation<?>[] getQualifierTypes(String family) {
Map<String, TypeInformation<?>> qualifierMap = familyMap.get(family);
if (qualifierMap == null) {
throw new IllegalArgumentException("Family " + family + " does not exist in schema.");
}
TypeInformation<?>[] typeInformation = new TypeInformation[qualifierMap.size()];
int i = 0;
for (TypeInformation<?> typeInfo : qualifierMap.values()) {
typeInformation[i] = typeInfo; // depends on control dependency: [for], data = [typeInfo]
i++; // depends on control dependency: [for], data = [none]
}
return typeInformation;
} } |
public class class_name {
public void clearFlushStack()
{
if (stackQueue != null && !stackQueue.isEmpty())
{
stackQueue.clear();
}
if (joinTableDataCollection != null && !joinTableDataCollection.isEmpty())
{
joinTableDataCollection.clear();
}
if (eventLogQueue != null)
{
eventLogQueue.clear();
}
} } | public class class_name {
public void clearFlushStack()
{
if (stackQueue != null && !stackQueue.isEmpty())
{
stackQueue.clear(); // depends on control dependency: [if], data = [none]
}
if (joinTableDataCollection != null && !joinTableDataCollection.isEmpty())
{
joinTableDataCollection.clear(); // depends on control dependency: [if], data = [none]
}
if (eventLogQueue != null)
{
eventLogQueue.clear(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static public String
join(String[] array, String sep, int from, int upto)
{
if(sep == null) sep = "";
if(from < 0 || upto > array.length)
throw new IndexOutOfBoundsException();
if(upto <= from)
return "";
StringBuilder result = new StringBuilder();
boolean first = true;
for(int i = from; i < upto; i++, first = false) {
if(!first) result.append(sep);
result.append(array[i]);
}
return result.toString();
} } | public class class_name {
static public String
join(String[] array, String sep, int from, int upto)
{
if(sep == null) sep = "";
if(from < 0 || upto > array.length)
throw new IndexOutOfBoundsException();
if(upto <= from)
return "";
StringBuilder result = new StringBuilder();
boolean first = true;
for(int i = from; i < upto; i++, first = false) {
if(!first) result.append(sep);
result.append(array[i]); // depends on control dependency: [for], data = [i]
}
return result.toString();
} } |
public class class_name {
private String hash(byte[] password, byte[] salt) {
if (salt.length > 0) { // we can salt
byte[] message = new byte[salt.length + password.length];
System.arraycopy(salt, 0, message, 0, salt.length);
System.arraycopy(password, 0, message, salt.length, password.length);
return STR.joinArgs(SEPARATOR, Hex.encode(salt), Hex.encode(md.digest(message)));
}
return Hex.encode(md.digest(password));
} } | public class class_name {
private String hash(byte[] password, byte[] salt) {
if (salt.length > 0) { // we can salt
byte[] message = new byte[salt.length + password.length];
System.arraycopy(salt, 0, message, 0, salt.length); // depends on control dependency: [if], data = [none]
System.arraycopy(password, 0, message, salt.length, password.length); // depends on control dependency: [if], data = [none]
return STR.joinArgs(SEPARATOR, Hex.encode(salt), Hex.encode(md.digest(message))); // depends on control dependency: [if], data = [none]
}
return Hex.encode(md.digest(password));
} } |
public class class_name {
public static String toStringWithRootCause(@Nullable Throwable t) {
if (t == null) {
return StringUtils.EMPTY;
}
final String clsName = ClassUtils.getShortClassName(t, null);
final String message = StringUtils.defaultString(t.getMessage());
Throwable cause = getRootCause(t);
StringBuilder sb = new StringBuilder(128).append(clsName).append(": ").append(message);
if (cause != t) {
sb.append("; <---").append(toStringWithShortName(cause));
}
return sb.toString();
} } | public class class_name {
public static String toStringWithRootCause(@Nullable Throwable t) {
if (t == null) {
return StringUtils.EMPTY; // depends on control dependency: [if], data = [none]
}
final String clsName = ClassUtils.getShortClassName(t, null);
final String message = StringUtils.defaultString(t.getMessage());
Throwable cause = getRootCause(t);
StringBuilder sb = new StringBuilder(128).append(clsName).append(": ").append(message);
if (cause != t) {
sb.append("; <---").append(toStringWithShortName(cause)); // depends on control dependency: [if], data = [(cause]
}
return sb.toString();
} } |
public class class_name {
public void marshall(BatchUpdateObjectAttributesResponse batchUpdateObjectAttributesResponse, ProtocolMarshaller protocolMarshaller) {
if (batchUpdateObjectAttributesResponse == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchUpdateObjectAttributesResponse.getObjectIdentifier(), OBJECTIDENTIFIER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BatchUpdateObjectAttributesResponse batchUpdateObjectAttributesResponse, ProtocolMarshaller protocolMarshaller) {
if (batchUpdateObjectAttributesResponse == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchUpdateObjectAttributesResponse.getObjectIdentifier(), OBJECTIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void execute( EnforcerRuleHelper helper )
throws EnforcerRuleException
{
Object propValue = resolveValue( helper );
// Check that the property is not null or empty string
if ( propValue == null )
{
String message = getMessage();
if ( message == null )
{
message = getName() + " \"" + getPropertyName() + "\" is required for this build.";
}
throw new EnforcerRuleException( message );
}
// If there is a regex, check that the property matches it
if ( regex != null && !propValue.toString().matches( regex ) )
{
if ( regexMessage == null )
{
regexMessage = getName() + " \"" + getPropertyName() + "\" evaluates to \"" + propValue + "\". "
+ "This does not match the regular expression \"" + regex + "\"";
}
throw new EnforcerRuleException( regexMessage );
}
} } | public class class_name {
public void execute( EnforcerRuleHelper helper )
throws EnforcerRuleException
{
Object propValue = resolveValue( helper );
// Check that the property is not null or empty string
if ( propValue == null )
{
String message = getMessage();
if ( message == null )
{
message = getName() + " \"" + getPropertyName() + "\" is required for this build.";
}
throw new EnforcerRuleException( message );
}
// If there is a regex, check that the property matches it
if ( regex != null && !propValue.toString().matches( regex ) )
{
if ( regexMessage == null )
{
regexMessage = getName() + " \"" + getPropertyName() + "\" evaluates to \"" + propValue + "\". "
+ "This does not match the regular expression \"" + regex + "\""; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
throw new EnforcerRuleException( regexMessage );
}
} } |
public class class_name {
@Override
public void sawOpcode(int seen) {
Integer sawALOADReg = null;
try {
stack.precomputation(this);
int pc = getPC();
nullGuards.remove(Integer.valueOf(pc));
clearEndOfLifeRegisters();
switch (seen) {
case Const.IFNULL: {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
int reg = itm.getRegisterNumber();
Integer target = Integer.valueOf(getBranchTarget());
if (reg >= 0) {
int eol = Integer.MAX_VALUE;
LocalVariableTable lvt = getMethod().getLocalVariableTable();
if (lvt != null) {
LocalVariable lv = lvt.getLocalVariable(reg, pc);
if (lv != null) {
eol = pc + lv.getLength();
}
}
nullGuards.put(target, new NullGuard(reg, pc, eol, itm.getSignature()));
} else {
XField xf = itm.getXField();
Integer sourceFieldReg = (Integer) itm.getUserValue();
if ((xf != null) && (sourceFieldReg != null)) {
nullGuards.put(target, new NullGuard(xf, sourceFieldReg.intValue(), pc, itm.getSignature()));
}
}
}
}
break;
case Const.ASTORE:
case Const.ASTORE_0:
case Const.ASTORE_1:
case Const.ASTORE_2:
case Const.ASTORE_3: {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
if (!itm.isNull()) {
NullGuard guard = findNullGuardWithRegister(RegisterUtils.getAStoreReg(this, seen));
if (guard != null) {
bugReporter.reportBug(new BugInstance(this, BugType.SNG_SUSPICIOUS_NULL_LOCAL_GUARD.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addSourceLine(this));
removeNullGuard(guard);
}
}
}
}
break;
case Const.ALOAD:
case Const.ALOAD_0:
case Const.ALOAD_1:
case Const.ALOAD_2:
case Const.ALOAD_3: {
NullGuard guard = findNullGuardWithRegister(RegisterUtils.getALoadReg(this, seen));
if (guard != null) {
removeNullGuard(guard);
}
sawALOADReg = Integer.valueOf(RegisterUtils.getALoadReg(this, seen));
}
break;
case Const.PUTFIELD: {
if (stack.getStackDepth() <= 1) {
break;
}
OpcodeStack.Item itm = stack.getStackItem(0);
if (itm.isNull()) {
break;
}
XField xf = getXFieldOperand();
itm = stack.getStackItem(1);
Integer fieldSourceReg = (Integer) itm.getUserValue();
if ((xf != null) && (fieldSourceReg != null)) {
NullGuard guard = findNullGuardWithField(xf, fieldSourceReg.intValue());
if (guard != null) {
bugReporter.reportBug(new BugInstance(this, BugType.SNG_SUSPICIOUS_NULL_FIELD_GUARD.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addSourceLine(this));
removeNullGuard(guard);
}
}
}
break;
case Const.GETFIELD: {
if (stack.getStackDepth() > 0) {
XField xf = getXFieldOperand();
OpcodeStack.Item itm = stack.getStackItem(0);
Integer fieldSourceReg = (Integer) itm.getUserValue();
if ((xf != null) && (fieldSourceReg != null)) {
NullGuard guard = findNullGuardWithField(xf, fieldSourceReg.intValue());
if (guard != null) {
removeNullGuard(guard);
} else {
sawALOADReg = (Integer) itm.getUserValue();
}
}
}
}
break;
case Const.IFEQ:
case Const.IFNE:
case Const.IFLT:
case Const.IFGE:
case Const.IFGT:
case Const.IFLE:
case Const.IF_ICMPEQ:
case Const.IF_ICMPNE:
case Const.IF_ICMPLT:
case Const.IF_ICMPGE:
case Const.IF_ICMPGT:
case Const.IF_ICMPLE:
case Const.IF_ACMPEQ:
case Const.IF_ACMPNE:
case Const.GOTO:
case Const.GOTO_W:
case Const.IFNONNULL:
nullGuards.clear();
break;
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((sawALOADReg != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(sawALOADReg);
}
}
} } | public class class_name {
@Override
public void sawOpcode(int seen) {
Integer sawALOADReg = null;
try {
stack.precomputation(this);
int pc = getPC();
nullGuards.remove(Integer.valueOf(pc));
clearEndOfLifeRegisters();
switch (seen) {
case Const.IFNULL: {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
int reg = itm.getRegisterNumber();
Integer target = Integer.valueOf(getBranchTarget());
if (reg >= 0) {
int eol = Integer.MAX_VALUE;
LocalVariableTable lvt = getMethod().getLocalVariableTable();
if (lvt != null) {
LocalVariable lv = lvt.getLocalVariable(reg, pc);
if (lv != null) {
eol = pc + lv.getLength(); // depends on control dependency: [if], data = [none]
}
}
nullGuards.put(target, new NullGuard(reg, pc, eol, itm.getSignature())); // depends on control dependency: [if], data = [(reg]
} else {
XField xf = itm.getXField();
Integer sourceFieldReg = (Integer) itm.getUserValue();
if ((xf != null) && (sourceFieldReg != null)) {
nullGuards.put(target, new NullGuard(xf, sourceFieldReg.intValue(), pc, itm.getSignature())); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
case Const.ASTORE:
case Const.ASTORE_0:
case Const.ASTORE_1:
case Const.ASTORE_2:
case Const.ASTORE_3: {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
if (!itm.isNull()) {
NullGuard guard = findNullGuardWithRegister(RegisterUtils.getAStoreReg(this, seen));
if (guard != null) {
bugReporter.reportBug(new BugInstance(this, BugType.SNG_SUSPICIOUS_NULL_LOCAL_GUARD.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addSourceLine(this)); // depends on control dependency: [if], data = [none]
removeNullGuard(guard); // depends on control dependency: [if], data = [(guard]
}
}
}
}
break;
case Const.ALOAD:
case Const.ALOAD_0:
case Const.ALOAD_1:
case Const.ALOAD_2:
case Const.ALOAD_3: {
NullGuard guard = findNullGuardWithRegister(RegisterUtils.getALoadReg(this, seen));
if (guard != null) {
removeNullGuard(guard); // depends on control dependency: [if], data = [(guard]
}
sawALOADReg = Integer.valueOf(RegisterUtils.getALoadReg(this, seen));
}
break;
case Const.PUTFIELD: {
if (stack.getStackDepth() <= 1) {
break;
}
OpcodeStack.Item itm = stack.getStackItem(0);
if (itm.isNull()) {
break;
}
XField xf = getXFieldOperand();
itm = stack.getStackItem(1);
Integer fieldSourceReg = (Integer) itm.getUserValue();
if ((xf != null) && (fieldSourceReg != null)) {
NullGuard guard = findNullGuardWithField(xf, fieldSourceReg.intValue());
if (guard != null) {
bugReporter.reportBug(new BugInstance(this, BugType.SNG_SUSPICIOUS_NULL_FIELD_GUARD.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addSourceLine(this)); // depends on control dependency: [if], data = [none]
removeNullGuard(guard); // depends on control dependency: [if], data = [(guard]
}
}
}
break;
case Const.GETFIELD: {
if (stack.getStackDepth() > 0) {
XField xf = getXFieldOperand();
OpcodeStack.Item itm = stack.getStackItem(0);
Integer fieldSourceReg = (Integer) itm.getUserValue();
if ((xf != null) && (fieldSourceReg != null)) {
NullGuard guard = findNullGuardWithField(xf, fieldSourceReg.intValue());
if (guard != null) {
removeNullGuard(guard); // depends on control dependency: [if], data = [(guard]
} else {
sawALOADReg = (Integer) itm.getUserValue(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
case Const.IFEQ:
case Const.IFNE:
case Const.IFLT:
case Const.IFGE:
case Const.IFGT:
case Const.IFLE:
case Const.IF_ICMPEQ:
case Const.IF_ICMPNE:
case Const.IF_ICMPLT:
case Const.IF_ICMPGE:
case Const.IF_ICMPGT:
case Const.IF_ICMPLE:
case Const.IF_ACMPEQ:
case Const.IF_ACMPNE:
case Const.GOTO:
case Const.GOTO_W:
case Const.IFNONNULL:
nullGuards.clear();
break;
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((sawALOADReg != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(sawALOADReg);
}
}
} } |
public class class_name {
@Override
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
ChronoHistory history;
AncientJulianLeapYears ajly;
byte header = in.readByte();
switch ((header & 0xFF) >> 4) {
case VERSION_1:
history = this.readHistory(in, header);
break;
case VERSION_2:
history = this.readHistory(in, header);
ajly = readTriennalState(in);
if (ajly != null) {
history = history.with(ajly);
}
break;
case VERSION_3:
history = this.readHistory(in, header);
ajly = readTriennalState(in);
if (ajly != null) {
history = history.with(ajly);
}
history = history.with(NewYearStrategy.readFromStream(in));
history = history.with(EraPreference.readFromStream(in));
break;
default:
throw new StreamCorruptedException("Unknown serialized type.");
}
this.obj = history;
} } | public class class_name {
@Override
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
ChronoHistory history;
AncientJulianLeapYears ajly;
byte header = in.readByte();
switch ((header & 0xFF) >> 4) {
case VERSION_1:
history = this.readHistory(in, header);
break;
case VERSION_2:
history = this.readHistory(in, header);
ajly = readTriennalState(in);
if (ajly != null) {
history = history.with(ajly); // depends on control dependency: [if], data = [(ajly]
}
break;
case VERSION_3:
history = this.readHistory(in, header);
ajly = readTriennalState(in);
if (ajly != null) {
history = history.with(ajly); // depends on control dependency: [if], data = [(ajly]
}
history = history.with(NewYearStrategy.readFromStream(in));
history = history.with(EraPreference.readFromStream(in));
break;
default:
throw new StreamCorruptedException("Unknown serialized type.");
}
this.obj = history;
} } |
public class class_name {
private List<String> splitToList(String input)
{
Preconditions.checkNotNull(input);
Iterator<String> iterator = splitter.split(input).iterator();
List<String> result = new ArrayList<String>();
while (iterator.hasNext()) {
result.add(iterator.next());
}
return Collections.unmodifiableList(result);
} } | public class class_name {
private List<String> splitToList(String input)
{
Preconditions.checkNotNull(input);
Iterator<String> iterator = splitter.split(input).iterator();
List<String> result = new ArrayList<String>();
while (iterator.hasNext()) {
result.add(iterator.next()); // depends on control dependency: [while], data = [none]
}
return Collections.unmodifiableList(result);
} } |
public class class_name {
public static byte [] readFile(SOAPMessage msg, Element el){
Element include = XMLFormat.getFirstChildElement(el,"Include","http://www.w3.org/2004/08/xop/include");
byte [] data = null;
if(include!=null){
//LOG.debug("Reading XOP file")
String id = "<"+include.getAttribute("href").substring("cid:".length())+">";
Iterator<AttachmentPart> it = msg.getAttachments();
while(it.hasNext()){
AttachmentPart att = it.next();
if(id.equals(att.getContentId())){
try {
data = att.getRawContentBytes();
} catch (SOAPException e) {
throw S1SystemError.wrap(e);
}
break;
}
}
}else{
String b = el.getTextContent();
try{
data = Base64.decode(b);
} catch (Base64FormatException e) {
throw S1SystemError.wrap(e);
}
}
if(LOG.isDebugEnabled())
LOG.debug("Reading file from SOAP, length: "+(data==null?-1:data.length));
return data;
} } | public class class_name {
public static byte [] readFile(SOAPMessage msg, Element el){
Element include = XMLFormat.getFirstChildElement(el,"Include","http://www.w3.org/2004/08/xop/include");
byte [] data = null;
if(include!=null){
//LOG.debug("Reading XOP file")
String id = "<"+include.getAttribute("href").substring("cid:".length())+">";
Iterator<AttachmentPart> it = msg.getAttachments();
while(it.hasNext()){
AttachmentPart att = it.next();
if(id.equals(att.getContentId())){
try {
data = att.getRawContentBytes(); // depends on control dependency: [try], data = [none]
} catch (SOAPException e) {
throw S1SystemError.wrap(e);
} // depends on control dependency: [catch], data = [none]
break;
}
}
}else{
String b = el.getTextContent();
try{
data = Base64.decode(b); // depends on control dependency: [try], data = [none]
} catch (Base64FormatException e) {
throw S1SystemError.wrap(e);
} // depends on control dependency: [catch], data = [none]
}
if(LOG.isDebugEnabled())
LOG.debug("Reading file from SOAP, length: "+(data==null?-1:data.length));
return data;
} } |
public class class_name {
protected void makeProcessDefinitionsConsistentWithPersistedVersions(ParsedDeployment parsedDeployment) {
for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
ProcessDefinitionEntity persistedProcessDefinition =
bpmnDeploymentHelper.getPersistedInstanceOfProcessDefinition(processDefinition);
if (persistedProcessDefinition != null) {
processDefinition.setId(persistedProcessDefinition.getId());
processDefinition.setVersion(persistedProcessDefinition.getVersion());
processDefinition.setSuspensionState(persistedProcessDefinition.getSuspensionState());
}
}
} } | public class class_name {
protected void makeProcessDefinitionsConsistentWithPersistedVersions(ParsedDeployment parsedDeployment) {
for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
ProcessDefinitionEntity persistedProcessDefinition =
bpmnDeploymentHelper.getPersistedInstanceOfProcessDefinition(processDefinition);
if (persistedProcessDefinition != null) {
processDefinition.setId(persistedProcessDefinition.getId()); // depends on control dependency: [if], data = [(persistedProcessDefinition]
processDefinition.setVersion(persistedProcessDefinition.getVersion()); // depends on control dependency: [if], data = [(persistedProcessDefinition]
processDefinition.setSuspensionState(persistedProcessDefinition.getSuspensionState()); // depends on control dependency: [if], data = [(persistedProcessDefinition]
}
}
} } |
public class class_name {
@SuppressWarnings("deprecation")
@Override public boolean contains(Object o) {
// Only accept classes where we can convert to an integer while preventing
// overflow/underflow. If there were a way to reliably test for overflow/underflow in
// Numbers, we could accept them too, but with the rounding errors of floats and doubles
// that's impractical.
if (o instanceof Integer) {
return contains(((Integer) o).intValue());
} else if (o instanceof Long) {
long l = (Long) o;
return (l <= ((long) Integer.MAX_VALUE)) &&
(l >= ((long) Integer.MIN_VALUE)) &&
contains((int) l);
} else if (o instanceof BigInteger) {
try {
// Throws an exception if it's more than 32 bits.
return contains(((BigInteger) o).intValueExact());
} catch (ArithmeticException ignore) {
return false;
}
} else if (o instanceof String) {
return contains(Integer.valueOf((String) o));
} else {
throw new IllegalArgumentException("Don't know how to convert to a primitive int" +
" without risking accidental truncation. Pass an" +
" Integer, Long, BigInteger, or String that parses" +
" within Integer bounds instead.");
}
} } | public class class_name {
@SuppressWarnings("deprecation")
@Override public boolean contains(Object o) {
// Only accept classes where we can convert to an integer while preventing
// overflow/underflow. If there were a way to reliably test for overflow/underflow in
// Numbers, we could accept them too, but with the rounding errors of floats and doubles
// that's impractical.
if (o instanceof Integer) {
return contains(((Integer) o).intValue()); // depends on control dependency: [if], data = [none]
} else if (o instanceof Long) {
long l = (Long) o;
return (l <= ((long) Integer.MAX_VALUE)) &&
(l >= ((long) Integer.MIN_VALUE)) &&
contains((int) l); // depends on control dependency: [if], data = [none]
} else if (o instanceof BigInteger) {
try {
// Throws an exception if it's more than 32 bits.
return contains(((BigInteger) o).intValueExact()); // depends on control dependency: [try], data = [none]
} catch (ArithmeticException ignore) {
return false;
} // depends on control dependency: [catch], data = [none]
} else if (o instanceof String) {
return contains(Integer.valueOf((String) o)); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Don't know how to convert to a primitive int" +
" without risking accidental truncation. Pass an" +
" Integer, Long, BigInteger, or String that parses" +
" within Integer bounds instead.");
}
} } |
public class class_name {
private SystemProperties loadConfiguration(String propertiesConfig, ServletContext context) throws IllegalStateException{
InputStream inStream = null;
try {
inStream = getStreamForLocation(propertiesConfig, context);
JAXBContext jaxb = JAXBContext.newInstance(SystemProperties.class.getPackage().getName());
return (SystemProperties) jaxb.createUnmarshaller().unmarshal(inStream);
} catch (FileNotFoundException e) {
throw new IllegalStateException("Could not find configuration file: " + propertiesConfig, e);
} catch (JAXBException e) {
throw new IllegalStateException("Error while reading file: " + propertiesConfig, e);
} finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} } | public class class_name {
private SystemProperties loadConfiguration(String propertiesConfig, ServletContext context) throws IllegalStateException{
InputStream inStream = null;
try {
inStream = getStreamForLocation(propertiesConfig, context);
JAXBContext jaxb = JAXBContext.newInstance(SystemProperties.class.getPackage().getName());
return (SystemProperties) jaxb.createUnmarshaller().unmarshal(inStream);
} catch (FileNotFoundException e) {
throw new IllegalStateException("Could not find configuration file: " + propertiesConfig, e);
} catch (JAXBException e) {
throw new IllegalStateException("Error while reading file: " + propertiesConfig, e);
} finally {
if (inStream != null) {
try {
inStream.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public void setEditorTarget (PropertyEditorTarget target)
{
if (target instanceof DBMetaCatalogNode)
{
super.setEditorTarget(target);
this.tfCatalogName.setText((String)target.getAttribute(DBMetaCatalogNode.ATT_CATALOG_NAME));
}
else
{
throw new UnsupportedOperationException("This editor can only edit DBMetaCatalogNode objects");
}
} } | public class class_name {
public void setEditorTarget (PropertyEditorTarget target)
{
if (target instanceof DBMetaCatalogNode)
{
super.setEditorTarget(target);
// depends on control dependency: [if], data = [none]
this.tfCatalogName.setText((String)target.getAttribute(DBMetaCatalogNode.ATT_CATALOG_NAME));
// depends on control dependency: [if], data = [none]
}
else
{
throw new UnsupportedOperationException("This editor can only edit DBMetaCatalogNode objects");
}
} } |
public class class_name {
private void removePoint(Point point, Collidable collidable, Map<Point, Set<Collidable>> elements, Integer group)
{
final Set<Collidable> points = elements.get(point);
points.remove(collidable);
if (points.isEmpty())
{
elements.remove(point);
}
if (elements.isEmpty())
{
collidables.remove(group);
}
} } | public class class_name {
private void removePoint(Point point, Collidable collidable, Map<Point, Set<Collidable>> elements, Integer group)
{
final Set<Collidable> points = elements.get(point);
points.remove(collidable);
if (points.isEmpty())
{
elements.remove(point); // depends on control dependency: [if], data = [none]
}
if (elements.isEmpty())
{
collidables.remove(group); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setEntityTypes(java.util.Collection<String> entityTypes) {
if (entityTypes == null) {
this.entityTypes = null;
return;
}
this.entityTypes = new java.util.ArrayList<String>(entityTypes);
} } | public class class_name {
public void setEntityTypes(java.util.Collection<String> entityTypes) {
if (entityTypes == null) {
this.entityTypes = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.entityTypes = new java.util.ArrayList<String>(entityTypes);
} } |
public class class_name {
public void setClientContainer(boolean clientContainer) // F48603.7
{
setOwningFlow(clientContainer ? ReferenceFlowKind.CLIENT : null);
if (isClientContainer() && ivInjectionClasses != null && !ivInjectionClasses.isEmpty()) {
ivClientMainClass = ivInjectionClasses.get(0);
}
} } | public class class_name {
public void setClientContainer(boolean clientContainer) // F48603.7
{
setOwningFlow(clientContainer ? ReferenceFlowKind.CLIENT : null);
if (isClientContainer() && ivInjectionClasses != null && !ivInjectionClasses.isEmpty()) {
ivClientMainClass = ivInjectionClasses.get(0); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(EventTriggerDefinition eventTriggerDefinition, ProtocolMarshaller protocolMarshaller) {
if (eventTriggerDefinition == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(eventTriggerDefinition.getEventResourceARN(), EVENTRESOURCEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(EventTriggerDefinition eventTriggerDefinition, ProtocolMarshaller protocolMarshaller) {
if (eventTriggerDefinition == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(eventTriggerDefinition.getEventResourceARN(), EVENTRESOURCEARN_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 RouteBuilder on(String uri) {
if (!uri.startsWith("/")) {
this.uri = "/" + uri;
} else {
this.uri = uri;
}
return this;
} } | public class class_name {
public RouteBuilder on(String uri) {
if (!uri.startsWith("/")) {
this.uri = "/" + uri; // depends on control dependency: [if], data = [none]
} else {
this.uri = uri; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public java.util.List<String> getLogStreamNames() {
if (logStreamNames == null) {
logStreamNames = new com.amazonaws.internal.SdkInternalList<String>();
}
return logStreamNames;
} } | public class class_name {
public java.util.List<String> getLogStreamNames() {
if (logStreamNames == null) {
logStreamNames = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return logStreamNames;
} } |
public class class_name {
@PostConstruct
public void warnOnApathyKeyInMappings() {
if (null != profileKeyForNoSelection
&& immutableMappings.containsKey(profileKeyForNoSelection)) {
logger.warn(
"Configured to treat profile key {} as apathy, "
+ "yet also configured to map that key to profile fname {}. Apathy wins. "
+ "This is likely just fine, but it might be a misconfiguration.",
profileKeyForNoSelection,
immutableMappings.get(profileKeyForNoSelection));
}
} } | public class class_name {
@PostConstruct
public void warnOnApathyKeyInMappings() {
if (null != profileKeyForNoSelection
&& immutableMappings.containsKey(profileKeyForNoSelection)) {
logger.warn(
"Configured to treat profile key {} as apathy, "
+ "yet also configured to map that key to profile fname {}. Apathy wins. "
+ "This is likely just fine, but it might be a misconfiguration.",
profileKeyForNoSelection,
immutableMappings.get(profileKeyForNoSelection)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void handleUndoLog(List<UndoAction> undoLog, boolean undo) {
if (undoLog == null) {
return;
}
if (undo) {
undoLog = Lists.reverse(undoLog);
}
for (UndoAction action : undoLog) {
if (undo) {
action.undo();
} else {
action.release();
}
}
if (undo) {
undoLog.clear();
}
} } | public class class_name {
private static void handleUndoLog(List<UndoAction> undoLog, boolean undo) {
if (undoLog == null) {
return; // depends on control dependency: [if], data = [none]
}
if (undo) {
undoLog = Lists.reverse(undoLog); // depends on control dependency: [if], data = [none]
}
for (UndoAction action : undoLog) {
if (undo) {
action.undo(); // depends on control dependency: [if], data = [none]
} else {
action.release(); // depends on control dependency: [if], data = [none]
}
}
if (undo) {
undoLog.clear(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static String forEachFields(final Set<String> fields, OnFieldListener listener) {
StringBuilder builder = new StringBuilder();
{
String comma = "";
for (String item : fields) {
builder.append(comma + listener.onField(item));
comma = ", ";
}
}
return builder.toString();
} } | public class class_name {
private static String forEachFields(final Set<String> fields, OnFieldListener listener) {
StringBuilder builder = new StringBuilder();
{
String comma = "";
for (String item : fields) {
builder.append(comma + listener.onField(item)); // depends on control dependency: [for], data = [item]
comma = ", "; // depends on control dependency: [for], data = [none]
}
}
return builder.toString();
} } |
public class class_name {
public OClientConnection connect(final ONetworkProtocol iProtocol, final OClientConnection connection, final byte[] tokenBytes,
final OTokenHandler handler) {
final OToken token;
try {
token = handler.parseBinaryToken(tokenBytes);
} catch (Exception e) {
throw OException.wrapException(new OTokenSecurityException("Error on token parsing"), e);
}
OClientSessions session;
synchronized (sessions) {
session = new OClientSessions(tokenBytes, token);
sessions.put(new OHashToken(tokenBytes), session);
}
connection.setTokenBytes(tokenBytes);
connection.setTokenBased(true);
connection.setToken(token);
session.addConnection(connection);
OLogManager.instance().config(this, "Remote client connected from: " + connection);
OServerPluginHelper.invokeHandlerCallbackOnClientConnection(iProtocol.getServer(), connection);
return connection;
} } | public class class_name {
public OClientConnection connect(final ONetworkProtocol iProtocol, final OClientConnection connection, final byte[] tokenBytes,
final OTokenHandler handler) {
final OToken token;
try {
token = handler.parseBinaryToken(tokenBytes); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw OException.wrapException(new OTokenSecurityException("Error on token parsing"), e);
} // depends on control dependency: [catch], data = [none]
OClientSessions session;
synchronized (sessions) {
session = new OClientSessions(tokenBytes, token);
sessions.put(new OHashToken(tokenBytes), session);
}
connection.setTokenBytes(tokenBytes);
connection.setTokenBased(true);
connection.setToken(token);
session.addConnection(connection);
OLogManager.instance().config(this, "Remote client connected from: " + connection);
OServerPluginHelper.invokeHandlerCallbackOnClientConnection(iProtocol.getServer(), connection);
return connection;
} } |
public class class_name {
public AwsSecurityFinding withRelatedFindings(RelatedFinding... relatedFindings) {
if (this.relatedFindings == null) {
setRelatedFindings(new java.util.ArrayList<RelatedFinding>(relatedFindings.length));
}
for (RelatedFinding ele : relatedFindings) {
this.relatedFindings.add(ele);
}
return this;
} } | public class class_name {
public AwsSecurityFinding withRelatedFindings(RelatedFinding... relatedFindings) {
if (this.relatedFindings == null) {
setRelatedFindings(new java.util.ArrayList<RelatedFinding>(relatedFindings.length)); // depends on control dependency: [if], data = [none]
}
for (RelatedFinding ele : relatedFindings) {
this.relatedFindings.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected Model createCleanPom( Model effectivePom )
{
Model cleanPom = new Model();
cleanPom.setGroupId( effectivePom.getGroupId() );
cleanPom.setArtifactId( effectivePom.getArtifactId() );
cleanPom.setVersion( effectivePom.getVersion() );
cleanPom.setPackaging( effectivePom.getPackaging() );
cleanPom.setLicenses( effectivePom.getLicenses() );
// fixed to 4.0.0 forever :)
cleanPom.setModelVersion( "4.0.0" );
// plugins with extensions must stay
Build build = effectivePom.getBuild();
if ( build != null )
{
for ( Plugin plugin : build.getPlugins() )
{
if ( plugin.isExtensions() )
{
Build cleanBuild = cleanPom.getBuild();
if ( cleanBuild == null )
{
cleanBuild = new Build();
cleanPom.setBuild( cleanBuild );
}
Plugin cleanPlugin = new Plugin();
cleanPlugin.setGroupId( plugin.getGroupId() );
cleanPlugin.setArtifactId( plugin.getArtifactId() );
cleanPlugin.setVersion( plugin.getVersion() );
cleanPlugin.setExtensions( true );
cleanBuild.addPlugin( cleanPlugin );
}
}
}
// transform profiles...
for ( Profile profile : effectivePom.getProfiles() )
{
if ( !isEmbedBuildProfileDependencies() || !isBuildTimeDriven( profile.getActivation() ) )
{
if ( !isEmpty( profile.getDependencies() ) || !isEmpty( profile.getRepositories() ) )
{
Profile strippedProfile = new Profile();
strippedProfile.setId( profile.getId() );
strippedProfile.setActivation( profile.getActivation() );
strippedProfile.setDependencies( profile.getDependencies() );
strippedProfile.setRepositories( profile.getRepositories() );
cleanPom.addProfile( strippedProfile );
}
}
}
// transform dependencies...
List<Dependency> dependencies = createFlattenedDependencies( effectivePom );
cleanPom.setDependencies( dependencies );
return cleanPom;
} } | public class class_name {
protected Model createCleanPom( Model effectivePom )
{
Model cleanPom = new Model();
cleanPom.setGroupId( effectivePom.getGroupId() );
cleanPom.setArtifactId( effectivePom.getArtifactId() );
cleanPom.setVersion( effectivePom.getVersion() );
cleanPom.setPackaging( effectivePom.getPackaging() );
cleanPom.setLicenses( effectivePom.getLicenses() );
// fixed to 4.0.0 forever :)
cleanPom.setModelVersion( "4.0.0" );
// plugins with extensions must stay
Build build = effectivePom.getBuild();
if ( build != null )
{
for ( Plugin plugin : build.getPlugins() )
{
if ( plugin.isExtensions() )
{
Build cleanBuild = cleanPom.getBuild();
if ( cleanBuild == null )
{
cleanBuild = new Build(); // depends on control dependency: [if], data = [none]
cleanPom.setBuild( cleanBuild ); // depends on control dependency: [if], data = [( cleanBuild]
}
Plugin cleanPlugin = new Plugin();
cleanPlugin.setGroupId( plugin.getGroupId() ); // depends on control dependency: [if], data = [none]
cleanPlugin.setArtifactId( plugin.getArtifactId() ); // depends on control dependency: [if], data = [none]
cleanPlugin.setVersion( plugin.getVersion() ); // depends on control dependency: [if], data = [none]
cleanPlugin.setExtensions( true ); // depends on control dependency: [if], data = [none]
cleanBuild.addPlugin( cleanPlugin ); // depends on control dependency: [if], data = [none]
}
}
}
// transform profiles...
for ( Profile profile : effectivePom.getProfiles() )
{
if ( !isEmbedBuildProfileDependencies() || !isBuildTimeDriven( profile.getActivation() ) )
{
if ( !isEmpty( profile.getDependencies() ) || !isEmpty( profile.getRepositories() ) )
{
Profile strippedProfile = new Profile();
strippedProfile.setId( profile.getId() ); // depends on control dependency: [if], data = [none]
strippedProfile.setActivation( profile.getActivation() ); // depends on control dependency: [if], data = [none]
strippedProfile.setDependencies( profile.getDependencies() ); // depends on control dependency: [if], data = [none]
strippedProfile.setRepositories( profile.getRepositories() ); // depends on control dependency: [if], data = [none]
cleanPom.addProfile( strippedProfile ); // depends on control dependency: [if], data = [none]
}
}
}
// transform dependencies...
List<Dependency> dependencies = createFlattenedDependencies( effectivePom );
cleanPom.setDependencies( dependencies );
return cleanPom;
} } |
public class class_name {
public static <T> List<T> removeDuplicates(final List<T> list) {
final List<Class> registered = Lists.newArrayList();
final Iterator it = list.iterator();
while (it.hasNext()) {
final Class type = it.next().getClass();
if (registered.contains(type)) {
it.remove();
} else {
registered.add(type);
}
}
return list;
} } | public class class_name {
public static <T> List<T> removeDuplicates(final List<T> list) {
final List<Class> registered = Lists.newArrayList();
final Iterator it = list.iterator();
while (it.hasNext()) {
final Class type = it.next().getClass();
if (registered.contains(type)) {
it.remove(); // depends on control dependency: [if], data = [none]
} else {
registered.add(type); // depends on control dependency: [if], data = [none]
}
}
return list;
} } |
public class class_name {
public boolean isTypical()
{
if (tables.size() == 0) {
return false;
}
for (HuffmanTable table : tables) {
if (!table.isTypical()) {
return false;
}
}
return true;
} } | public class class_name {
public boolean isTypical()
{
if (tables.size() == 0) {
return false; // depends on control dependency: [if], data = [none]
}
for (HuffmanTable table : tables) {
if (!table.isTypical()) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static INDArray reverseTimeSeriesMask(INDArray mask){
if(mask == null){
return null;
}
if(mask.rank() == 3){
//Should normally not be used - but handle the per-output masking case
return reverseTimeSeries(mask);
} else if(mask.rank() != 2){
throw new IllegalArgumentException("Invalid mask rank: must be rank 2 or 3. Got rank " + mask.rank()
+ " with shape " + Arrays.toString(mask.shape()));
}
// FIXME: int cast
int[] idxs = new int[(int) mask.size(1)];
int j=0;
for( int i=idxs.length-1; i>=0; i--){
idxs[j++] = i;
}
return Nd4j.pullRows(mask, 0, idxs);
} } | public class class_name {
public static INDArray reverseTimeSeriesMask(INDArray mask){
if(mask == null){
return null; // depends on control dependency: [if], data = [none]
}
if(mask.rank() == 3){
//Should normally not be used - but handle the per-output masking case
return reverseTimeSeries(mask); // depends on control dependency: [if], data = [none]
} else if(mask.rank() != 2){
throw new IllegalArgumentException("Invalid mask rank: must be rank 2 or 3. Got rank " + mask.rank()
+ " with shape " + Arrays.toString(mask.shape()));
}
// FIXME: int cast
int[] idxs = new int[(int) mask.size(1)];
int j=0;
for( int i=idxs.length-1; i>=0; i--){
idxs[j++] = i; // depends on control dependency: [for], data = [i]
}
return Nd4j.pullRows(mask, 0, idxs);
} } |
public class class_name {
private final static int onBreak(Frame frame) {
// We always fall back to Debugger.CONTINUE after each onBreak to avoid eternal step-over flag
//int oldReturn = onBreakReturn;
//onBreakReturn = Debugger.CONTINUE;
//return oldReturn;
if (verbose) {
logger.info("Continuing with "+(onBreakReturn==Debugger.CONTINUE?"continue":"step-over"));
}
return onBreakReturn;
} } | public class class_name {
private final static int onBreak(Frame frame) {
// We always fall back to Debugger.CONTINUE after each onBreak to avoid eternal step-over flag
//int oldReturn = onBreakReturn;
//onBreakReturn = Debugger.CONTINUE;
//return oldReturn;
if (verbose) {
logger.info("Continuing with "+(onBreakReturn==Debugger.CONTINUE?"continue":"step-over")); // depends on control dependency: [if], data = [none]
}
return onBreakReturn;
} } |
public class class_name {
public long getCount(@Nullable final DBObject query, final DBCollectionCountOptions options) {
notNull("countOptions", options);
CountOperation operation = new CountOperation(getNamespace())
.skip(options.getSkip())
.limit(options.getLimit())
.maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS)
.collation(options.getCollation())
.retryReads(retryReads);
if (query != null) {
operation.filter(wrap(query));
}
DBObject hint = options.getHint();
if (hint != null) {
operation.hint(wrap(hint));
} else {
String hintString = options.getHintString();
if (hintString != null) {
operation.hint(new BsonString(hintString));
}
}
ReadPreference optionsReadPreference = options.getReadPreference();
ReadConcern optionsReadConcern = options.getReadConcern();
return executor.execute(operation, optionsReadPreference != null ? optionsReadPreference : getReadPreference(),
optionsReadConcern != null ? optionsReadConcern : getReadConcern());
} } | public class class_name {
public long getCount(@Nullable final DBObject query, final DBCollectionCountOptions options) {
notNull("countOptions", options);
CountOperation operation = new CountOperation(getNamespace())
.skip(options.getSkip())
.limit(options.getLimit())
.maxTime(options.getMaxTime(MILLISECONDS), MILLISECONDS)
.collation(options.getCollation())
.retryReads(retryReads);
if (query != null) {
operation.filter(wrap(query)); // depends on control dependency: [if], data = [(query]
}
DBObject hint = options.getHint();
if (hint != null) {
operation.hint(wrap(hint)); // depends on control dependency: [if], data = [(hint]
} else {
String hintString = options.getHintString();
if (hintString != null) {
operation.hint(new BsonString(hintString)); // depends on control dependency: [if], data = [(hintString]
}
}
ReadPreference optionsReadPreference = options.getReadPreference();
ReadConcern optionsReadConcern = options.getReadConcern();
return executor.execute(operation, optionsReadPreference != null ? optionsReadPreference : getReadPreference(),
optionsReadConcern != null ? optionsReadConcern : getReadConcern());
} } |
public class class_name {
public static ASN1Set getInstance(
ASN1TaggedObject obj,
boolean explicit)
{
if (explicit)
{
if (!obj.isExplicit())
{
throw new IllegalArgumentException("object implicit - explicit expected.");
}
return (ASN1Set)obj.getObject();
}
else
{
//
// constructed object which appears to be explicitly tagged
// and it's really implicit means we have to add the
// surrounding sequence.
//
if (obj.isExplicit())
{
ASN1Set set = new DERSet(obj.getObject());
return set;
}
else
{
if (obj.getObject() instanceof ASN1Set)
{
return (ASN1Set)obj.getObject();
}
//
// in this case the parser returns a sequence, convert it
// into a set.
//
ASN1EncodableVector v = new ASN1EncodableVector();
if (obj.getObject() instanceof ASN1Sequence)
{
ASN1Sequence s = (ASN1Sequence)obj.getObject();
Enumeration e = s.getObjects();
while (e.hasMoreElements())
{
v.add((DEREncodable)e.nextElement());
}
return new DERSet(v, false);
}
}
}
throw new IllegalArgumentException(
"unknown object in getInstanceFromTagged");
} } | public class class_name {
public static ASN1Set getInstance(
ASN1TaggedObject obj,
boolean explicit)
{
if (explicit)
{
if (!obj.isExplicit())
{
throw new IllegalArgumentException("object implicit - explicit expected.");
}
return (ASN1Set)obj.getObject(); // depends on control dependency: [if], data = [none]
}
else
{
//
// constructed object which appears to be explicitly tagged
// and it's really implicit means we have to add the
// surrounding sequence.
//
if (obj.isExplicit())
{
ASN1Set set = new DERSet(obj.getObject());
return set; // depends on control dependency: [if], data = [none]
}
else
{
if (obj.getObject() instanceof ASN1Set)
{
return (ASN1Set)obj.getObject(); // depends on control dependency: [if], data = [none]
}
//
// in this case the parser returns a sequence, convert it
// into a set.
//
ASN1EncodableVector v = new ASN1EncodableVector();
if (obj.getObject() instanceof ASN1Sequence)
{
ASN1Sequence s = (ASN1Sequence)obj.getObject();
Enumeration e = s.getObjects();
while (e.hasMoreElements())
{
v.add((DEREncodable)e.nextElement()); // depends on control dependency: [while], data = [none]
}
return new DERSet(v, false); // depends on control dependency: [if], data = [none]
}
}
}
throw new IllegalArgumentException(
"unknown object in getInstanceFromTagged");
} } |
public class class_name {
public void addInstance(Object instance)
throws Exception
{
State currentState = state.get();
if ((currentState == State.STOPPING) || (currentState == State.STOPPED)) {
throw new IllegalStateException();
}
else {
startInstance(instance);
if (methodsMap.get(instance.getClass()).hasFor(PreDestroy.class)) {
managedInstances.add(instance);
}
}
} } | public class class_name {
public void addInstance(Object instance)
throws Exception
{
State currentState = state.get();
if ((currentState == State.STOPPING) || (currentState == State.STOPPED)) {
throw new IllegalStateException();
}
else {
startInstance(instance);
if (methodsMap.get(instance.getClass()).hasFor(PreDestroy.class)) {
managedInstances.add(instance); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public Set<QueryableEntry<K, V>> filter(QueryContext queryContext) {
if (!(predicate instanceof IndexAwarePredicate)) {
return null;
}
Set<QueryableEntry<K, V>> set = ((IndexAwarePredicate<K, V>) predicate).filter(queryContext);
if (set == null || set.isEmpty()) {
return set;
}
List<QueryableEntry<K, V>> resultList = new ArrayList<QueryableEntry<K, V>>();
Map.Entry<Integer, Map.Entry> nearestAnchorEntry = getNearestAnchorEntry();
for (QueryableEntry<K, V> queryableEntry : set) {
if (SortingUtil.compareAnchor(this, queryableEntry, nearestAnchorEntry)) {
resultList.add(queryableEntry);
}
}
List<QueryableEntry<K, V>> sortedSubList =
(List) SortingUtil.getSortedSubList((List) resultList, this, nearestAnchorEntry);
return new LinkedHashSet<QueryableEntry<K, V>>(sortedSubList);
} } | public class class_name {
@Override
public Set<QueryableEntry<K, V>> filter(QueryContext queryContext) {
if (!(predicate instanceof IndexAwarePredicate)) {
return null; // depends on control dependency: [if], data = [none]
}
Set<QueryableEntry<K, V>> set = ((IndexAwarePredicate<K, V>) predicate).filter(queryContext);
if (set == null || set.isEmpty()) {
return set; // depends on control dependency: [if], data = [none]
}
List<QueryableEntry<K, V>> resultList = new ArrayList<QueryableEntry<K, V>>();
Map.Entry<Integer, Map.Entry> nearestAnchorEntry = getNearestAnchorEntry();
for (QueryableEntry<K, V> queryableEntry : set) {
if (SortingUtil.compareAnchor(this, queryableEntry, nearestAnchorEntry)) {
resultList.add(queryableEntry); // depends on control dependency: [if], data = [none]
}
}
List<QueryableEntry<K, V>> sortedSubList =
(List) SortingUtil.getSortedSubList((List) resultList, this, nearestAnchorEntry);
return new LinkedHashSet<QueryableEntry<K, V>>(sortedSubList);
} } |
public class class_name {
private String getID( CrawlableDataset dataset )
{
if ( dataset == null )
return null;
if ( collectionId == null )
return null;
int i = collectionLevel.getPath().length();
String id = dataset.getPath().substring( i );
if ( id.startsWith( "/" ))
id = id.substring( 1 );
if ( collectionId.equals( "" ) )
{
if ( id.equals( ""))
return null;
return id;
}
if ( id.equals( "") )
return collectionId;
return( collectionId + "/" + id );
} } | public class class_name {
private String getID( CrawlableDataset dataset )
{
if ( dataset == null )
return null;
if ( collectionId == null )
return null;
int i = collectionLevel.getPath().length();
String id = dataset.getPath().substring( i );
if ( id.startsWith( "/" ))
id = id.substring( 1 );
if ( collectionId.equals( "" ) )
{
if ( id.equals( ""))
return null;
return id; // depends on control dependency: [if], data = [none]
}
if ( id.equals( "") )
return collectionId;
return( collectionId + "/" + id );
} } |
public class class_name {
@Override
public CommercePriceListUserSegmentEntryRel remove(Serializable primaryKey)
throws NoSuchPriceListUserSegmentEntryRelException {
Session session = null;
try {
session = openSession();
CommercePriceListUserSegmentEntryRel commercePriceListUserSegmentEntryRel =
(CommercePriceListUserSegmentEntryRel)session.get(CommercePriceListUserSegmentEntryRelImpl.class,
primaryKey);
if (commercePriceListUserSegmentEntryRel == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchPriceListUserSegmentEntryRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commercePriceListUserSegmentEntryRel);
}
catch (NoSuchPriceListUserSegmentEntryRelException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public CommercePriceListUserSegmentEntryRel remove(Serializable primaryKey)
throws NoSuchPriceListUserSegmentEntryRelException {
Session session = null;
try {
session = openSession();
CommercePriceListUserSegmentEntryRel commercePriceListUserSegmentEntryRel =
(CommercePriceListUserSegmentEntryRel)session.get(CommercePriceListUserSegmentEntryRelImpl.class,
primaryKey);
if (commercePriceListUserSegmentEntryRel == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchPriceListUserSegmentEntryRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commercePriceListUserSegmentEntryRel);
}
catch (NoSuchPriceListUserSegmentEntryRelException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } |
public class class_name {
private int updateNeighbour(Pathfindable mover, int dtx, int dty, Node current, int xp, int yp, int maxDepth)
{
int nextDepth = maxDepth;
final double nextStepCost = current.getCost() + getMovementCost(mover, current.getX(), current.getY());
final Node neighbour = nodes[yp][xp];
if (nextStepCost < neighbour.getCost())
{
open.remove(neighbour);
closed.remove(neighbour);
}
if (!open.contains(neighbour) && !closed.contains(neighbour))
{
neighbour.setCost(nextStepCost);
neighbour.setHeuristic(getHeuristicCost(xp, yp, dtx, dty));
nextDepth = Math.max(maxDepth, neighbour.setParent(current));
open.add(neighbour);
}
return nextDepth;
} } | public class class_name {
private int updateNeighbour(Pathfindable mover, int dtx, int dty, Node current, int xp, int yp, int maxDepth)
{
int nextDepth = maxDepth;
final double nextStepCost = current.getCost() + getMovementCost(mover, current.getX(), current.getY());
final Node neighbour = nodes[yp][xp];
if (nextStepCost < neighbour.getCost())
{
open.remove(neighbour); // depends on control dependency: [if], data = [none]
closed.remove(neighbour); // depends on control dependency: [if], data = [none]
}
if (!open.contains(neighbour) && !closed.contains(neighbour))
{
neighbour.setCost(nextStepCost); // depends on control dependency: [if], data = [none]
neighbour.setHeuristic(getHeuristicCost(xp, yp, dtx, dty)); // depends on control dependency: [if], data = [none]
nextDepth = Math.max(maxDepth, neighbour.setParent(current)); // depends on control dependency: [if], data = [none]
open.add(neighbour); // depends on control dependency: [if], data = [none]
}
return nextDepth;
} } |
public class class_name {
public static boolean newerThan(File file, File reference) {
if (null == reference || false == reference.exists()) {
return true;// 文件一定比一个不存在的文件新
}
return newerThan(file, reference.lastModified());
} } | public class class_name {
public static boolean newerThan(File file, File reference) {
if (null == reference || false == reference.exists()) {
return true;// 文件一定比一个不存在的文件新
// depends on control dependency: [if], data = [none]
}
return newerThan(file, reference.lastModified());
} } |
public class class_name {
@Override
public String execute(EditXmlInputs inputs) throws Exception {
Document doc = XmlUtils.createDocument(inputs.getXml(), inputs.getFilePath(), inputs.getParsingFeatures());
NamespaceContext ctx = XmlUtils.getNamespaceContext(inputs.getXml(), inputs.getFilePath());
NodeList nodeListToMove = XmlUtils.readNode(doc, inputs.getXpath1(), ctx);
NodeList nodeListWhereToMove = XmlUtils.readNode(doc, inputs.getXpath2(), ctx);
Node nodeToMove;
Node nodeWhereToMove;
if (!inputs.getXpath2().contains(inputs.getXpath1())) {
// remove nodes
for (int i = 0; i < nodeListToMove.getLength(); i++) {
nodeToMove = nodeListToMove.item(i);
if (nodeToMove != doc.getDocumentElement()) {
nodeToMove.getParentNode().removeChild(nodeToMove);
}
}
//add nodes to designated location
for (int i = 0; i < nodeListWhereToMove.getLength(); i++) {
nodeWhereToMove = nodeListWhereToMove.item(i);
for (int j = 0; j < nodeListToMove.getLength(); j++) {
nodeToMove = nodeListToMove.item(j);
nodeToMove = doc.importNode(nodeToMove, true);
nodeWhereToMove.appendChild(nodeToMove);
}
}
}
return DocumentUtils.documentToString(doc);
} } | public class class_name {
@Override
public String execute(EditXmlInputs inputs) throws Exception {
Document doc = XmlUtils.createDocument(inputs.getXml(), inputs.getFilePath(), inputs.getParsingFeatures());
NamespaceContext ctx = XmlUtils.getNamespaceContext(inputs.getXml(), inputs.getFilePath());
NodeList nodeListToMove = XmlUtils.readNode(doc, inputs.getXpath1(), ctx);
NodeList nodeListWhereToMove = XmlUtils.readNode(doc, inputs.getXpath2(), ctx);
Node nodeToMove;
Node nodeWhereToMove;
if (!inputs.getXpath2().contains(inputs.getXpath1())) {
// remove nodes
for (int i = 0; i < nodeListToMove.getLength(); i++) {
nodeToMove = nodeListToMove.item(i); // depends on control dependency: [for], data = [i]
if (nodeToMove != doc.getDocumentElement()) {
nodeToMove.getParentNode().removeChild(nodeToMove); // depends on control dependency: [if], data = [(nodeToMove]
}
}
//add nodes to designated location
for (int i = 0; i < nodeListWhereToMove.getLength(); i++) {
nodeWhereToMove = nodeListWhereToMove.item(i); // depends on control dependency: [for], data = [i]
for (int j = 0; j < nodeListToMove.getLength(); j++) {
nodeToMove = nodeListToMove.item(j); // depends on control dependency: [for], data = [j]
nodeToMove = doc.importNode(nodeToMove, true); // depends on control dependency: [for], data = [none]
nodeWhereToMove.appendChild(nodeToMove); // depends on control dependency: [for], data = [none]
}
}
}
return DocumentUtils.documentToString(doc);
} } |
public class class_name {
public ICalendar first() throws IOException {
StreamReader reader = constructReader();
if (index != null) {
reader.setScribeIndex(index);
}
try {
ICalendar ical = reader.readNext();
if (warnings != null) {
warnings.add(reader.getWarnings());
}
return ical;
} finally {
if (closeWhenDone()) {
reader.close();
}
}
} } | public class class_name {
public ICalendar first() throws IOException {
StreamReader reader = constructReader();
if (index != null) {
reader.setScribeIndex(index);
}
try {
ICalendar ical = reader.readNext();
if (warnings != null) {
warnings.add(reader.getWarnings()); // depends on control dependency: [if], data = [none]
}
return ical;
} finally {
if (closeWhenDone()) {
reader.close(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public boolean fullScroll(int direction) {
boolean down = direction == View.FOCUS_DOWN;
int height = getHeight();
mTempRect.top = 0;
mTempRect.bottom = height;
if (down) {
int count = getChildCount();
if (count > 0) {
View view = getChildAt(count - 1);
mTempRect.bottom = view.getBottom() + getPaddingBottom();
mTempRect.top = mTempRect.bottom - height;
}
}
return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom);
} } | public class class_name {
public boolean fullScroll(int direction) {
boolean down = direction == View.FOCUS_DOWN;
int height = getHeight();
mTempRect.top = 0;
mTempRect.bottom = height;
if (down) {
int count = getChildCount();
if (count > 0) {
View view = getChildAt(count - 1);
mTempRect.bottom = view.getBottom() + getPaddingBottom(); // depends on control dependency: [if], data = [none]
mTempRect.top = mTempRect.bottom - height; // depends on control dependency: [if], data = [none]
}
}
return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom);
} } |
public class class_name {
public static Type getGenericType(final Type type, final Type declaringClass) {
if (type == null || declaringClass == null) return type;
if (type instanceof TypeVariable) {
Type superType = null;
Class declaringClass0 = null;
if (declaringClass instanceof Class) {
declaringClass0 = (Class) declaringClass;
superType = declaringClass0.getGenericSuperclass();
while (superType instanceof Class && superType != Object.class) superType = ((Class) superType).getGenericSuperclass();
} else if (declaringClass instanceof ParameterizedType) {
superType = declaringClass;
Type rawType = ((ParameterizedType) declaringClass).getRawType();
if (rawType instanceof Class) declaringClass0 = (Class) rawType;
}
if (declaringClass0 != null && superType instanceof ParameterizedType) {
ParameterizedType superPT = (ParameterizedType) superType;
Type[] atas = superPT.getActualTypeArguments();
Class ss = declaringClass0;
TypeVariable[] asts = ss.getTypeParameters();
while (atas.length != asts.length && ss != Object.class) {
ss = ss.getSuperclass();
asts = ss.getTypeParameters();
}
if (atas.length == asts.length) {
for (int i = 0; i < asts.length; i++) {
if (asts[i] == type) return atas[i];
}
}
Type moreType = ((ParameterizedType) superType).getRawType();
if (moreType != Object.class) return getGenericType(type, moreType);
}
TypeVariable tv = (TypeVariable) type;
if (tv.getBounds().length == 1) return tv.getBounds()[0];
}
if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
return createParameterizedType(getGenericType(pt.getOwnerType(), declaringClass),
getGenericType(pt.getRawType(), declaringClass),
getGenericType(pt.getActualTypeArguments(), declaringClass));
}
return type;
} } | public class class_name {
public static Type getGenericType(final Type type, final Type declaringClass) {
if (type == null || declaringClass == null) return type;
if (type instanceof TypeVariable) {
Type superType = null;
Class declaringClass0 = null;
// depends on control dependency: [if], data = [none]
if (declaringClass instanceof Class) {
declaringClass0 = (Class) declaringClass;
// depends on control dependency: [if], data = [none]
superType = declaringClass0.getGenericSuperclass();
// depends on control dependency: [if], data = [none]
while (superType instanceof Class && superType != Object.class) superType = ((Class) superType).getGenericSuperclass();
} else if (declaringClass instanceof ParameterizedType) {
superType = declaringClass;
// depends on control dependency: [if], data = [none]
Type rawType = ((ParameterizedType) declaringClass).getRawType();
if (rawType instanceof Class) declaringClass0 = (Class) rawType;
}
if (declaringClass0 != null && superType instanceof ParameterizedType) {
ParameterizedType superPT = (ParameterizedType) superType;
Type[] atas = superPT.getActualTypeArguments();
Class ss = declaringClass0;
TypeVariable[] asts = ss.getTypeParameters();
while (atas.length != asts.length && ss != Object.class) {
ss = ss.getSuperclass();
// depends on control dependency: [while], data = [none]
asts = ss.getTypeParameters();
// depends on control dependency: [while], data = [none]
}
if (atas.length == asts.length) {
for (int i = 0; i < asts.length; i++) {
if (asts[i] == type) return atas[i];
}
}
Type moreType = ((ParameterizedType) superType).getRawType();
if (moreType != Object.class) return getGenericType(type, moreType);
}
TypeVariable tv = (TypeVariable) type;
if (tv.getBounds().length == 1) return tv.getBounds()[0];
}
if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
return createParameterizedType(getGenericType(pt.getOwnerType(), declaringClass),
getGenericType(pt.getRawType(), declaringClass),
getGenericType(pt.getActualTypeArguments(), declaringClass));
// depends on control dependency: [if], data = [none]
}
return type;
} } |
public class class_name {
public void removePrincipal(String principal) {
if (!readOnly && principals.contains(principal)) {
principals.remove(principal);
principalsModified = true;
}
} } | public class class_name {
public void removePrincipal(String principal) {
if (!readOnly && principals.contains(principal)) {
principals.remove(principal); // depends on control dependency: [if], data = [none]
principalsModified = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void validateParameterProviders() {
Set<String> parameterNames = new HashSet<>();
for (ParameterProvider provider : this.parameterProviders) {
Set<String> applicationIdsOfThisProvider = new HashSet<>();
for (Parameter<?> parameter : provider.getParameters()) {
if (StringUtils.isNotEmpty(parameter.getApplicationId())) {
applicationIdsOfThisProvider.add(parameter.getApplicationId());
}
if (parameterNames.contains(parameter.getName())) {
log.warn("Parameter name is not unique: {} (application: {})", parameter.getName(), parameter.getApplicationId());
}
else {
parameterNames.add(parameter.getName());
}
}
if (applicationIdsOfThisProvider.size() > 1) { //NOPMD
log.warn("Parameter provider {} defines parameters with multiple application Ids: {}", provider,
applicationIdsOfThisProvider.toArray(new String[applicationIdsOfThisProvider.size()]));
}
}
} } | public class class_name {
private void validateParameterProviders() {
Set<String> parameterNames = new HashSet<>();
for (ParameterProvider provider : this.parameterProviders) {
Set<String> applicationIdsOfThisProvider = new HashSet<>();
for (Parameter<?> parameter : provider.getParameters()) {
if (StringUtils.isNotEmpty(parameter.getApplicationId())) {
applicationIdsOfThisProvider.add(parameter.getApplicationId()); // depends on control dependency: [if], data = [none]
}
if (parameterNames.contains(parameter.getName())) {
log.warn("Parameter name is not unique: {} (application: {})", parameter.getName(), parameter.getApplicationId()); // depends on control dependency: [if], data = [none]
}
else {
parameterNames.add(parameter.getName()); // depends on control dependency: [if], data = [none]
}
}
if (applicationIdsOfThisProvider.size() > 1) { //NOPMD
log.warn("Parameter provider {} defines parameters with multiple application Ids: {}", provider,
applicationIdsOfThisProvider.toArray(new String[applicationIdsOfThisProvider.size()]));
}
}
} } |
public class class_name {
private void uploadMetrics(TopologyMetric tpMetric) throws Exception {
long start = System.currentTimeMillis();
if (tpMetric == null) {
return;
}
try {
synchronized (lock) {
if (client == null || !client.isValid()) {
client = new NimbusClientWrapper();
client.init(conf);
}
}
MetricInfo topologyMetrics = tpMetric.get_topologyMetric();
MetricInfo componentMetrics = tpMetric.get_componentMetric();
MetricInfo taskMetrics = tpMetric.get_taskMetric();
MetricInfo streamMetrics = tpMetric.get_streamMetric();
MetricInfo workerMetrics = tpMetric.get_workerMetric();
MetricInfo nettyMetrics = tpMetric.get_nettyMetric();
MetricInfo compStreamMetrics = tpMetric.get_compStreamMetric();
int totalSize = topologyMetrics.get_metrics_size()
+ componentMetrics.get_metrics_size()
+ taskMetrics.get_metrics_size()
+ streamMetrics.get_metrics_size()
+ workerMetrics.get_metrics_size()
+ nettyMetrics.get_metrics_size()
+ compStreamMetrics.get_metrics_size();
// for small topologies, send all metrics together to ease the
// pressure of nimbus
if (totalSize < MAX_BATCH_SIZE) {
TopologyMetric allMetrics = new TopologyMetric(
topologyMetrics, componentMetrics, workerMetrics, taskMetrics, streamMetrics, nettyMetrics);
allMetrics.set_compStreamMetric(compStreamMetrics);
client.getClient().uploadTopologyMetrics(topologyId, allMetrics);
} else {
TopologyMetric partialMetrics = new TopologyMetric(topologyMetrics, componentMetrics,
dummy, dummy, dummy, dummy);
partialMetrics.set_compStreamMetric(compStreamMetrics);
client.getClient().uploadTopologyMetrics(topologyId, partialMetrics);
batchUploadMetrics(workerMetrics, MetaType.WORKER);
batchUploadMetrics(taskMetrics, MetaType.TASK);
batchUploadMetrics(streamMetrics, MetaType.STREAM);
batchUploadMetrics(nettyMetrics, MetaType.NETTY);
}
} catch (Exception e) {
String errorInfo = "Failed to upload worker metrics";
LOG.error(errorInfo, e);
if (client != null) {
client.cleanup();
}
zkCluster.report_task_error(
context.getTopologyId(), context.getThisTaskId(), errorInfo, ErrorConstants.WARN, ErrorConstants.CODE_USER);
}
metricLogger.info("upload metrics, cost:{}", System.currentTimeMillis() - start);
} } | public class class_name {
private void uploadMetrics(TopologyMetric tpMetric) throws Exception {
long start = System.currentTimeMillis();
if (tpMetric == null) {
return;
}
try {
synchronized (lock) {
if (client == null || !client.isValid()) {
client = new NimbusClientWrapper(); // depends on control dependency: [if], data = [none]
client.init(conf); // depends on control dependency: [if], data = [none]
}
}
MetricInfo topologyMetrics = tpMetric.get_topologyMetric();
MetricInfo componentMetrics = tpMetric.get_componentMetric();
MetricInfo taskMetrics = tpMetric.get_taskMetric();
MetricInfo streamMetrics = tpMetric.get_streamMetric();
MetricInfo workerMetrics = tpMetric.get_workerMetric();
MetricInfo nettyMetrics = tpMetric.get_nettyMetric();
MetricInfo compStreamMetrics = tpMetric.get_compStreamMetric();
int totalSize = topologyMetrics.get_metrics_size()
+ componentMetrics.get_metrics_size()
+ taskMetrics.get_metrics_size()
+ streamMetrics.get_metrics_size()
+ workerMetrics.get_metrics_size()
+ nettyMetrics.get_metrics_size()
+ compStreamMetrics.get_metrics_size();
// for small topologies, send all metrics together to ease the
// pressure of nimbus
if (totalSize < MAX_BATCH_SIZE) {
TopologyMetric allMetrics = new TopologyMetric(
topologyMetrics, componentMetrics, workerMetrics, taskMetrics, streamMetrics, nettyMetrics);
allMetrics.set_compStreamMetric(compStreamMetrics);
client.getClient().uploadTopologyMetrics(topologyId, allMetrics);
} else {
TopologyMetric partialMetrics = new TopologyMetric(topologyMetrics, componentMetrics,
dummy, dummy, dummy, dummy);
partialMetrics.set_compStreamMetric(compStreamMetrics);
client.getClient().uploadTopologyMetrics(topologyId, partialMetrics);
batchUploadMetrics(workerMetrics, MetaType.WORKER);
batchUploadMetrics(taskMetrics, MetaType.TASK);
batchUploadMetrics(streamMetrics, MetaType.STREAM);
batchUploadMetrics(nettyMetrics, MetaType.NETTY);
}
} catch (Exception e) {
String errorInfo = "Failed to upload worker metrics";
LOG.error(errorInfo, e);
if (client != null) {
client.cleanup();
}
zkCluster.report_task_error(
context.getTopologyId(), context.getThisTaskId(), errorInfo, ErrorConstants.WARN, ErrorConstants.CODE_USER);
}
metricLogger.info("upload metrics, cost:{}", System.currentTimeMillis() - start);
} } |
public class class_name {
public final void typeMatch() throws RecognitionException {
try {
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:5: ( ( primitiveType )=> ( primitiveType ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* ) | ( ID ( ( typeArguments )=> typeArguments )? ( DOT ID ( ( typeArguments )=> typeArguments )? )* ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* ) )
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0==ID) ) {
int LA11_1 = input.LA(2);
if ( (((((helper.validateIdentifierKey(DroolsSoftKeywords.SHORT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.LONG)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE)))||((helper.validateIdentifierKey(DroolsSoftKeywords.FLOAT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.DOUBLE)))||((helper.validateIdentifierKey(DroolsSoftKeywords.INT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR))))&&synpred1_DRL5Expressions())) ) {
alt11=1;
}
else if ( (true) ) {
alt11=2;
}
}
else {
if (state.backtracking>0) {state.failed=true; return;}
NoViableAltException nvae =
new NoViableAltException("", 11, 0, input);
throw nvae;
}
switch (alt11) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:8: ( primitiveType )=> ( primitiveType ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* )
{
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:27: ( primitiveType ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:29: primitiveType ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )*
{
pushFollow(FOLLOW_primitiveType_in_typeMatch555);
primitiveType();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:43: ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )*
loop6:
while (true) {
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0==LEFT_SQUARE) && (synpred2_DRL5Expressions())) {
alt6=1;
}
switch (alt6) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:44: ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE
{
match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_typeMatch565); if (state.failed) return;
match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_typeMatch567); if (state.failed) return;
}
break;
default :
break loop6;
}
}
}
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:7: ( ID ( ( typeArguments )=> typeArguments )? ( DOT ID ( ( typeArguments )=> typeArguments )? )* ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* )
{
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:7: ( ID ( ( typeArguments )=> typeArguments )? ( DOT ID ( ( typeArguments )=> typeArguments )? )* ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:9: ID ( ( typeArguments )=> typeArguments )? ( DOT ID ( ( typeArguments )=> typeArguments )? )* ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )*
{
match(input,ID,FOLLOW_ID_in_typeMatch581); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:12: ( ( typeArguments )=> typeArguments )?
int alt7=2;
int LA7_0 = input.LA(1);
if ( (LA7_0==LESS) ) {
int LA7_1 = input.LA(2);
if ( (LA7_1==ID) && (synpred3_DRL5Expressions())) {
alt7=1;
}
else if ( (LA7_1==QUESTION) && (synpred3_DRL5Expressions())) {
alt7=1;
}
}
switch (alt7) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:13: ( typeArguments )=> typeArguments
{
pushFollow(FOLLOW_typeArguments_in_typeMatch588);
typeArguments();
state._fsp--;
if (state.failed) return;
}
break;
}
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:46: ( DOT ID ( ( typeArguments )=> typeArguments )? )*
loop9:
while (true) {
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0==DOT) ) {
alt9=1;
}
switch (alt9) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:47: DOT ID ( ( typeArguments )=> typeArguments )?
{
match(input,DOT,FOLLOW_DOT_in_typeMatch593); if (state.failed) return;
match(input,ID,FOLLOW_ID_in_typeMatch595); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:54: ( ( typeArguments )=> typeArguments )?
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0==LESS) ) {
int LA8_1 = input.LA(2);
if ( (LA8_1==ID) && (synpred4_DRL5Expressions())) {
alt8=1;
}
else if ( (LA8_1==QUESTION) && (synpred4_DRL5Expressions())) {
alt8=1;
}
}
switch (alt8) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:55: ( typeArguments )=> typeArguments
{
pushFollow(FOLLOW_typeArguments_in_typeMatch602);
typeArguments();
state._fsp--;
if (state.failed) return;
}
break;
}
}
break;
default :
break loop9;
}
}
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:91: ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )*
loop10:
while (true) {
int alt10=2;
int LA10_0 = input.LA(1);
if ( (LA10_0==LEFT_SQUARE) && (synpred5_DRL5Expressions())) {
alt10=1;
}
switch (alt10) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:92: ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE
{
match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_typeMatch617); if (state.failed) return;
match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_typeMatch619); if (state.failed) return;
}
break;
default :
break loop10;
}
}
}
}
break;
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } | public class class_name {
public final void typeMatch() throws RecognitionException {
try {
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:5: ( ( primitiveType )=> ( primitiveType ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* ) | ( ID ( ( typeArguments )=> typeArguments )? ( DOT ID ( ( typeArguments )=> typeArguments )? )* ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* ) )
int alt11=2;
int LA11_0 = input.LA(1);
if ( (LA11_0==ID) ) {
int LA11_1 = input.LA(2);
if ( (((((helper.validateIdentifierKey(DroolsSoftKeywords.SHORT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.LONG)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE)))||((helper.validateIdentifierKey(DroolsSoftKeywords.FLOAT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.DOUBLE)))||((helper.validateIdentifierKey(DroolsSoftKeywords.INT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR))))&&synpred1_DRL5Expressions())) ) {
alt11=1; // depends on control dependency: [if], data = [none]
}
else if ( (true) ) {
alt11=2; // depends on control dependency: [if], data = [none]
}
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 11, 0, input);
throw nvae;
}
switch (alt11) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:8: ( primitiveType )=> ( primitiveType ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* )
{
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:27: ( primitiveType ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:29: primitiveType ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )*
{
pushFollow(FOLLOW_primitiveType_in_typeMatch555);
primitiveType();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:43: ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )*
loop6:
while (true) {
int alt6=2;
int LA6_0 = input.LA(1);
if ( (LA6_0==LEFT_SQUARE) && (synpred2_DRL5Expressions())) {
alt6=1; // depends on control dependency: [if], data = [none]
}
switch (alt6) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:138:44: ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE
{
match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_typeMatch565); if (state.failed) return;
match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_typeMatch567); if (state.failed) return;
}
break;
default :
break loop6;
}
}
}
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:7: ( ID ( ( typeArguments )=> typeArguments )? ( DOT ID ( ( typeArguments )=> typeArguments )? )* ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* )
{
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:7: ( ID ( ( typeArguments )=> typeArguments )? ( DOT ID ( ( typeArguments )=> typeArguments )? )* ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )* )
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:9: ID ( ( typeArguments )=> typeArguments )? ( DOT ID ( ( typeArguments )=> typeArguments )? )* ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )*
{
match(input,ID,FOLLOW_ID_in_typeMatch581); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:12: ( ( typeArguments )=> typeArguments )?
int alt7=2;
int LA7_0 = input.LA(1);
if ( (LA7_0==LESS) ) {
int LA7_1 = input.LA(2);
if ( (LA7_1==ID) && (synpred3_DRL5Expressions())) {
alt7=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA7_1==QUESTION) && (synpred3_DRL5Expressions())) {
alt7=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt7) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:13: ( typeArguments )=> typeArguments
{
pushFollow(FOLLOW_typeArguments_in_typeMatch588);
typeArguments();
state._fsp--;
if (state.failed) return;
}
break;
}
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:46: ( DOT ID ( ( typeArguments )=> typeArguments )? )*
loop9:
while (true) {
int alt9=2;
int LA9_0 = input.LA(1);
if ( (LA9_0==DOT) ) {
alt9=1; // depends on control dependency: [if], data = [none]
}
switch (alt9) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:47: DOT ID ( ( typeArguments )=> typeArguments )?
{
match(input,DOT,FOLLOW_DOT_in_typeMatch593); if (state.failed) return;
match(input,ID,FOLLOW_ID_in_typeMatch595); if (state.failed) return;
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:54: ( ( typeArguments )=> typeArguments )?
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0==LESS) ) {
int LA8_1 = input.LA(2);
if ( (LA8_1==ID) && (synpred4_DRL5Expressions())) {
alt8=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA8_1==QUESTION) && (synpred4_DRL5Expressions())) {
alt8=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt8) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:55: ( typeArguments )=> typeArguments
{
pushFollow(FOLLOW_typeArguments_in_typeMatch602);
typeArguments();
state._fsp--;
if (state.failed) return;
}
break;
}
}
break;
default :
break loop9;
}
}
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:91: ( ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE )*
loop10:
while (true) {
int alt10=2;
int LA10_0 = input.LA(1);
if ( (LA10_0==LEFT_SQUARE) && (synpred5_DRL5Expressions())) {
alt10=1; // depends on control dependency: [if], data = [none]
}
switch (alt10) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL5Expressions.g:139:92: ( LEFT_SQUARE RIGHT_SQUARE )=> LEFT_SQUARE RIGHT_SQUARE
{
match(input,LEFT_SQUARE,FOLLOW_LEFT_SQUARE_in_typeMatch617); if (state.failed) return;
match(input,RIGHT_SQUARE,FOLLOW_RIGHT_SQUARE_in_typeMatch619); if (state.failed) return;
}
break;
default :
break loop10;
}
}
}
}
break;
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } |
public class class_name {
public Key generateSharedKey() throws KeyException {
javax.crypto.spec.SecretKeySpec sharedKey = null;
try {
if (crypto != null) {
try {
sharedKey = new javax.crypto.spec.SecretKeySpec(AuditCrypto.generate3DESKey(), 0, 24, "DESede");
} catch (Exception me) {
if (tc.isDebugEnabled())
Tr.debug(tc, "me.getMessage: " + me.getMessage());
}
}
if (sharedKey != null) {
return sharedKey;
} else {
throw new com.ibm.websphere.crypto.KeyException("Key could not be generated.");
}
} catch (Exception e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Error generating key.", new Object[] { e });
if (e instanceof KeyException)
throw (KeyException) e;
else
throw new KeyException(e.getMessage(), e);
}
} } | public class class_name {
public Key generateSharedKey() throws KeyException {
javax.crypto.spec.SecretKeySpec sharedKey = null;
try {
if (crypto != null) {
try {
sharedKey = new javax.crypto.spec.SecretKeySpec(AuditCrypto.generate3DESKey(), 0, 24, "DESede"); // depends on control dependency: [try], data = [none]
} catch (Exception me) {
if (tc.isDebugEnabled())
Tr.debug(tc, "me.getMessage: " + me.getMessage());
} // depends on control dependency: [catch], data = [none]
}
if (sharedKey != null) {
return sharedKey; // depends on control dependency: [if], data = [none]
} else {
throw new com.ibm.websphere.crypto.KeyException("Key could not be generated.");
}
} catch (Exception e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Error generating key.", new Object[] { e });
if (e instanceof KeyException)
throw (KeyException) e;
else
throw new KeyException(e.getMessage(), e);
}
} } |
public class class_name {
private static Collection<PropertyDescriptor> getPropertyDescriptors(Method[] methods) {
List<PropertyDescriptor> desciptorsHolder = new ArrayList<PropertyDescriptor>();
// Collects writeMetod and readMethod
for (Method method : methods) {
if (isStatic(method) || method.isSynthetic()) {
continue;
}
String name = method.getName();
if (method.getParameterTypes().length == 0) {
// Getter
if (name.length() > 3 && name.startsWith("get") && method.getReturnType() != void.class) {
PropertyDescriptor info = new PropertyDescriptor();
info.name = uncapitalize(name.substring(3));
info.readMethod = method;
info.isGetter = true;
desciptorsHolder.add(info);
}
// Isser
else if (name.length() > 2 && name.startsWith("is") && method.getReturnType() == boolean.class) {
PropertyDescriptor info = new PropertyDescriptor();
info.name = uncapitalize(name.substring(2));
info.readMethod = method;
info.isIsser = true;
desciptorsHolder.add(info);
}
} else if (method.getParameterTypes().length == 1) {
// Setter
if (name.length() > 3 && name.startsWith("set") && method.getReturnType() == void.class) {
PropertyDescriptor info = new PropertyDescriptor();
info.name = uncapitalize(name.substring(3));
info.writeMethod = method;
info.isSetter = true;
desciptorsHolder.add(info);
}
}
}
// Merges descriptors with the same name into a single entity
Map<String, PropertyDescriptor> descriptors = new HashMap<String, PropertyDescriptor>();
for (PropertyDescriptor descriptor : desciptorsHolder) {
PropertyDescriptor instance = descriptors.get(descriptor.name);
if (instance == null) {
descriptors.put(descriptor.name, descriptor);
instance = descriptor;
}
if (descriptor.isIsser) {
instance.readMethod = descriptor.readMethod;
} else if (descriptor.isGetter) {
// if both getter and isser methods are present as descriptors,
// the isser is chose as readMethod, and the getter discarded
if (instance.readMethod == null) {
instance.readMethod = descriptor.readMethod;
}
} else if (descriptor.isSetter) {
instance.writeMethod = descriptor.writeMethod;
}
}
return descriptors.values();
} } | public class class_name {
private static Collection<PropertyDescriptor> getPropertyDescriptors(Method[] methods) {
List<PropertyDescriptor> desciptorsHolder = new ArrayList<PropertyDescriptor>();
// Collects writeMetod and readMethod
for (Method method : methods) {
if (isStatic(method) || method.isSynthetic()) {
continue;
}
String name = method.getName();
if (method.getParameterTypes().length == 0) {
// Getter
if (name.length() > 3 && name.startsWith("get") && method.getReturnType() != void.class) {
PropertyDescriptor info = new PropertyDescriptor();
info.name = uncapitalize(name.substring(3)); // depends on control dependency: [if], data = [none]
info.readMethod = method; // depends on control dependency: [if], data = [none]
info.isGetter = true; // depends on control dependency: [if], data = [none]
desciptorsHolder.add(info); // depends on control dependency: [if], data = [none]
}
// Isser
else if (name.length() > 2 && name.startsWith("is") && method.getReturnType() == boolean.class) {
PropertyDescriptor info = new PropertyDescriptor();
info.name = uncapitalize(name.substring(2)); // depends on control dependency: [if], data = [none]
info.readMethod = method; // depends on control dependency: [if], data = [none]
info.isIsser = true; // depends on control dependency: [if], data = [none]
desciptorsHolder.add(info); // depends on control dependency: [if], data = [none]
}
} else if (method.getParameterTypes().length == 1) {
// Setter
if (name.length() > 3 && name.startsWith("set") && method.getReturnType() == void.class) {
PropertyDescriptor info = new PropertyDescriptor();
info.name = uncapitalize(name.substring(3)); // depends on control dependency: [if], data = [none]
info.writeMethod = method; // depends on control dependency: [if], data = [none]
info.isSetter = true; // depends on control dependency: [if], data = [none]
desciptorsHolder.add(info); // depends on control dependency: [if], data = [none]
}
}
}
// Merges descriptors with the same name into a single entity
Map<String, PropertyDescriptor> descriptors = new HashMap<String, PropertyDescriptor>();
for (PropertyDescriptor descriptor : desciptorsHolder) {
PropertyDescriptor instance = descriptors.get(descriptor.name);
if (instance == null) {
descriptors.put(descriptor.name, descriptor); // depends on control dependency: [if], data = [none]
instance = descriptor; // depends on control dependency: [if], data = [none]
}
if (descriptor.isIsser) {
instance.readMethod = descriptor.readMethod; // depends on control dependency: [if], data = [none]
} else if (descriptor.isGetter) {
// if both getter and isser methods are present as descriptors,
// the isser is chose as readMethod, and the getter discarded
if (instance.readMethod == null) {
instance.readMethod = descriptor.readMethod; // depends on control dependency: [if], data = [none]
}
} else if (descriptor.isSetter) {
instance.writeMethod = descriptor.writeMethod; // depends on control dependency: [if], data = [none]
}
}
return descriptors.values();
} } |
public class class_name {
public CmsDetailPageInfo getDefaultDetailPage() {
for (CmsDetailPageInfo detailpage : getAllDetailPages(true)) {
if (CmsADEManager.DEFAULT_DETAILPAGE_TYPE.equals(detailpage.getType())) {
return detailpage;
}
}
return null;
} } | public class class_name {
public CmsDetailPageInfo getDefaultDetailPage() {
for (CmsDetailPageInfo detailpage : getAllDetailPages(true)) {
if (CmsADEManager.DEFAULT_DETAILPAGE_TYPE.equals(detailpage.getType())) {
return detailpage; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
protected List<Cluster<M>> splitCluster(Cluster<M> parentCluster, Database database, Relation<V> relation) {
// Transform parent cluster into a clustering
ArrayList<Cluster<M>> parentClusterList = new ArrayList<Cluster<M>>(1);
parentClusterList.add(parentCluster);
if(parentCluster.size() <= 1) {
// Split is not possbile
return parentClusterList;
}
Clustering<M> parentClustering = new Clustering<>(parentCluster.getName(), parentCluster.getName(), parentClusterList);
ProxyDatabase proxyDB = new ProxyDatabase(parentCluster.getIDs(), database);
splitInitializer.setInitialMeans(splitCentroid(parentCluster, relation));
innerKMeans.setK(2);
Clustering<M> childClustering = innerKMeans.run(proxyDB);
double parentEvaluation = informationCriterion.quality(parentClustering, getDistanceFunction(), relation);
double childrenEvaluation = informationCriterion.quality(childClustering, getDistanceFunction(), relation);
if(LOG.isDebugging()) {
LOG.debug("parentEvaluation: " + parentEvaluation);
LOG.debug("childrenEvaluation: " + childrenEvaluation);
}
// Check if split is an improvement:
return informationCriterion.isBetter(parentEvaluation, childrenEvaluation) ? parentClusterList : childClustering.getAllClusters();
} } | public class class_name {
protected List<Cluster<M>> splitCluster(Cluster<M> parentCluster, Database database, Relation<V> relation) {
// Transform parent cluster into a clustering
ArrayList<Cluster<M>> parentClusterList = new ArrayList<Cluster<M>>(1);
parentClusterList.add(parentCluster);
if(parentCluster.size() <= 1) {
// Split is not possbile
return parentClusterList; // depends on control dependency: [if], data = [none]
}
Clustering<M> parentClustering = new Clustering<>(parentCluster.getName(), parentCluster.getName(), parentClusterList);
ProxyDatabase proxyDB = new ProxyDatabase(parentCluster.getIDs(), database);
splitInitializer.setInitialMeans(splitCentroid(parentCluster, relation));
innerKMeans.setK(2);
Clustering<M> childClustering = innerKMeans.run(proxyDB);
double parentEvaluation = informationCriterion.quality(parentClustering, getDistanceFunction(), relation);
double childrenEvaluation = informationCriterion.quality(childClustering, getDistanceFunction(), relation);
if(LOG.isDebugging()) {
LOG.debug("parentEvaluation: " + parentEvaluation); // depends on control dependency: [if], data = [none]
LOG.debug("childrenEvaluation: " + childrenEvaluation); // depends on control dependency: [if], data = [none]
}
// Check if split is an improvement:
return informationCriterion.isBetter(parentEvaluation, childrenEvaluation) ? parentClusterList : childClustering.getAllClusters();
} } |
public class class_name {
@SuppressWarnings("serial")
private Component createAddDescriptorButton() {
Button addDescriptorButton = CmsToolBar.createButton(
FontOpenCms.COPY_LOCALE,
m_messages.key(Messages.GUI_ADD_DESCRIPTOR_0));
addDescriptorButton.setDisableOnClick(true);
addDescriptorButton.addClickListener(new ClickListener() {
@SuppressWarnings("synthetic-access")
public void buttonClick(ClickEvent event) {
Map<Object, Object> filters = getFilters();
m_table.clearFilters();
if (!m_model.addDescriptor()) {
CmsVaadinUtils.showAlert(
m_messages.key(Messages.ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_0),
m_messages.key(Messages.ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_DESCRIPTION_0),
null);
} else {
IndexedContainer newContainer = null;
try {
newContainer = m_model.getContainerForCurrentLocale();
m_table.setContainerDataSource(newContainer);
initFieldFactories();
initStyleGenerators();
setEditMode(EditMode.MASTER);
m_table.setColumnCollapsingAllowed(true);
adjustVisibleColumns();
m_options.updateShownOptions(m_model.hasMasterMode(), m_model.canAddKeys());
m_options.setEditMode(m_model.getEditMode());
} catch (IOException | CmsException e) {
// Can never appear here, since container is created by addDescriptor already.
LOG.error(e.getLocalizedMessage(), e);
}
}
setFilters(filters);
}
});
return addDescriptorButton;
} } | public class class_name {
@SuppressWarnings("serial")
private Component createAddDescriptorButton() {
Button addDescriptorButton = CmsToolBar.createButton(
FontOpenCms.COPY_LOCALE,
m_messages.key(Messages.GUI_ADD_DESCRIPTOR_0));
addDescriptorButton.setDisableOnClick(true);
addDescriptorButton.addClickListener(new ClickListener() {
@SuppressWarnings("synthetic-access")
public void buttonClick(ClickEvent event) {
Map<Object, Object> filters = getFilters();
m_table.clearFilters();
if (!m_model.addDescriptor()) {
CmsVaadinUtils.showAlert(
m_messages.key(Messages.ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_0),
m_messages.key(Messages.ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_DESCRIPTION_0),
null); // depends on control dependency: [if], data = [none]
} else {
IndexedContainer newContainer = null;
try {
newContainer = m_model.getContainerForCurrentLocale(); // depends on control dependency: [try], data = [none]
m_table.setContainerDataSource(newContainer); // depends on control dependency: [try], data = [none]
initFieldFactories(); // depends on control dependency: [try], data = [none]
initStyleGenerators(); // depends on control dependency: [try], data = [none]
setEditMode(EditMode.MASTER); // depends on control dependency: [try], data = [none]
m_table.setColumnCollapsingAllowed(true); // depends on control dependency: [try], data = [none]
adjustVisibleColumns(); // depends on control dependency: [try], data = [none]
m_options.updateShownOptions(m_model.hasMasterMode(), m_model.canAddKeys()); // depends on control dependency: [try], data = [none]
m_options.setEditMode(m_model.getEditMode()); // depends on control dependency: [try], data = [none]
} catch (IOException | CmsException e) {
// Can never appear here, since container is created by addDescriptor already.
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
setFilters(filters);
}
});
return addDescriptorButton;
} } |
public class class_name {
public Object readOneScanData(ByteBuffer bos, NOWRadheader.Vinfo vinfo, String vName)
throws IOException, InvalidRangeException {
int doff = (int) vinfo.hoff;
int npixel = vinfo.yt * vinfo.xt;
byte[] rdata = null;
byte[] ldata = new byte[vinfo.xt];
byte[] pdata = new byte[npixel];
byte[] b2 = new byte[2];
bos.position(doff);
// begining of image data
if ((DataType.unsignedByteToShort(bos.get()) != 0xF0) || (bos.get() != 0x0C)) {
return null;
}
int ecode;
int color;
int datapos;
int offset = 0;
int roffset = 0;
boolean newline = true;
int linenum = 0;
while (true) {
// line number
if (newline) {
bos.get(b2);
linenum = (DataType.unsignedByteToShort(b2[1]) << 8) + DataType.unsignedByteToShort(b2[0]);
// System.out.println("Line Number = " + linenum);
}
// int linenum = bytesToInt(b2[0], b2[1], true);
// System.out.println("Line Number = " + linenum);
// if(linenum == 1225)
// System.out.println(" HHHHH");
short b = DataType.unsignedByteToShort(bos.get());
color = b & 0xF;
ecode = b >> 4;
datapos = bos.position();
int datarun;
if (ecode == 0xF) {
byte bb1 = bos.get(datapos - 2);
byte bb2 = bos.get(datapos);
if ((color == 0x0) && (bb1 == 0x00) && (bb2 == 0x00)) {
datapos += 1;
}
bos.position(datapos);
datarun = 0;
} else if (ecode == 0xE) {
byte b0 = bos.get(datapos);
datarun = DataType.unsignedByteToShort(b0) + 1;
datapos += 1;
bos.position(datapos);
} else if (ecode == 0xD) {
b2[0] = bos.get(datapos);
b2[1] = bos.get(datapos + 1);
datarun = (DataType.unsignedByteToShort(b2[1]) << 8) + DataType.unsignedByteToShort(b2[0]) + 1;
datapos += 2;
bos.position(datapos);
} else {
datarun = ecode + 1;
}
// move the unpacked data in the data line
rdata = new byte[datarun];
for (int i = 0; i < datarun; i++) {
rdata[i] = (byte) color;
}
System.arraycopy(rdata, 0, ldata, roffset, datarun);
roffset = roffset + datarun;
// System.out.println("run ecode = " + ecode + " and data run " + datarun + " and totalrun " + roffset);
// check to see if the beginning of the next line or at the end of the file
short c0 = DataType.unsignedByteToShort(bos.get());
if (c0 == 0x00) {
short c1 = DataType.unsignedByteToShort(bos.get());
short c2 = DataType.unsignedByteToShort(bos.get());
// System.out.println("c1 and c2 " + c1 + " " + c2);
if ((c0 == 0x00) && (c1 == 0xF0) && (c2 == 0x0C)) {
// beginning of next line
// System.out.println("linenum " + linenum + " and this line total " + roffset);
// if (roffset != 3661) {
// System.out.println("ERROR missing data, this line total only " + roffset);
// }
System.arraycopy(ldata, 0, pdata, offset, roffset);
offset = offset + vinfo.xt;
roffset = 0;
newline = true;
ldata = new byte[vinfo.xt];
} else if ((c1 == 0xF0) && (c2 == 0x02)) {
// end of the file
break;
} else {
datapos = bos.position() - 3;
bos.position(datapos);
newline = false;
}
} else {
newline = false;
datapos = bos.position();
bos.position(datapos - 1);
}
}
return pdata;
} } | public class class_name {
public Object readOneScanData(ByteBuffer bos, NOWRadheader.Vinfo vinfo, String vName)
throws IOException, InvalidRangeException {
int doff = (int) vinfo.hoff;
int npixel = vinfo.yt * vinfo.xt;
byte[] rdata = null;
byte[] ldata = new byte[vinfo.xt];
byte[] pdata = new byte[npixel];
byte[] b2 = new byte[2];
bos.position(doff);
// begining of image data
if ((DataType.unsignedByteToShort(bos.get()) != 0xF0) || (bos.get() != 0x0C)) {
return null;
}
int ecode;
int color;
int datapos;
int offset = 0;
int roffset = 0;
boolean newline = true;
int linenum = 0;
while (true) {
// line number
if (newline) {
bos.get(b2);
// depends on control dependency: [if], data = [none]
linenum = (DataType.unsignedByteToShort(b2[1]) << 8) + DataType.unsignedByteToShort(b2[0]);
// depends on control dependency: [if], data = [none]
// System.out.println("Line Number = " + linenum);
}
// int linenum = bytesToInt(b2[0], b2[1], true);
// System.out.println("Line Number = " + linenum);
// if(linenum == 1225)
// System.out.println(" HHHHH");
short b = DataType.unsignedByteToShort(bos.get());
color = b & 0xF;
ecode = b >> 4;
datapos = bos.position();
int datarun;
if (ecode == 0xF) {
byte bb1 = bos.get(datapos - 2);
byte bb2 = bos.get(datapos);
if ((color == 0x0) && (bb1 == 0x00) && (bb2 == 0x00)) {
datapos += 1;
// depends on control dependency: [if], data = [none]
}
bos.position(datapos);
// depends on control dependency: [if], data = [none]
datarun = 0;
// depends on control dependency: [if], data = [none]
} else if (ecode == 0xE) {
byte b0 = bos.get(datapos);
datarun = DataType.unsignedByteToShort(b0) + 1;
// depends on control dependency: [if], data = [none]
datapos += 1;
// depends on control dependency: [if], data = [none]
bos.position(datapos);
// depends on control dependency: [if], data = [none]
} else if (ecode == 0xD) {
b2[0] = bos.get(datapos);
// depends on control dependency: [if], data = [none]
b2[1] = bos.get(datapos + 1);
// depends on control dependency: [if], data = [none]
datarun = (DataType.unsignedByteToShort(b2[1]) << 8) + DataType.unsignedByteToShort(b2[0]) + 1;
// depends on control dependency: [if], data = [none]
datapos += 2;
// depends on control dependency: [if], data = [none]
bos.position(datapos);
// depends on control dependency: [if], data = [none]
} else {
datarun = ecode + 1;
// depends on control dependency: [if], data = [none]
}
// move the unpacked data in the data line
rdata = new byte[datarun];
for (int i = 0; i < datarun; i++) {
rdata[i] = (byte) color;
// depends on control dependency: [for], data = [i]
}
System.arraycopy(rdata, 0, ldata, roffset, datarun);
roffset = roffset + datarun;
// System.out.println("run ecode = " + ecode + " and data run " + datarun + " and totalrun " + roffset);
// check to see if the beginning of the next line or at the end of the file
short c0 = DataType.unsignedByteToShort(bos.get());
if (c0 == 0x00) {
short c1 = DataType.unsignedByteToShort(bos.get());
short c2 = DataType.unsignedByteToShort(bos.get());
// System.out.println("c1 and c2 " + c1 + " " + c2);
if ((c0 == 0x00) && (c1 == 0xF0) && (c2 == 0x0C)) {
// beginning of next line
// System.out.println("linenum " + linenum + " and this line total " + roffset);
// if (roffset != 3661) {
// System.out.println("ERROR missing data, this line total only " + roffset);
// }
System.arraycopy(ldata, 0, pdata, offset, roffset);
// depends on control dependency: [if], data = [none]
offset = offset + vinfo.xt;
// depends on control dependency: [if], data = [none]
roffset = 0;
// depends on control dependency: [if], data = [none]
newline = true;
// depends on control dependency: [if], data = [none]
ldata = new byte[vinfo.xt];
// depends on control dependency: [if], data = [none]
} else if ((c1 == 0xF0) && (c2 == 0x02)) {
// end of the file
break;
} else {
datapos = bos.position() - 3;
// depends on control dependency: [if], data = [none]
bos.position(datapos);
// depends on control dependency: [if], data = [none]
newline = false;
// depends on control dependency: [if], data = [none]
}
} else {
newline = false;
// depends on control dependency: [if], data = [none]
datapos = bos.position();
// depends on control dependency: [if], data = [none]
bos.position(datapos - 1);
// depends on control dependency: [if], data = [none]
}
}
return pdata;
} } |
public class class_name {
private Node tryOptimizeNameDeclaration(Node subtree) {
checkState(NodeUtil.isNameDeclaration(subtree));
Node left = subtree.getFirstChild();
if (left.isDestructuringLhs() && left.hasTwoChildren()) {
Node pattern = left.getFirstChild();
if (!pattern.hasChildren()) {
// `var [] = foo();` becomes `foo();`
Node value = left.getSecondChild();
subtree.replaceWith(IR.exprResult(value.detach()).srcref(value));
reportChangeToEnclosingScope(value);
}
}
return subtree;
} } | public class class_name {
private Node tryOptimizeNameDeclaration(Node subtree) {
checkState(NodeUtil.isNameDeclaration(subtree));
Node left = subtree.getFirstChild();
if (left.isDestructuringLhs() && left.hasTwoChildren()) {
Node pattern = left.getFirstChild();
if (!pattern.hasChildren()) {
// `var [] = foo();` becomes `foo();`
Node value = left.getSecondChild();
subtree.replaceWith(IR.exprResult(value.detach()).srcref(value)); // depends on control dependency: [if], data = [none]
reportChangeToEnclosingScope(value); // depends on control dependency: [if], data = [none]
}
}
return subtree;
} } |
public class class_name {
public void flip(final int x) {
final short hb = Util.highbits(x);
final int i = highLowContainer.getIndex(hb);
if (i >= 0) {
Container c = highLowContainer.getContainerAtIndex(i).flip(Util.lowbits(x));
if (!c.isEmpty()) {
highLowContainer.setContainerAtIndex(i, c);
} else {
highLowContainer.removeAtIndex(i);
}
} else {
final ArrayContainer newac = new ArrayContainer();
highLowContainer.insertNewKeyValueAt(-i - 1, hb, newac.add(Util.lowbits(x)));
}
} } | public class class_name {
public void flip(final int x) {
final short hb = Util.highbits(x);
final int i = highLowContainer.getIndex(hb);
if (i >= 0) {
Container c = highLowContainer.getContainerAtIndex(i).flip(Util.lowbits(x));
if (!c.isEmpty()) {
highLowContainer.setContainerAtIndex(i, c); // depends on control dependency: [if], data = [none]
} else {
highLowContainer.removeAtIndex(i); // depends on control dependency: [if], data = [none]
}
} else {
final ArrayContainer newac = new ArrayContainer();
highLowContainer.insertNewKeyValueAt(-i - 1, hb, newac.add(Util.lowbits(x))); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(NonCompliantResource nonCompliantResource, ProtocolMarshaller protocolMarshaller) {
if (nonCompliantResource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(nonCompliantResource.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(nonCompliantResource.getResourceIdentifier(), RESOURCEIDENTIFIER_BINDING);
protocolMarshaller.marshall(nonCompliantResource.getAdditionalInfo(), ADDITIONALINFO_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(NonCompliantResource nonCompliantResource, ProtocolMarshaller protocolMarshaller) {
if (nonCompliantResource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(nonCompliantResource.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(nonCompliantResource.getResourceIdentifier(), RESOURCEIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(nonCompliantResource.getAdditionalInfo(), ADDITIONALINFO_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 boolean hasFatalErrors() {
for (final TopicErrorDatabase.ErrorType type : errorTypes) {
if (TopicErrorDatabase.FATAL_ERROR_TYPES.contains(type)) {
return true;
}
}
return false;
} } | public class class_name {
public boolean hasFatalErrors() {
for (final TopicErrorDatabase.ErrorType type : errorTypes) {
if (TopicErrorDatabase.FATAL_ERROR_TYPES.contains(type)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public ClientFlakeIdGeneratorConfig findFlakeIdGeneratorConfig(String name) {
String baseName = getBaseName(name);
ClientFlakeIdGeneratorConfig config = lookupByPattern(configPatternMatcher, flakeIdGeneratorConfigMap, baseName);
if (config != null) {
return config;
}
return getFlakeIdGeneratorConfig("default");
} } | public class class_name {
public ClientFlakeIdGeneratorConfig findFlakeIdGeneratorConfig(String name) {
String baseName = getBaseName(name);
ClientFlakeIdGeneratorConfig config = lookupByPattern(configPatternMatcher, flakeIdGeneratorConfigMap, baseName);
if (config != null) {
return config; // depends on control dependency: [if], data = [none]
}
return getFlakeIdGeneratorConfig("default");
} } |
public class class_name {
public String getRFC2253Name(Map<String, String> oidMap) {
/* check for and return cached name */
if (oidMap.isEmpty()) {
if (rfc2253Dn != null) {
return rfc2253Dn;
} else {
rfc2253Dn = generateRFC2253DN(oidMap);
return rfc2253Dn;
}
}
return generateRFC2253DN(oidMap);
} } | public class class_name {
public String getRFC2253Name(Map<String, String> oidMap) {
/* check for and return cached name */
if (oidMap.isEmpty()) {
if (rfc2253Dn != null) {
return rfc2253Dn; // depends on control dependency: [if], data = [none]
} else {
rfc2253Dn = generateRFC2253DN(oidMap); // depends on control dependency: [if], data = [none]
return rfc2253Dn; // depends on control dependency: [if], data = [none]
}
}
return generateRFC2253DN(oidMap);
} } |
public class class_name {
public static String whereAllIfColumns(Class<?> entityClass, boolean empty, boolean useVersion) {
StringBuilder sql = new StringBuilder();
boolean hasLogicDelete = false;
sql.append("<where>");
//获取全部列
Set<EntityColumn> columnSet = EntityHelper.getColumns(entityClass);
EntityColumn logicDeleteColumn = SqlHelper.getLogicDeleteColumn(entityClass);
//当某个列有主键策略时,不需要考虑他的属性是否为空,因为如果为空,一定会根据主键策略给他生成一个值
for (EntityColumn column : columnSet) {
if (!useVersion || !column.getEntityField().isAnnotationPresent(Version.class)) {
// 逻辑删除,后面拼接逻辑删除字段的未删除条件
if (logicDeleteColumn != null && logicDeleteColumn == column) {
hasLogicDelete = true;
continue;
}
sql.append(getIfNotNull(column, " AND " + column.getColumnEqualsHolder(), empty));
}
}
if (useVersion) {
sql.append(whereVersion(entityClass));
}
if (hasLogicDelete) {
sql.append(whereLogicDelete(entityClass, false));
}
sql.append("</where>");
return sql.toString();
} } | public class class_name {
public static String whereAllIfColumns(Class<?> entityClass, boolean empty, boolean useVersion) {
StringBuilder sql = new StringBuilder();
boolean hasLogicDelete = false;
sql.append("<where>");
//获取全部列
Set<EntityColumn> columnSet = EntityHelper.getColumns(entityClass);
EntityColumn logicDeleteColumn = SqlHelper.getLogicDeleteColumn(entityClass);
//当某个列有主键策略时,不需要考虑他的属性是否为空,因为如果为空,一定会根据主键策略给他生成一个值
for (EntityColumn column : columnSet) {
if (!useVersion || !column.getEntityField().isAnnotationPresent(Version.class)) {
// 逻辑删除,后面拼接逻辑删除字段的未删除条件
if (logicDeleteColumn != null && logicDeleteColumn == column) {
hasLogicDelete = true; // depends on control dependency: [if], data = [none]
continue;
}
sql.append(getIfNotNull(column, " AND " + column.getColumnEqualsHolder(), empty)); // depends on control dependency: [if], data = [none]
}
}
if (useVersion) {
sql.append(whereVersion(entityClass)); // depends on control dependency: [if], data = [none]
}
if (hasLogicDelete) {
sql.append(whereLogicDelete(entityClass, false)); // depends on control dependency: [if], data = [none]
}
sql.append("</where>");
return sql.toString();
} } |
public class class_name {
public static void initUBL21 (@Nonnull final ValidationExecutorSetRegistry aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");
// For better error messages
LocationBeautifierSPI.addMappings (UBL21NamespaceContext.getInstance ());
final boolean bNotDeprecated = false;
for (final EUBL21DocumentType e : EUBL21DocumentType.values ())
{
final String sName = e.getLocalName ();
final VESID aVESID = new VESID (GROUP_ID, sName.toLowerCase (Locale.US), VERSION_21);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"UBL " + sName + " " + VERSION_21,
bNotDeprecated,
ValidationExecutorXSD.create (e)));
}
} } | public class class_name {
public static void initUBL21 (@Nonnull final ValidationExecutorSetRegistry aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");
// For better error messages
LocationBeautifierSPI.addMappings (UBL21NamespaceContext.getInstance ());
final boolean bNotDeprecated = false;
for (final EUBL21DocumentType e : EUBL21DocumentType.values ())
{
final String sName = e.getLocalName ();
final VESID aVESID = new VESID (GROUP_ID, sName.toLowerCase (Locale.US), VERSION_21);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"UBL " + sName + " " + VERSION_21,
bNotDeprecated,
ValidationExecutorXSD.create (e))); // depends on control dependency: [for], data = [e]
}
} } |
public class class_name {
public T get(String name) {
if (m_items == null) {
return null;
}
return m_items.get(name.toUpperCase());
} } | public class class_name {
public T get(String name) {
if (m_items == null) {
return null; // depends on control dependency: [if], data = [none]
}
return m_items.get(name.toUpperCase());
} } |
public class class_name {
@GwtIncompatible("incompatible method")
public EqualsBuilder reflectionAppend(final Object lhs, final Object rhs) {
if (!isEquals) {
return this;
}
if (lhs == rhs) {
return this;
}
if (lhs == null || rhs == null) {
isEquals = false;
return this;
}
// Find the leaf class since there may be transients in the leaf
// class or in classes between the leaf and root.
// If we are not testing transients or a subclass has no ivars,
// then a subclass can test equals to a superclass.
final Class<?> lhsClass = lhs.getClass();
final Class<?> rhsClass = rhs.getClass();
Class<?> testClass;
if (lhsClass.isInstance(rhs)) {
testClass = lhsClass;
if (!rhsClass.isInstance(lhs)) {
// rhsClass is a subclass of lhsClass
testClass = rhsClass;
}
} else if (rhsClass.isInstance(lhs)) {
testClass = rhsClass;
if (!lhsClass.isInstance(rhs)) {
// lhsClass is a subclass of rhsClass
testClass = lhsClass;
}
} else {
// The two classes are not related.
isEquals = false;
return this;
}
try {
if (testClass.isArray()) {
append(lhs, rhs);
} else {
reflectionAppend(lhs, rhs, testClass);
while (testClass.getSuperclass() != null && testClass != reflectUpToClass) {
testClass = testClass.getSuperclass();
reflectionAppend(lhs, rhs, testClass);
}
}
} catch (final IllegalArgumentException e) {
// In this case, we tried to test a subclass vs. a superclass and
// the subclass has ivars or the ivars are transient and
// we are testing transients.
// If a subclass has ivars that we are trying to test them, we get an
// exception and we know that the objects are not equal.
isEquals = false;
return this;
}
return this;
} } | public class class_name {
@GwtIncompatible("incompatible method")
public EqualsBuilder reflectionAppend(final Object lhs, final Object rhs) {
if (!isEquals) {
return this; // depends on control dependency: [if], data = [none]
}
if (lhs == rhs) {
return this; // depends on control dependency: [if], data = [none]
}
if (lhs == null || rhs == null) {
isEquals = false; // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
}
// Find the leaf class since there may be transients in the leaf
// class or in classes between the leaf and root.
// If we are not testing transients or a subclass has no ivars,
// then a subclass can test equals to a superclass.
final Class<?> lhsClass = lhs.getClass();
final Class<?> rhsClass = rhs.getClass();
Class<?> testClass;
if (lhsClass.isInstance(rhs)) {
testClass = lhsClass;
if (!rhsClass.isInstance(lhs)) {
// rhsClass is a subclass of lhsClass
testClass = rhsClass;
}
} else if (rhsClass.isInstance(lhs)) {
testClass = rhsClass;
if (!lhsClass.isInstance(rhs)) {
// lhsClass is a subclass of rhsClass
testClass = lhsClass; // depends on control dependency: [if], data = [none]
}
} else {
// The two classes are not related.
isEquals = false;
return this;
}
try {
if (testClass.isArray()) {
append(lhs, rhs); // depends on control dependency: [if], data = [none]
} else {
reflectionAppend(lhs, rhs, testClass); // depends on control dependency: [if], data = [none]
while (testClass.getSuperclass() != null && testClass != reflectUpToClass) {
testClass = testClass.getSuperclass(); // depends on control dependency: [while], data = [none]
reflectionAppend(lhs, rhs, testClass); // depends on control dependency: [while], data = [none]
}
}
} catch (final IllegalArgumentException e) {
// In this case, we tried to test a subclass vs. a superclass and
// the subclass has ivars or the ivars are transient and
// we are testing transients.
// If a subclass has ivars that we are trying to test them, we get an
// exception and we know that the objects are not equal.
isEquals = false;
return this;
} // depends on control dependency: [catch], data = [none]
return this;
} } |
public class class_name {
protected void removeConnection(FTPConnection con) throws IOException {
synchronized(listeners) {
for(IFTPListener l : listeners) {
l.onDisconnected(con);
}
}
synchronized(connections) {
connections.remove(con);
}
} } | public class class_name {
protected void removeConnection(FTPConnection con) throws IOException {
synchronized(listeners) {
for(IFTPListener l : listeners) {
l.onDisconnected(con); // depends on control dependency: [for], data = [l]
}
}
synchronized(connections) {
connections.remove(con);
}
} } |
public class class_name {
private static Number toNumber(Object object) {
if (object instanceof Number) {
return (Number) object;
}
if (object instanceof String) {
return Float.valueOf((String) object);
}
throw new IllegalArgumentException("Use number or string");
} } | public class class_name {
private static Number toNumber(Object object) {
if (object instanceof Number) {
return (Number) object; // depends on control dependency: [if], data = [none]
}
if (object instanceof String) {
return Float.valueOf((String) object); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("Use number or string");
} } |
public class class_name {
private void recalcFromBoundingBox() {
if (debugRecalc) {
System.out.println("Navigation recalcFromBoundingBox= "+ bb);
System.out.println(" "+ pwidth +" "+ pheight);
}
// decide which dimension is limiting
double pixx_per_wx = (bb.getWidth() == 0.0) ? 1 : pwidth / bb.getWidth();
double pixy_per_wy = (bb.getHeight() == 0.0) ? 1 : pheight / bb.getHeight();
pix_per_world = Math.min(pixx_per_wx, pixy_per_wy);
// calc the center point
double wx0 = bb.getX() + bb.getWidth()/2;
double wy0 = bb.getY() + bb.getHeight()/2;
// calc offset based on center point
pix_x0 = pwidth/2 - pix_per_world * wx0;
pix_y0 = pheight/2 + pix_per_world * wy0;
if (debugRecalc) {
System.out.println("Navigation recalcFromBoundingBox done= "+ pix_per_world +" "+ pix_x0+" "+ pix_y0);
System.out.println(" "+ pwidth +" "+ pheight+" "+ bb);
}
} } | public class class_name {
private void recalcFromBoundingBox() {
if (debugRecalc) {
System.out.println("Navigation recalcFromBoundingBox= "+ bb); // depends on control dependency: [if], data = [none]
System.out.println(" "+ pwidth +" "+ pheight); // depends on control dependency: [if], data = [none]
}
// decide which dimension is limiting
double pixx_per_wx = (bb.getWidth() == 0.0) ? 1 : pwidth / bb.getWidth();
double pixy_per_wy = (bb.getHeight() == 0.0) ? 1 : pheight / bb.getHeight();
pix_per_world = Math.min(pixx_per_wx, pixy_per_wy);
// calc the center point
double wx0 = bb.getX() + bb.getWidth()/2;
double wy0 = bb.getY() + bb.getHeight()/2;
// calc offset based on center point
pix_x0 = pwidth/2 - pix_per_world * wx0;
pix_y0 = pheight/2 + pix_per_world * wy0;
if (debugRecalc) {
System.out.println("Navigation recalcFromBoundingBox done= "+ pix_per_world +" "+ pix_x0+" "+ pix_y0); // depends on control dependency: [if], data = [none]
System.out.println(" "+ pwidth +" "+ pheight+" "+ bb); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addHeuristicCpuCost(double cost) {
if (cost <= 0) {
throw new IllegalArgumentException("Heuristic costs must be positive.");
}
this.heuristicCpuCost += cost;
// check for overflow
if (this.heuristicCpuCost < 0) {
this.heuristicCpuCost = Double.MAX_VALUE;
}
} } | public class class_name {
public void addHeuristicCpuCost(double cost) {
if (cost <= 0) {
throw new IllegalArgumentException("Heuristic costs must be positive.");
}
this.heuristicCpuCost += cost;
// check for overflow
if (this.heuristicCpuCost < 0) {
this.heuristicCpuCost = Double.MAX_VALUE; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void restoreAllMockEc2Instances(final Collection<AbstractMockEc2Instance> instances) {
allMockEc2Instances.clear();
if (null != instances) {
for (AbstractMockEc2Instance instance : instances) {
allMockEc2Instances.put(instance.getInstanceID(), instance);
// re-initialize the internal timer
instance.initializeInternalTimer();
}
}
} } | public class class_name {
public void restoreAllMockEc2Instances(final Collection<AbstractMockEc2Instance> instances) {
allMockEc2Instances.clear();
if (null != instances) {
for (AbstractMockEc2Instance instance : instances) {
allMockEc2Instances.put(instance.getInstanceID(), instance); // depends on control dependency: [for], data = [instance]
// re-initialize the internal timer
instance.initializeInternalTimer(); // depends on control dependency: [for], data = [instance]
}
}
} } |
public class class_name {
@Override
public void initialize(ExtensionContext context) {
final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(new NamingSubsystemRootResourceDefinition());
registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
registration.registerSubModel(NamingBindingResourceDefinition.INSTANCE);
registration.registerSubModel(RemoteNamingResourceDefinition.INSTANCE);
if (context.isRuntimeOnlyRegistrationValid()) {
registration.registerOperationHandler(NamingSubsystemRootResourceDefinition.JNDI_VIEW, JndiViewOperation.INSTANCE, false);
}
subsystem.registerXMLElementWriter(NamingSubsystemXMLPersister.INSTANCE);
} } | public class class_name {
@Override
public void initialize(ExtensionContext context) {
final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(new NamingSubsystemRootResourceDefinition());
registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
registration.registerSubModel(NamingBindingResourceDefinition.INSTANCE);
registration.registerSubModel(RemoteNamingResourceDefinition.INSTANCE);
if (context.isRuntimeOnlyRegistrationValid()) {
registration.registerOperationHandler(NamingSubsystemRootResourceDefinition.JNDI_VIEW, JndiViewOperation.INSTANCE, false); // depends on control dependency: [if], data = [none]
}
subsystem.registerXMLElementWriter(NamingSubsystemXMLPersister.INSTANCE);
} } |
public class class_name {
public static void dump(Appendable appendable, Iterable<?> items) {
try {
for(Object item: items) {
appendable.append(String.valueOf(item));
appendable.append("\n");
}
} catch (IOException e) {
throw new RuntimeException("An error occured while appending", e);
}
} } | public class class_name {
public static void dump(Appendable appendable, Iterable<?> items) {
try {
for(Object item: items) {
appendable.append(String.valueOf(item)); // depends on control dependency: [for], data = [item]
appendable.append("\n"); // depends on control dependency: [for], data = [none]
}
} catch (IOException e) {
throw new RuntimeException("An error occured while appending", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public HtmlTree getStyleSheetProperties() {
String filename = configuration.stylesheetfile;
DocPath stylesheet;
if (filename.length() > 0) {
DocFile file = DocFile.createFileForInput(configuration, filename);
stylesheet = DocPath.create(file.getName());
} else {
stylesheet = DocPaths.STYLESHEET;
}
DocPath p = relativePath.resolve(stylesheet);
HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", p.getPath(), "Style");
return link;
} } | public class class_name {
public HtmlTree getStyleSheetProperties() {
String filename = configuration.stylesheetfile;
DocPath stylesheet;
if (filename.length() > 0) {
DocFile file = DocFile.createFileForInput(configuration, filename);
stylesheet = DocPath.create(file.getName()); // depends on control dependency: [if], data = [none]
} else {
stylesheet = DocPaths.STYLESHEET; // depends on control dependency: [if], data = [none]
}
DocPath p = relativePath.resolve(stylesheet);
HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", p.getPath(), "Style");
return link;
} } |
public class class_name {
public static Long nextLong() {
long randomLong = RANDOM.nextLong();
if (randomLong < 0) {
randomLong = randomLong + 1;
randomLong = Math.abs(randomLong);
}
return randomLong;
} } | public class class_name {
public static Long nextLong() {
long randomLong = RANDOM.nextLong();
if (randomLong < 0) {
randomLong = randomLong + 1; // depends on control dependency: [if], data = [none]
randomLong = Math.abs(randomLong); // depends on control dependency: [if], data = [(randomLong]
}
return randomLong;
} } |
public class class_name {
public static void runAsApplication(Game game, int width, int height, boolean fullscreen) {
try {
AppGameContainer container = new AppGameContainer(game, width, height, fullscreen);
container.start();
} catch (Exception e) {
e.printStackTrace();
}
} } | public class class_name {
public static void runAsApplication(Game game, int width, int height, boolean fullscreen) {
try {
AppGameContainer container = new AppGameContainer(game, width, height, fullscreen);
container.start();
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String htmlEncode(String value) {
if (value == null) {
return "";
}
return value
.replace("&", "&")
.replace("<", "<")
.replace(">", ">")
.replace("\"", """)
.replace("'", "'")
.replace("/", "/")
;
} } | public class class_name {
public static String htmlEncode(String value) {
if (value == null) {
return ""; // depends on control dependency: [if], data = [none]
}
return value
.replace("&", "&")
.replace("<", "<")
.replace(">", ">")
.replace("\"", """)
.replace("'", "'")
.replace("/", "/")
;
} } |
public class class_name {
public void remove(DepTreeNode child) {
if (children != null) {
DepTreeNode node = children.get(child.getName());
if (node == child) {
children.remove(child.getName());
}
}
child.setParent(null);
} } | public class class_name {
public void remove(DepTreeNode child) {
if (children != null) {
DepTreeNode node = children.get(child.getName());
if (node == child) {
children.remove(child.getName());
// depends on control dependency: [if], data = [none]
}
}
child.setParent(null);
} } |
public class class_name {
@Override
public void writeTo(ByteBuffer buffer) {
//field->id
int id=0;
id=getId();
buffer.writeInt(id);
//field->name
String name=null;
name=getName();
if (name!=null){
buffer.writeBoolean(true);
buffer.writeUTF(name);
}else{ buffer.writeBoolean(false);}
//field->time
Date time=null;
time=getTime();
if (time!=null){
buffer.writeBoolean(true);
buffer.writeLong(time.getTime());
}else{ buffer.writeBoolean(false);}
//field->age
Integer age=null;
age=getAge();
if (age!=null){
buffer.writeBoolean(true);
buffer.writeInt(age);
}else{ buffer.writeBoolean(false);}
//field->array
int[] array=null;
array=getArray();
if (array!=null){
buffer.writeBoolean(true);
int array_l=array.length;
buffer.writeInt(array_l);
for(int array_i=0;array_i<array_l;array_i++){
int array_d=array[array_i];
buffer.writeInt(array_d);
}
}else{ buffer.writeBoolean(false);}
//field->listArray
List<int[]> listArray=null;
listArray=getListArray();
if (listArray!=null){
buffer.writeBoolean(true);
int listArray_ls=listArray.size();
buffer.writeInt(listArray_ls);
for(int[] listArray_lv:listArray){
int listArray_lv_l=listArray_lv.length;
buffer.writeInt(listArray_lv_l);
for(int listArray_lv_i=0;listArray_lv_i<listArray_lv_l;listArray_lv_i++){
int listArray_lv_d=listArray_lv[listArray_lv_i];
buffer.writeInt(listArray_lv_d);
}
}
}else{ buffer.writeBoolean(false);}
//field->setArray
Set<java.lang.Integer[]> setArray=null;
setArray=getSetArray();
if (setArray!=null){
buffer.writeBoolean(true);
int setArray_ls=setArray.size();
buffer.writeInt(setArray_ls);
for(Integer[] setArray_lv:setArray){
int setArray_lv_l=setArray_lv.length;
buffer.writeInt(setArray_lv_l);
for(int setArray_lv_i=0;setArray_lv_i<setArray_lv_l;setArray_lv_i++){
Integer setArray_lv_d=setArray_lv[setArray_lv_i];
buffer.writeInt(setArray_lv_d);
}
}
}else{ buffer.writeBoolean(false);}
//field->queues
Queue<java.lang.Byte[]> queues=null;
queues=getQueues();
if (queues!=null){
buffer.writeBoolean(true);
int queues_ls=queues.size();
buffer.writeInt(queues_ls);
for(Byte[] queues_lv:queues){
int queues_lv_l=queues_lv.length;
buffer.writeInt(queues_lv_l);
for(int queues_lv_i=0;queues_lv_i<queues_lv_l;queues_lv_i++){
Byte queues_lv_d=queues_lv[queues_lv_i];
buffer.writeByte(queues_lv_d);
}
}
}else{ buffer.writeBoolean(false);}
//field->map
Map<java.util.List<int[]>,java.util.Set<java.lang.Integer>> map=null;
map=getMap();
if (map!=null){
buffer.writeBoolean(true);
int map_ms=map.size();
buffer.writeInt(map_ms);
for(List<int[]> map_mk:map.keySet()){
Set<java.lang.Integer> map_mv=map.get(map_mk);
int map_mk_ls=map_mk.size();
buffer.writeInt(map_mk_ls);
for(int[] map_mk_lv:map_mk){
int map_mk_lv_l=map_mk_lv.length;
buffer.writeInt(map_mk_lv_l);
for(int map_mk_lv_i=0;map_mk_lv_i<map_mk_lv_l;map_mk_lv_i++){
int map_mk_lv_d=map_mk_lv[map_mk_lv_i];
buffer.writeInt(map_mk_lv_d);
}
}
int map_mv_ls=map_mv.size();
buffer.writeInt(map_mv_ls);
for(Integer map_mv_lv:map_mv){
buffer.writeInt(map_mv_lv);
}
}
}else{ buffer.writeBoolean(false);}
} } | public class class_name {
@Override
public void writeTo(ByteBuffer buffer) {
//field->id
int id=0;
id=getId();
buffer.writeInt(id);
//field->name
String name=null;
name=getName();
if (name!=null){
buffer.writeBoolean(true); // depends on control dependency: [if], data = [none]
buffer.writeUTF(name); // depends on control dependency: [if], data = [(name]
}else{ buffer.writeBoolean(false);} // depends on control dependency: [if], data = [none]
//field->time
Date time=null;
time=getTime();
if (time!=null){
buffer.writeBoolean(true); // depends on control dependency: [if], data = [none]
buffer.writeLong(time.getTime()); // depends on control dependency: [if], data = [(time]
}else{ buffer.writeBoolean(false);} // depends on control dependency: [if], data = [none]
//field->age
Integer age=null;
age=getAge();
if (age!=null){
buffer.writeBoolean(true); // depends on control dependency: [if], data = [none]
buffer.writeInt(age); // depends on control dependency: [if], data = [(age]
}else{ buffer.writeBoolean(false);} // depends on control dependency: [if], data = [none]
//field->array
int[] array=null;
array=getArray();
if (array!=null){
buffer.writeBoolean(true); // depends on control dependency: [if], data = [none]
int array_l=array.length;
buffer.writeInt(array_l); // depends on control dependency: [if], data = [(array]
for(int array_i=0;array_i<array_l;array_i++){
int array_d=array[array_i];
buffer.writeInt(array_d); // depends on control dependency: [for], data = [none]
}
}else{ buffer.writeBoolean(false);} // depends on control dependency: [if], data = [none]
//field->listArray
List<int[]> listArray=null;
listArray=getListArray();
if (listArray!=null){
buffer.writeBoolean(true); // depends on control dependency: [if], data = [none]
int listArray_ls=listArray.size();
buffer.writeInt(listArray_ls); // depends on control dependency: [if], data = [(listArray]
for(int[] listArray_lv:listArray){
int listArray_lv_l=listArray_lv.length;
buffer.writeInt(listArray_lv_l); // depends on control dependency: [for], data = [listArray_lv]
for(int listArray_lv_i=0;listArray_lv_i<listArray_lv_l;listArray_lv_i++){
int listArray_lv_d=listArray_lv[listArray_lv_i];
buffer.writeInt(listArray_lv_d); // depends on control dependency: [for], data = [none]
}
}
}else{ buffer.writeBoolean(false);} // depends on control dependency: [if], data = [none]
//field->setArray
Set<java.lang.Integer[]> setArray=null;
setArray=getSetArray();
if (setArray!=null){
buffer.writeBoolean(true); // depends on control dependency: [if], data = [none]
int setArray_ls=setArray.size();
buffer.writeInt(setArray_ls); // depends on control dependency: [if], data = [(setArray]
for(Integer[] setArray_lv:setArray){
int setArray_lv_l=setArray_lv.length;
buffer.writeInt(setArray_lv_l); // depends on control dependency: [for], data = [setArray_lv]
for(int setArray_lv_i=0;setArray_lv_i<setArray_lv_l;setArray_lv_i++){
Integer setArray_lv_d=setArray_lv[setArray_lv_i];
buffer.writeInt(setArray_lv_d); // depends on control dependency: [for], data = [none]
}
}
}else{ buffer.writeBoolean(false);} // depends on control dependency: [if], data = [none]
//field->queues
Queue<java.lang.Byte[]> queues=null;
queues=getQueues();
if (queues!=null){
buffer.writeBoolean(true); // depends on control dependency: [if], data = [none]
int queues_ls=queues.size();
buffer.writeInt(queues_ls); // depends on control dependency: [if], data = [(queues]
for(Byte[] queues_lv:queues){
int queues_lv_l=queues_lv.length;
buffer.writeInt(queues_lv_l); // depends on control dependency: [for], data = [queues_lv]
for(int queues_lv_i=0;queues_lv_i<queues_lv_l;queues_lv_i++){
Byte queues_lv_d=queues_lv[queues_lv_i];
buffer.writeByte(queues_lv_d); // depends on control dependency: [for], data = [none]
}
}
}else{ buffer.writeBoolean(false);} // depends on control dependency: [if], data = [none]
//field->map
Map<java.util.List<int[]>,java.util.Set<java.lang.Integer>> map=null;
map=getMap();
if (map!=null){
buffer.writeBoolean(true); // depends on control dependency: [if], data = [none]
int map_ms=map.size();
buffer.writeInt(map_ms); // depends on control dependency: [if], data = [(map]
for(List<int[]> map_mk:map.keySet()){
Set<java.lang.Integer> map_mv=map.get(map_mk);
int map_mk_ls=map_mk.size();
buffer.writeInt(map_mk_ls); // depends on control dependency: [for], data = [map_mk]
for(int[] map_mk_lv:map_mk){
int map_mk_lv_l=map_mk_lv.length;
buffer.writeInt(map_mk_lv_l); // depends on control dependency: [for], data = [map_mk_lv]
for(int map_mk_lv_i=0;map_mk_lv_i<map_mk_lv_l;map_mk_lv_i++){
int map_mk_lv_d=map_mk_lv[map_mk_lv_i];
buffer.writeInt(map_mk_lv_d); // depends on control dependency: [for], data = [none]
}
}
int map_mv_ls=map_mv.size();
buffer.writeInt(map_mv_ls); // depends on control dependency: [for], data = [none]
for(Integer map_mv_lv:map_mv){
buffer.writeInt(map_mv_lv); // depends on control dependency: [for], data = [map_mv_lv]
}
}
}else{ buffer.writeBoolean(false);} // depends on control dependency: [if], data = [none]
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.