code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public void mouseClicked(final MouseEvent mouseEvent) {
if (mouseEvent.getSource() instanceof Node) {
// Send Event Selected Wave
model().sendWave(EditorWaves.DO_SELECT_EVENT,
WBuilder.waveData(PropertiesWaves.EVENT_OBJECT, model().getEventModel()));
}
} } | public class class_name {
@Override
public void mouseClicked(final MouseEvent mouseEvent) {
if (mouseEvent.getSource() instanceof Node) {
// Send Event Selected Wave
model().sendWave(EditorWaves.DO_SELECT_EVENT,
WBuilder.waveData(PropertiesWaves.EVENT_OBJECT, model().getEventModel())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public java.util.List<InstanceTypeSpecification> getInstanceTypeSpecifications() {
if (instanceTypeSpecifications == null) {
instanceTypeSpecifications = new com.amazonaws.internal.SdkInternalList<InstanceTypeSpecification>();
}
return instanceTypeSpecifications;
} } | public class class_name {
public java.util.List<InstanceTypeSpecification> getInstanceTypeSpecifications() {
if (instanceTypeSpecifications == null) {
instanceTypeSpecifications = new com.amazonaws.internal.SdkInternalList<InstanceTypeSpecification>(); // depends on control dependency: [if], data = [none]
}
return instanceTypeSpecifications;
} } |
public class class_name {
public String getReport() {
StringBuffer info = new StringBuffer();
if (!isCachingEnabled()) {
info.append("cache behaviour: DISABLED\n");
} else if (isCachingPermanent()) {
info.append("cache behaviour: PERMANENT\n");
} else {
info.append("cache behaviour: NORMAL\n");
}
info.append("time to live: " + ttlInSeconds + " s\n");
info.append("cleanup interval: " + cleanupInterval + " s\n");
info.append("cache size: " + data.size() + " objects\n");
info.append("cache mirror size: " + mirror.size() + " object(s)\n");
info.append("cache hits: " + hits + '\n');
info.append("cache misses: " + misses + '\n');
info.append("cache unavailable: " + unavailable + '\n');
info.append("cache delayed hits: " + delayedHits + '\n');
info.append("cache delayed misses: " + delayedMisses + '\n');
info.append("next cleanup run: " + new Date(lastRun.getTime() + (cleanupInterval * 1000)) + "\n");
return info.toString();
} } | public class class_name {
public String getReport() {
StringBuffer info = new StringBuffer();
if (!isCachingEnabled()) {
info.append("cache behaviour: DISABLED\n"); // depends on control dependency: [if], data = [none]
} else if (isCachingPermanent()) {
info.append("cache behaviour: PERMANENT\n"); // depends on control dependency: [if], data = [none]
} else {
info.append("cache behaviour: NORMAL\n"); // depends on control dependency: [if], data = [none]
}
info.append("time to live: " + ttlInSeconds + " s\n");
info.append("cleanup interval: " + cleanupInterval + " s\n");
info.append("cache size: " + data.size() + " objects\n");
info.append("cache mirror size: " + mirror.size() + " object(s)\n");
info.append("cache hits: " + hits + '\n');
info.append("cache misses: " + misses + '\n');
info.append("cache unavailable: " + unavailable + '\n');
info.append("cache delayed hits: " + delayedHits + '\n');
info.append("cache delayed misses: " + delayedMisses + '\n');
info.append("next cleanup run: " + new Date(lastRun.getTime() + (cleanupInterval * 1000)) + "\n");
return info.toString();
} } |
public class class_name {
private List<LocalVariable> decodePropertyStates(CodeAssembler a, LocalVariable encodedVar,
int offset, StorableProperty<S>[] properties)
{
Vector<LocalVariable> stateVars = new Vector<LocalVariable>();
LocalVariable accumVar = a.createLocalVariable(null, TypeDesc.INT);
int accumShift = 8;
for (int i=0; i<properties.length; i++) {
StorableProperty<S> property = properties[i];
int stateVarOrdinal = property.getNumber() >> 4;
stateVars.setSize(Math.max(stateVars.size(), stateVarOrdinal + 1));
if (stateVars.get(stateVarOrdinal) == null) {
stateVars.set(stateVarOrdinal, a.createLocalVariable(null, TypeDesc.INT));
a.loadThis();
a.loadField(PROPERTY_STATE_FIELD_NAME + stateVarOrdinal, TypeDesc.INT);
a.storeLocal(stateVars.get(stateVarOrdinal));
}
if (accumShift >= 8) {
// Load accumulator byte.
a.loadLocal(encodedVar);
a.loadConstant(offset++);
a.loadFromArray(TypeDesc.BYTE);
a.loadConstant(0xff);
a.math(Opcode.IAND);
a.storeLocal(accumVar);
accumShift = 0;
}
int stateShift = (property.getNumber() & 0xf) * 2;
int accumPack = 2;
int mask = PROPERTY_STATE_MASK << stateShift;
// Try to pack more state properties into one operation.
while ((accumShift + accumPack) < 8) {
if (i + 1 >= properties.length) {
// No more properties to encode.
break;
}
StorableProperty<S> nextProperty = properties[i + 1];
if (property.getNumber() + 1 != nextProperty.getNumber()) {
// Properties are not consecutive.
break;
}
if (stateVarOrdinal != (nextProperty.getNumber() >> 4)) {
// Property states are stored in different fields.
break;
}
accumPack += 2;
mask |= PROPERTY_STATE_MASK << ((nextProperty.getNumber() & 0xf) * 2);
property = nextProperty;
i++;
}
a.loadLocal(accumVar);
if (stateShift < accumShift) {
a.loadConstant(accumShift - stateShift);
a.math(Opcode.IUSHR);
} else if (stateShift > accumShift) {
a.loadConstant(stateShift - accumShift);
a.math(Opcode.ISHL);
}
a.loadConstant(mask);
a.math(Opcode.IAND);
a.loadLocal(stateVars.get(stateVarOrdinal));
a.loadConstant(~mask);
a.math(Opcode.IAND);
a.math(Opcode.IOR);
a.storeLocal(stateVars.get(stateVarOrdinal));
accumShift += accumPack;
}
return stateVars;
} } | public class class_name {
private List<LocalVariable> decodePropertyStates(CodeAssembler a, LocalVariable encodedVar,
int offset, StorableProperty<S>[] properties)
{
Vector<LocalVariable> stateVars = new Vector<LocalVariable>();
LocalVariable accumVar = a.createLocalVariable(null, TypeDesc.INT);
int accumShift = 8;
for (int i=0; i<properties.length; i++) {
StorableProperty<S> property = properties[i];
int stateVarOrdinal = property.getNumber() >> 4;
stateVars.setSize(Math.max(stateVars.size(), stateVarOrdinal + 1));
// depends on control dependency: [for], data = [none]
if (stateVars.get(stateVarOrdinal) == null) {
stateVars.set(stateVarOrdinal, a.createLocalVariable(null, TypeDesc.INT));
// depends on control dependency: [if], data = [none]
a.loadThis();
// depends on control dependency: [if], data = [none]
a.loadField(PROPERTY_STATE_FIELD_NAME + stateVarOrdinal, TypeDesc.INT);
// depends on control dependency: [if], data = [none]
a.storeLocal(stateVars.get(stateVarOrdinal));
// depends on control dependency: [if], data = [(stateVars.get(stateVarOrdinal)]
}
if (accumShift >= 8) {
// Load accumulator byte.
a.loadLocal(encodedVar);
// depends on control dependency: [if], data = [none]
a.loadConstant(offset++);
// depends on control dependency: [if], data = [none]
a.loadFromArray(TypeDesc.BYTE);
// depends on control dependency: [if], data = [none]
a.loadConstant(0xff);
// depends on control dependency: [if], data = [none]
a.math(Opcode.IAND);
// depends on control dependency: [if], data = [none]
a.storeLocal(accumVar);
// depends on control dependency: [if], data = [none]
accumShift = 0;
// depends on control dependency: [if], data = [none]
}
int stateShift = (property.getNumber() & 0xf) * 2;
int accumPack = 2;
int mask = PROPERTY_STATE_MASK << stateShift;
// Try to pack more state properties into one operation.
while ((accumShift + accumPack) < 8) {
if (i + 1 >= properties.length) {
// No more properties to encode.
break;
}
StorableProperty<S> nextProperty = properties[i + 1];
if (property.getNumber() + 1 != nextProperty.getNumber()) {
// Properties are not consecutive.
break;
}
if (stateVarOrdinal != (nextProperty.getNumber() >> 4)) {
// Property states are stored in different fields.
break;
}
accumPack += 2;
// depends on control dependency: [while], data = [none]
mask |= PROPERTY_STATE_MASK << ((nextProperty.getNumber() & 0xf) * 2);
// depends on control dependency: [while], data = [none]
property = nextProperty;
// depends on control dependency: [while], data = [none]
i++;
// depends on control dependency: [while], data = [none]
}
a.loadLocal(accumVar);
// depends on control dependency: [for], data = [none]
if (stateShift < accumShift) {
a.loadConstant(accumShift - stateShift);
// depends on control dependency: [if], data = [none]
a.math(Opcode.IUSHR);
// depends on control dependency: [if], data = [none]
} else if (stateShift > accumShift) {
a.loadConstant(stateShift - accumShift);
// depends on control dependency: [if], data = [(stateShift]
a.math(Opcode.ISHL);
// depends on control dependency: [if], data = [none]
}
a.loadConstant(mask);
// depends on control dependency: [for], data = [none]
a.math(Opcode.IAND);
// depends on control dependency: [for], data = [none]
a.loadLocal(stateVars.get(stateVarOrdinal));
// depends on control dependency: [for], data = [none]
a.loadConstant(~mask);
// depends on control dependency: [for], data = [none]
a.math(Opcode.IAND);
// depends on control dependency: [for], data = [none]
a.math(Opcode.IOR);
// depends on control dependency: [for], data = [none]
a.storeLocal(stateVars.get(stateVarOrdinal));
// depends on control dependency: [for], data = [none]
accumShift += accumPack;
// depends on control dependency: [for], data = [none]
}
return stateVars;
} } |
public class class_name {
public OExecutionStepInternal executeFull() {
for (int i = 0; i < steps.size(); i++) {
ScriptLineStep step = steps.get(i);
if (step.containsReturn()) {
OExecutionStepInternal returnStep = step.executeUntilReturn(ctx);
if (returnStep != null) {
return returnStep;
}
}
OResultSet lastResult = step.syncPull(ctx, 100);
while (lastResult.hasNext()) {
while (lastResult.hasNext()) {
lastResult.next();
}
lastResult = step.syncPull(ctx, 100);
}
}
return null;
} } | public class class_name {
public OExecutionStepInternal executeFull() {
for (int i = 0; i < steps.size(); i++) {
ScriptLineStep step = steps.get(i);
if (step.containsReturn()) {
OExecutionStepInternal returnStep = step.executeUntilReturn(ctx);
if (returnStep != null) {
return returnStep; // depends on control dependency: [if], data = [none]
}
}
OResultSet lastResult = step.syncPull(ctx, 100);
while (lastResult.hasNext()) {
while (lastResult.hasNext()) {
lastResult.next(); // depends on control dependency: [while], data = [none]
}
lastResult = step.syncPull(ctx, 100); // depends on control dependency: [while], data = [none]
}
}
return null;
} } |
public class class_name {
public List getPatternList() {
List mappings = jspConfigurationManager.getJspExtensionList();
if (mappings.isEmpty())
return mappings;
if (WCCustomProperties.ENABLE_JSP_MAPPING_OVERRIDE) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " enters enableJSPMappingOverride is TRUE");
}
//WebAppConfiguration config = ((com.ibm.ws.webcontainer.webapp.WebAppConfigurationImpl)extensionContext.getWebAppConfig());
WebAppConfig config = this.webapp.getWebAppConfig();
Map<String, List<String>> srvMappings = config.getServletMappings();
if (srvMappings.isEmpty()) {
return mappings;
}
Iterator iSrvNames = config.getServletNames();
List<String> newMappings = new ArrayList<String>();
String path = null, servletName;
HashSet<String> urlPatternSet = new HashSet<String>();
//for every servlet name in the mapping ...
while (iSrvNames.hasNext()) {
servletName = (String) iSrvNames.next();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " servletName [" + servletName + "]");
}
List<String> mapList = srvMappings.get(servletName);
if (mapList != null) {
// ...get all its UrlPattern and put them into a set...
Iterator<String> m = mapList.iterator();
while (m.hasNext()) {
path = m.next();
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " urlPattern [" + path + "]");
}
urlPatternSet.add(path);
}
}
}
// ... find an extension in the original list that matches the UrlPattern set
for (Iterator it = mappings.iterator(); it.hasNext();) {
String mapping = (String) it.next();
int dot = -1;
dot = mapping.lastIndexOf(".");
if (dot != -1) {
String extension = "*" + mapping.substring(dot);
if (!urlPatternSet.contains(extension)) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " no match for extension [" + extension + "], add [" + mapping + "]");
}
newMappings.add(mapping);
} else {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " found a match for extension [" + extension + "], ignore [" + mapping + "]");
}
}
} else { // no extension...just add to the mapping
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " no extension, add [" + mapping + "]");
}
newMappings.add(mapping);
}
}
mappings = newMappings;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " exits enableJSPMappingOverride");
}
}
return mappings;
} } | public class class_name {
public List getPatternList() {
List mappings = jspConfigurationManager.getJspExtensionList();
if (mappings.isEmpty())
return mappings;
if (WCCustomProperties.ENABLE_JSP_MAPPING_OVERRIDE) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " enters enableJSPMappingOverride is TRUE"); // depends on control dependency: [if], data = [none]
}
//WebAppConfiguration config = ((com.ibm.ws.webcontainer.webapp.WebAppConfigurationImpl)extensionContext.getWebAppConfig());
WebAppConfig config = this.webapp.getWebAppConfig();
Map<String, List<String>> srvMappings = config.getServletMappings();
if (srvMappings.isEmpty()) {
return mappings; // depends on control dependency: [if], data = [none]
}
Iterator iSrvNames = config.getServletNames();
List<String> newMappings = new ArrayList<String>();
String path = null, servletName;
HashSet<String> urlPatternSet = new HashSet<String>();
//for every servlet name in the mapping ...
while (iSrvNames.hasNext()) {
servletName = (String) iSrvNames.next(); // depends on control dependency: [while], data = [none]
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " servletName [" + servletName + "]"); // depends on control dependency: [if], data = [none]
}
List<String> mapList = srvMappings.get(servletName);
if (mapList != null) {
// ...get all its UrlPattern and put them into a set...
Iterator<String> m = mapList.iterator();
while (m.hasNext()) {
path = m.next(); // depends on control dependency: [while], data = [none]
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " urlPattern [" + path + "]"); // depends on control dependency: [if], data = [none]
}
urlPatternSet.add(path); // depends on control dependency: [while], data = [none]
}
}
}
// ... find an extension in the original list that matches the UrlPattern set
for (Iterator it = mappings.iterator(); it.hasNext();) {
String mapping = (String) it.next();
int dot = -1;
dot = mapping.lastIndexOf("."); // depends on control dependency: [for], data = [none]
if (dot != -1) {
String extension = "*" + mapping.substring(dot);
if (!urlPatternSet.contains(extension)) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " no match for extension [" + extension + "], add [" + mapping + "]"); // depends on control dependency: [if], data = [none]
}
newMappings.add(mapping); // depends on control dependency: [if], data = [none]
} else {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " found a match for extension [" + extension + "], ignore [" + mapping + "]"); // depends on control dependency: [if], data = [none]
}
}
} else { // no extension...just add to the mapping
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " no extension, add [" + mapping + "]"); // depends on control dependency: [if], data = [none]
}
newMappings.add(mapping); // depends on control dependency: [if], data = [none]
}
}
mappings = newMappings; // depends on control dependency: [if], data = [none]
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINER)) {
logger.logp(Level.FINER, CLASS_NAME, "getPatternList", " exits enableJSPMappingOverride"); // depends on control dependency: [if], data = [none]
}
}
return mappings;
} } |
public class class_name {
public void anyExceptionHandler(Throwable e, ReqState rs) {
log.error("DODServlet ERROR (anyExceptionHandler): " + e);
printThrowable(e);
try {
if(rs == null)
throw new DAP2Exception("anyExceptionHandler: no request state provided");
log.error(rs.toString());
HttpServletResponse response = rs.getResponse();
log.error(rs.toString());
if (track) {
RequestDebug reqD = (RequestDebug) rs.getUserObject();
log.error(" request number: " + reqD.reqno + " thread: " + reqD.threadDesc);
}
response.setHeader("Content-Description", "dods-error");
// This should probably be set to "plain" but this works, the
// C++ slients don't barf as they would if I sent "plain" AND
// the C++ don't expect compressed data if I do this...
response.setHeader("Content-Encoding", "");
// Strip any double quotes out of the parser error message.
// These get stuck in auto-magically by the javacc generated parser
// code and they break our error parser (bummer!)
String msg = e.getMessage();
if (msg != null)
msg = msg.replace('\"', '\'');
DAP2Exception de2 = new DAP2Exception(opendap.dap.DAP2Exception.UNDEFINED_ERROR, msg);
BufferedOutputStream eOut = new BufferedOutputStream(response.getOutputStream());
de2.print(eOut);
} catch (Exception ioe) {
log.error("Cannot respond to client! IO Error: " + ioe.getMessage());
}
} } | public class class_name {
public void anyExceptionHandler(Throwable e, ReqState rs) {
log.error("DODServlet ERROR (anyExceptionHandler): " + e);
printThrowable(e);
try {
if(rs == null)
throw new DAP2Exception("anyExceptionHandler: no request state provided");
log.error(rs.toString()); // depends on control dependency: [try], data = [none]
HttpServletResponse response = rs.getResponse();
log.error(rs.toString()); // depends on control dependency: [try], data = [none]
if (track) {
RequestDebug reqD = (RequestDebug) rs.getUserObject();
log.error(" request number: " + reqD.reqno + " thread: " + reqD.threadDesc); // depends on control dependency: [if], data = [none]
}
response.setHeader("Content-Description", "dods-error"); // depends on control dependency: [try], data = [none]
// This should probably be set to "plain" but this works, the
// C++ slients don't barf as they would if I sent "plain" AND
// the C++ don't expect compressed data if I do this...
response.setHeader("Content-Encoding", ""); // depends on control dependency: [try], data = [none]
// Strip any double quotes out of the parser error message.
// These get stuck in auto-magically by the javacc generated parser
// code and they break our error parser (bummer!)
String msg = e.getMessage();
if (msg != null)
msg = msg.replace('\"', '\'');
DAP2Exception de2 = new DAP2Exception(opendap.dap.DAP2Exception.UNDEFINED_ERROR, msg);
BufferedOutputStream eOut = new BufferedOutputStream(response.getOutputStream());
de2.print(eOut); // depends on control dependency: [try], data = [none]
} catch (Exception ioe) {
log.error("Cannot respond to client! IO Error: " + ioe.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static <C extends Comparable<C>> boolean increasing(C[] els) {
for (int i = els.length; --i >= 1; ) {
if (els[i - 1].compareTo(els[i]) > 0) {
return false;
}
}
return true;
} } | public class class_name {
private static <C extends Comparable<C>> boolean increasing(C[] els) {
for (int i = els.length; --i >= 1; ) {
if (els[i - 1].compareTo(els[i]) > 0) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
protected void checkScales() {
if( getScale(0) < 0 ) {
throw new IllegalArgumentException("The first layer must be more than zero.");
}
double prevScale = 0;
for( int i = 0; i < getNumLayers(); i++ ) {
double s = getScale(i);
if( s < prevScale )
throw new IllegalArgumentException("Higher layers must be the same size or larger than previous layers.");
prevScale = s;
}
} } | public class class_name {
protected void checkScales() {
if( getScale(0) < 0 ) {
throw new IllegalArgumentException("The first layer must be more than zero.");
}
double prevScale = 0;
for( int i = 0; i < getNumLayers(); i++ ) {
double s = getScale(i);
if( s < prevScale )
throw new IllegalArgumentException("Higher layers must be the same size or larger than previous layers.");
prevScale = s; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@Nullable
public static URL uriToUrl(@Nullable Uri uri) {
if (uri == null) {
return null;
}
try {
return new URL(uri.toString());
} catch (java.net.MalformedURLException e) {
// This should never happen since we got a valid uri
throw new RuntimeException(e);
}
} } | public class class_name {
@Nullable
public static URL uriToUrl(@Nullable Uri uri) {
if (uri == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return new URL(uri.toString()); // depends on control dependency: [try], data = [none]
} catch (java.net.MalformedURLException e) {
// This should never happen since we got a valid uri
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String settings(boolean showUnpublicized) {
StringJoiner out = new StringJoiner(lineSeparator);
// Determine the length of the longest name
int maxLength = maxOptionLength(options, showUnpublicized);
// Create the settings string
for (OptionInfo oi : options) {
@SuppressWarnings("formatter") // format string computed from maxLength
String use = String.format("%-" + maxLength + "s = ", oi.longName);
try {
use += oi.field.get(oi.obj);
} catch (Exception e) {
throw new Error("unexpected exception reading field " + oi.field, e);
}
out.add(use);
}
return out.toString();
} } | public class class_name {
public String settings(boolean showUnpublicized) {
StringJoiner out = new StringJoiner(lineSeparator);
// Determine the length of the longest name
int maxLength = maxOptionLength(options, showUnpublicized);
// Create the settings string
for (OptionInfo oi : options) {
@SuppressWarnings("formatter") // format string computed from maxLength
String use = String.format("%-" + maxLength + "s = ", oi.longName);
try {
use += oi.field.get(oi.obj); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new Error("unexpected exception reading field " + oi.field, e);
} // depends on control dependency: [catch], data = [none]
out.add(use); // depends on control dependency: [for], data = [none]
}
return out.toString();
} } |
public class class_name {
public void setMetricFilters(java.util.Collection<MetricFilter> metricFilters) {
if (metricFilters == null) {
this.metricFilters = null;
return;
}
this.metricFilters = new com.amazonaws.internal.SdkInternalList<MetricFilter>(metricFilters);
} } | public class class_name {
public void setMetricFilters(java.util.Collection<MetricFilter> metricFilters) {
if (metricFilters == null) {
this.metricFilters = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.metricFilters = new com.amazonaws.internal.SdkInternalList<MetricFilter>(metricFilters);
} } |
public class class_name {
public void marshall(UpdateProjectRequest updateProjectRequest, ProtocolMarshaller protocolMarshaller) {
if (updateProjectRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateProjectRequest.getArn(), ARN_BINDING);
protocolMarshaller.marshall(updateProjectRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(updateProjectRequest.getDefaultJobTimeoutMinutes(), DEFAULTJOBTIMEOUTMINUTES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateProjectRequest updateProjectRequest, ProtocolMarshaller protocolMarshaller) {
if (updateProjectRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateProjectRequest.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProjectRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProjectRequest.getDefaultJobTimeoutMinutes(), DEFAULTJOBTIMEOUTMINUTES_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 final hqlParser.insertablePropertySpec_return insertablePropertySpec() throws RecognitionException {
hqlParser.insertablePropertySpec_return retval = new hqlParser.insertablePropertySpec_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token OPEN33=null;
Token COMMA35=null;
Token CLOSE37=null;
ParserRuleReturnScope primaryExpression34 =null;
ParserRuleReturnScope primaryExpression36 =null;
CommonTree OPEN33_tree=null;
CommonTree COMMA35_tree=null;
CommonTree CLOSE37_tree=null;
RewriteRuleTokenStream stream_OPEN=new RewriteRuleTokenStream(adaptor,"token OPEN");
RewriteRuleTokenStream stream_CLOSE=new RewriteRuleTokenStream(adaptor,"token CLOSE");
RewriteRuleTokenStream stream_COMMA=new RewriteRuleTokenStream(adaptor,"token COMMA");
RewriteRuleSubtreeStream stream_primaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule primaryExpression");
try {
// hql.g:225:2: ( OPEN primaryExpression ( COMMA primaryExpression )* CLOSE -> ^( RANGE[\"column-spec\"] ( primaryExpression )* ) )
// hql.g:225:4: OPEN primaryExpression ( COMMA primaryExpression )* CLOSE
{
OPEN33=(Token)match(input,OPEN,FOLLOW_OPEN_in_insertablePropertySpec865);
stream_OPEN.add(OPEN33);
pushFollow(FOLLOW_primaryExpression_in_insertablePropertySpec867);
primaryExpression34=primaryExpression();
state._fsp--;
stream_primaryExpression.add(primaryExpression34.getTree());
// hql.g:225:27: ( COMMA primaryExpression )*
loop8:
while (true) {
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0==COMMA) ) {
alt8=1;
}
switch (alt8) {
case 1 :
// hql.g:225:29: COMMA primaryExpression
{
COMMA35=(Token)match(input,COMMA,FOLLOW_COMMA_in_insertablePropertySpec871);
stream_COMMA.add(COMMA35);
pushFollow(FOLLOW_primaryExpression_in_insertablePropertySpec873);
primaryExpression36=primaryExpression();
state._fsp--;
stream_primaryExpression.add(primaryExpression36.getTree());
}
break;
default :
break loop8;
}
}
CLOSE37=(Token)match(input,CLOSE,FOLLOW_CLOSE_in_insertablePropertySpec878);
stream_CLOSE.add(CLOSE37);
// AST REWRITE
// elements: primaryExpression
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 226:3: -> ^( RANGE[\"column-spec\"] ( primaryExpression )* )
{
// hql.g:226:6: ^( RANGE[\"column-spec\"] ( primaryExpression )* )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(RANGE, "column-spec"), root_1);
// hql.g:226:29: ( primaryExpression )*
while ( stream_primaryExpression.hasNext() ) {
adaptor.addChild(root_1, stream_primaryExpression.nextTree());
}
stream_primaryExpression.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} } | public class class_name {
public final hqlParser.insertablePropertySpec_return insertablePropertySpec() throws RecognitionException {
hqlParser.insertablePropertySpec_return retval = new hqlParser.insertablePropertySpec_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token OPEN33=null;
Token COMMA35=null;
Token CLOSE37=null;
ParserRuleReturnScope primaryExpression34 =null;
ParserRuleReturnScope primaryExpression36 =null;
CommonTree OPEN33_tree=null;
CommonTree COMMA35_tree=null;
CommonTree CLOSE37_tree=null;
RewriteRuleTokenStream stream_OPEN=new RewriteRuleTokenStream(adaptor,"token OPEN");
RewriteRuleTokenStream stream_CLOSE=new RewriteRuleTokenStream(adaptor,"token CLOSE");
RewriteRuleTokenStream stream_COMMA=new RewriteRuleTokenStream(adaptor,"token COMMA");
RewriteRuleSubtreeStream stream_primaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule primaryExpression");
try {
// hql.g:225:2: ( OPEN primaryExpression ( COMMA primaryExpression )* CLOSE -> ^( RANGE[\"column-spec\"] ( primaryExpression )* ) )
// hql.g:225:4: OPEN primaryExpression ( COMMA primaryExpression )* CLOSE
{
OPEN33=(Token)match(input,OPEN,FOLLOW_OPEN_in_insertablePropertySpec865);
stream_OPEN.add(OPEN33);
pushFollow(FOLLOW_primaryExpression_in_insertablePropertySpec867);
primaryExpression34=primaryExpression();
state._fsp--;
stream_primaryExpression.add(primaryExpression34.getTree());
// hql.g:225:27: ( COMMA primaryExpression )*
loop8:
while (true) {
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0==COMMA) ) {
alt8=1; // depends on control dependency: [if], data = [none]
}
switch (alt8) {
case 1 :
// hql.g:225:29: COMMA primaryExpression
{
COMMA35=(Token)match(input,COMMA,FOLLOW_COMMA_in_insertablePropertySpec871);
stream_COMMA.add(COMMA35);
pushFollow(FOLLOW_primaryExpression_in_insertablePropertySpec873);
primaryExpression36=primaryExpression();
state._fsp--;
stream_primaryExpression.add(primaryExpression36.getTree());
}
break;
default :
break loop8;
}
}
CLOSE37=(Token)match(input,CLOSE,FOLLOW_CLOSE_in_insertablePropertySpec878);
stream_CLOSE.add(CLOSE37);
// AST REWRITE
// elements: primaryExpression
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 226:3: -> ^( RANGE[\"column-spec\"] ( primaryExpression )* )
{
// hql.g:226:6: ^( RANGE[\"column-spec\"] ( primaryExpression )* )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(RANGE, "column-spec"), root_1);
// hql.g:226:29: ( primaryExpression )*
while ( stream_primaryExpression.hasNext() ) {
adaptor.addChild(root_1, stream_primaryExpression.nextTree()); // depends on control dependency: [while], data = [none]
}
stream_primaryExpression.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} } |
public class class_name {
private static boolean isSameClassPackage(ClassLoader loader1, String name1,
ClassLoader loader2, String name2)
{
if (loader1 != loader2) {
return false;
} else {
int lastDot1 = name1.lastIndexOf('.');
int lastDot2 = name2.lastIndexOf('.');
if ((lastDot1 == -1) || (lastDot2 == -1)) {
// One of the two doesn't have a package. Only return true
// if the other one also doesn't have a package.
return (lastDot1 == lastDot2);
} else {
int idx1 = 0;
int idx2 = 0;
// Skip over '['s
if (name1.charAt(idx1) == '[') {
do {
idx1++;
} while (name1.charAt(idx1) == '[');
if (name1.charAt(idx1) != 'L') {
// Something is terribly wrong. Shouldn't be here.
throw new InternalError("Illegal class name " + name1);
}
}
if (name2.charAt(idx2) == '[') {
do {
idx2++;
} while (name2.charAt(idx2) == '[');
if (name2.charAt(idx2) != 'L') {
// Something is terribly wrong. Shouldn't be here.
throw new InternalError("Illegal class name " + name2);
}
}
// Check that package part is identical
int length1 = lastDot1 - idx1;
int length2 = lastDot2 - idx2;
if (length1 != length2) {
return false;
}
return name1.regionMatches(false, idx1, name2, idx2, length1);
}
}
} } | public class class_name {
private static boolean isSameClassPackage(ClassLoader loader1, String name1,
ClassLoader loader2, String name2)
{
if (loader1 != loader2) {
return false; // depends on control dependency: [if], data = [none]
} else {
int lastDot1 = name1.lastIndexOf('.');
int lastDot2 = name2.lastIndexOf('.');
if ((lastDot1 == -1) || (lastDot2 == -1)) {
// One of the two doesn't have a package. Only return true
// if the other one also doesn't have a package.
return (lastDot1 == lastDot2); // depends on control dependency: [if], data = [none]
} else {
int idx1 = 0;
int idx2 = 0;
// Skip over '['s
if (name1.charAt(idx1) == '[') {
do {
idx1++;
} while (name1.charAt(idx1) == '[');
if (name1.charAt(idx1) != 'L') {
// Something is terribly wrong. Shouldn't be here.
throw new InternalError("Illegal class name " + name1);
}
}
if (name2.charAt(idx2) == '[') {
do {
idx2++;
} while (name2.charAt(idx2) == '[');
if (name2.charAt(idx2) != 'L') {
// Something is terribly wrong. Shouldn't be here.
throw new InternalError("Illegal class name " + name2);
}
}
// Check that package part is identical
int length1 = lastDot1 - idx1;
int length2 = lastDot2 - idx2;
if (length1 != length2) {
return false; // depends on control dependency: [if], data = [none]
}
return name1.regionMatches(false, idx1, name2, idx2, length1); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public Set<Entry<String, Object>> entrySet() {
if (entries == null) {
entries = new HashSet<>();
Iterator<String> iterator = getAttributeNames();
while (iterator.hasNext()) {
final String key = iterator.next();
final Object value = getAttribute(key);
entries.add(new Entry<String, Object>() {
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
Entry entry = (Entry) obj;
return ((key == null) ? (entry.getKey() == null) : key.equals(entry.getKey())) && ((value == null) ? (entry.getValue() == null) : value.equals(entry.getValue()));
}
@Override
public int hashCode() {
return ((key == null) ? 0 : key.hashCode()) ^ ((value == null) ? 0 : value.hashCode());
}
@Override
public String getKey() {
return key;
}
@Override
public Object getValue() {
return value;
}
@Override
public Object setValue(final Object obj) {
setAttribute(key, obj);
return value;
}
});
}
}
return entries;
} } | public class class_name {
@Override
public Set<Entry<String, Object>> entrySet() {
if (entries == null) {
entries = new HashSet<>(); // depends on control dependency: [if], data = [none]
Iterator<String> iterator = getAttributeNames();
while (iterator.hasNext()) {
final String key = iterator.next();
final Object value = getAttribute(key);
entries.add(new Entry<String, Object>() {
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (this.getClass() != obj.getClass()) {
return false; // depends on control dependency: [if], data = [none]
}
Entry entry = (Entry) obj;
return ((key == null) ? (entry.getKey() == null) : key.equals(entry.getKey())) && ((value == null) ? (entry.getValue() == null) : value.equals(entry.getValue()));
}
@Override
public int hashCode() {
return ((key == null) ? 0 : key.hashCode()) ^ ((value == null) ? 0 : value.hashCode());
}
@Override
public String getKey() {
return key;
}
@Override
public Object getValue() {
return value;
}
@Override
public Object setValue(final Object obj) {
setAttribute(key, obj);
return value;
}
}); // depends on control dependency: [while], data = [none]
}
}
return entries;
} } |
public class class_name {
private long getUTC(long time, int raw, int dst) {
if (timeType != DateTimeRule.UTC_TIME) {
time -= raw;
}
if (timeType == DateTimeRule.WALL_TIME) {
time -= dst;
}
return time;
} } | public class class_name {
private long getUTC(long time, int raw, int dst) {
if (timeType != DateTimeRule.UTC_TIME) {
time -= raw; // depends on control dependency: [if], data = [none]
}
if (timeType == DateTimeRule.WALL_TIME) {
time -= dst; // depends on control dependency: [if], data = [none]
}
return time;
} } |
public class class_name {
@Override
public void shutdown(IAggregator aggregator) {
for(IServiceRegistration reg : _serviceRegistrations) {
reg.unregister();
}
_serviceRegistrations.clear();
// Serialize the cache metadata one last time
serializeCache();
// avoid memory leaks caused by circular references
_aggregator = null;
_cache.set(null);
} } | public class class_name {
@Override
public void shutdown(IAggregator aggregator) {
for(IServiceRegistration reg : _serviceRegistrations) {
reg.unregister();
// depends on control dependency: [for], data = [reg]
}
_serviceRegistrations.clear();
// Serialize the cache metadata one last time
serializeCache();
// avoid memory leaks caused by circular references
_aggregator = null;
_cache.set(null);
} } |
public class class_name {
public EClass getFNIRG() {
if (fnirgEClass == null) {
fnirgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(407);
}
return fnirgEClass;
} } | public class class_name {
public EClass getFNIRG() {
if (fnirgEClass == null) {
fnirgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(407); // depends on control dependency: [if], data = [none]
}
return fnirgEClass;
} } |
public class class_name {
public static Set<ApiVerb> buildVerb(Method method) {
Set<ApiVerb> apiVerbs = new LinkedHashSet<ApiVerb>();
Class<?> controller = method.getDeclaringClass();
if(isAnnotated(controller, RequestMapping.class)) {
RequestMapping requestMapping = getAnnotation(controller, RequestMapping.class);
getApiVerbFromRequestMapping(apiVerbs, requestMapping);
}
if(isAnnotated(method, RequestMapping.class)) {
RequestMapping requestMapping = getAnnotation(method, RequestMapping.class);
getApiVerbFromRequestMapping(apiVerbs, requestMapping);
}
if(apiVerbs.isEmpty()) {
apiVerbs.add(ApiVerb.GET);
}
return apiVerbs;
} } | public class class_name {
public static Set<ApiVerb> buildVerb(Method method) {
Set<ApiVerb> apiVerbs = new LinkedHashSet<ApiVerb>();
Class<?> controller = method.getDeclaringClass();
if(isAnnotated(controller, RequestMapping.class)) {
RequestMapping requestMapping = getAnnotation(controller, RequestMapping.class);
getApiVerbFromRequestMapping(apiVerbs, requestMapping); // depends on control dependency: [if], data = [none]
}
if(isAnnotated(method, RequestMapping.class)) {
RequestMapping requestMapping = getAnnotation(method, RequestMapping.class);
getApiVerbFromRequestMapping(apiVerbs, requestMapping); // depends on control dependency: [if], data = [none]
}
if(apiVerbs.isEmpty()) {
apiVerbs.add(ApiVerb.GET); // depends on control dependency: [if], data = [none]
}
return apiVerbs;
} } |
public class class_name {
public void taintPackagesDependingOnChangedPackages(Set<String> pkgs, Set<String> recentlyCompiled) {
for (Package pkg : prev.packages().values()) {
for (String dep : pkg.dependencies()) {
if (pkgs.contains(dep) && !recentlyCompiled.contains(pkg.name())) {
taintPackage(pkg.name(), " its depending on "+dep);
}
}
}
} } | public class class_name {
public void taintPackagesDependingOnChangedPackages(Set<String> pkgs, Set<String> recentlyCompiled) {
for (Package pkg : prev.packages().values()) {
for (String dep : pkg.dependencies()) {
if (pkgs.contains(dep) && !recentlyCompiled.contains(pkg.name())) {
taintPackage(pkg.name(), " its depending on "+dep); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
@Override
public int compareTo(MonetaryAmount other) {
BigDecimal n = toBigDecimal(other.getNumber());
if ((this.betrag.compareTo(BigDecimal.ZERO) != 0) && (n.compareTo(BigDecimal.ZERO) != 0)) {
checkCurrency(other);
}
return betrag.compareTo(n);
} } | public class class_name {
@Override
public int compareTo(MonetaryAmount other) {
BigDecimal n = toBigDecimal(other.getNumber());
if ((this.betrag.compareTo(BigDecimal.ZERO) != 0) && (n.compareTo(BigDecimal.ZERO) != 0)) {
checkCurrency(other); // depends on control dependency: [if], data = [none]
}
return betrag.compareTo(n);
} } |
public class class_name {
final TreeMapEntry<K,V> getHigherEntry(K key) {
TreeMapEntry<K,V> p = root;
while (p != null) {
int cmp = compare(key, p.key);
if (cmp < 0) {
if (p.left != null)
p = p.left;
else
return p;
} else {
if (p.right != null) {
p = p.right;
} else {
TreeMapEntry<K,V> parent = p.parent;
TreeMapEntry<K,V> ch = p;
while (parent != null && ch == parent.right) {
ch = parent;
parent = parent.parent;
}
return parent;
}
}
}
return null;
} } | public class class_name {
final TreeMapEntry<K,V> getHigherEntry(K key) {
TreeMapEntry<K,V> p = root;
while (p != null) {
int cmp = compare(key, p.key);
if (cmp < 0) {
if (p.left != null)
p = p.left;
else
return p;
} else {
if (p.right != null) {
p = p.right; // depends on control dependency: [if], data = [none]
} else {
TreeMapEntry<K,V> parent = p.parent;
TreeMapEntry<K,V> ch = p;
while (parent != null && ch == parent.right) {
ch = parent; // depends on control dependency: [while], data = [none]
parent = parent.parent; // depends on control dependency: [while], data = [none]
}
return parent; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
@Override
public EClass getIfcQuantitySet() {
if (ifcQuantitySetEClass == null) {
ifcQuantitySetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(490);
}
return ifcQuantitySetEClass;
} } | public class class_name {
@Override
public EClass getIfcQuantitySet() {
if (ifcQuantitySetEClass == null) {
ifcQuantitySetEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(490);
// depends on control dependency: [if], data = [none]
}
return ifcQuantitySetEClass;
} } |
public class class_name {
private WyalFile.VariableDeclaration[] generateLoopInvariantParameterDeclarations(Stmt.Loop loop,
LocalEnvironment environment) {
// Extract all used variables within the loop invariant. This is necessary to
// determine what parameters are required for the loop invariant macros.
Tuple<Decl.Variable> modified = determineUsedVariables(loop.getInvariant());
WyalFile.VariableDeclaration[] vars = new WyalFile.VariableDeclaration[modified.size()];
// second, set initial environment
for (int i = 0; i != modified.size(); ++i) {
WyilFile.Decl.Variable var = modified.get(i);
vars[i] = environment.read(var);
}
return vars;
} } | public class class_name {
private WyalFile.VariableDeclaration[] generateLoopInvariantParameterDeclarations(Stmt.Loop loop,
LocalEnvironment environment) {
// Extract all used variables within the loop invariant. This is necessary to
// determine what parameters are required for the loop invariant macros.
Tuple<Decl.Variable> modified = determineUsedVariables(loop.getInvariant());
WyalFile.VariableDeclaration[] vars = new WyalFile.VariableDeclaration[modified.size()];
// second, set initial environment
for (int i = 0; i != modified.size(); ++i) {
WyilFile.Decl.Variable var = modified.get(i);
vars[i] = environment.read(var); // depends on control dependency: [for], data = [i]
}
return vars;
} } |
public class class_name {
private static void splitProjectionsForGroupBy(QueryPlanningInfo info, OCommandContext ctx) {
if (info.projection == null) {
return;
}
OProjection preAggregate = new OProjection(-1);
preAggregate.setItems(new ArrayList<>());
OProjection aggregate = new OProjection(-1);
aggregate.setItems(new ArrayList<>());
OProjection postAggregate = new OProjection(-1);
postAggregate.setItems(new ArrayList<>());
boolean isSplitted = false;
//split for aggregate projections
AggregateProjectionSplit result = new AggregateProjectionSplit();
for (OProjectionItem item : info.projection.getItems()) {
result.reset();
if (isAggregate(item)) {
isSplitted = true;
OProjectionItem post = item.splitForAggregation(result, ctx);
OIdentifier postAlias = item.getProjectionAlias();
postAlias = new OIdentifier(postAlias, true);
post.setAlias(postAlias);
postAggregate.getItems().add(post);
aggregate.getItems().addAll(result.getAggregate());
preAggregate.getItems().addAll(result.getPreAggregate());
} else {
preAggregate.getItems().add(item);
//also push the alias forward in the chain
OProjectionItem aggItem = new OProjectionItem(-1);
aggItem.setExpression(new OExpression(item.getProjectionAlias()));
aggregate.getItems().add(aggItem);
postAggregate.getItems().add(aggItem);
}
}
//bind split projections to the execution planner
if (isSplitted) {
info.preAggregateProjection = preAggregate;
if (info.preAggregateProjection.getItems() == null || info.preAggregateProjection.getItems().size() == 0) {
info.preAggregateProjection = null;
}
info.aggregateProjection = aggregate;
if (info.aggregateProjection.getItems() == null || info.aggregateProjection.getItems().size() == 0) {
info.aggregateProjection = null;
}
info.projection = postAggregate;
addGroupByExpressionsToProjections(info);
}
} } | public class class_name {
private static void splitProjectionsForGroupBy(QueryPlanningInfo info, OCommandContext ctx) {
if (info.projection == null) {
return; // depends on control dependency: [if], data = [none]
}
OProjection preAggregate = new OProjection(-1);
preAggregate.setItems(new ArrayList<>());
OProjection aggregate = new OProjection(-1);
aggregate.setItems(new ArrayList<>());
OProjection postAggregate = new OProjection(-1);
postAggregate.setItems(new ArrayList<>());
boolean isSplitted = false;
//split for aggregate projections
AggregateProjectionSplit result = new AggregateProjectionSplit();
for (OProjectionItem item : info.projection.getItems()) {
result.reset(); // depends on control dependency: [for], data = [none]
if (isAggregate(item)) {
isSplitted = true; // depends on control dependency: [if], data = [none]
OProjectionItem post = item.splitForAggregation(result, ctx);
OIdentifier postAlias = item.getProjectionAlias();
postAlias = new OIdentifier(postAlias, true); // depends on control dependency: [if], data = [none]
post.setAlias(postAlias); // depends on control dependency: [if], data = [none]
postAggregate.getItems().add(post); // depends on control dependency: [if], data = [none]
aggregate.getItems().addAll(result.getAggregate()); // depends on control dependency: [if], data = [none]
preAggregate.getItems().addAll(result.getPreAggregate()); // depends on control dependency: [if], data = [none]
} else {
preAggregate.getItems().add(item); // depends on control dependency: [if], data = [none]
//also push the alias forward in the chain
OProjectionItem aggItem = new OProjectionItem(-1);
aggItem.setExpression(new OExpression(item.getProjectionAlias())); // depends on control dependency: [if], data = [none]
aggregate.getItems().add(aggItem); // depends on control dependency: [if], data = [none]
postAggregate.getItems().add(aggItem); // depends on control dependency: [if], data = [none]
}
}
//bind split projections to the execution planner
if (isSplitted) {
info.preAggregateProjection = preAggregate; // depends on control dependency: [if], data = [none]
if (info.preAggregateProjection.getItems() == null || info.preAggregateProjection.getItems().size() == 0) {
info.preAggregateProjection = null; // depends on control dependency: [if], data = [none]
}
info.aggregateProjection = aggregate; // depends on control dependency: [if], data = [none]
if (info.aggregateProjection.getItems() == null || info.aggregateProjection.getItems().size() == 0) {
info.aggregateProjection = null; // depends on control dependency: [if], data = [none]
}
info.projection = postAggregate; // depends on control dependency: [if], data = [none]
addGroupByExpressionsToProjections(info); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Duration minus(Duration duration) {
long secsToSubtract = duration.getSeconds();
int nanosToSubtract = duration.getNano();
if (secsToSubtract == Long.MIN_VALUE) {
return plus(Long.MAX_VALUE, -nanosToSubtract).plus(1, 0);
}
return plus(-secsToSubtract, -nanosToSubtract);
} } | public class class_name {
public Duration minus(Duration duration) {
long secsToSubtract = duration.getSeconds();
int nanosToSubtract = duration.getNano();
if (secsToSubtract == Long.MIN_VALUE) {
return plus(Long.MAX_VALUE, -nanosToSubtract).plus(1, 0); // depends on control dependency: [if], data = [none]
}
return plus(-secsToSubtract, -nanosToSubtract);
} } |
public class class_name {
public EClass getAMI() {
if (amiEClass == null) {
amiEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(323);
}
return amiEClass;
} } | public class class_name {
public EClass getAMI() {
if (amiEClass == null) {
amiEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(323); // depends on control dependency: [if], data = [none]
}
return amiEClass;
} } |
public class class_name {
public static ScopDatabase getSCOP(String version, boolean forceLocalData){
if( version == null ) {
version = defaultVersion;
}
ScopDatabase scop = versionedScopDBs.get(version);
if ( forceLocalData) {
// Use a local installation
if( scop == null || !(scop instanceof LocalScopDatabase) ) {
logger.info("Creating new {}, version {}", BerkeleyScopInstallation.class.getSimpleName(), version);
BerkeleyScopInstallation berkeley = new BerkeleyScopInstallation();
berkeley.setScopVersion(version);
versionedScopDBs.put(version,berkeley);
return berkeley;
}
return scop;
} else {
// Use a remote installation
if( scop == null ) {
logger.info("Creating new {}, version {}", RemoteScopInstallation.class.getSimpleName(), version);
scop = new RemoteScopInstallation();
scop.setScopVersion(version);
versionedScopDBs.put(version,scop);
}
return scop;
}
} } | public class class_name {
public static ScopDatabase getSCOP(String version, boolean forceLocalData){
if( version == null ) {
version = defaultVersion; // depends on control dependency: [if], data = [none]
}
ScopDatabase scop = versionedScopDBs.get(version);
if ( forceLocalData) {
// Use a local installation
if( scop == null || !(scop instanceof LocalScopDatabase) ) {
logger.info("Creating new {}, version {}", BerkeleyScopInstallation.class.getSimpleName(), version); // depends on control dependency: [if], data = [none]
BerkeleyScopInstallation berkeley = new BerkeleyScopInstallation();
berkeley.setScopVersion(version); // depends on control dependency: [if], data = [none]
versionedScopDBs.put(version,berkeley); // depends on control dependency: [if], data = [none]
return berkeley; // depends on control dependency: [if], data = [none]
}
return scop; // depends on control dependency: [if], data = [none]
} else {
// Use a remote installation
if( scop == null ) {
logger.info("Creating new {}, version {}", RemoteScopInstallation.class.getSimpleName(), version); // depends on control dependency: [if], data = [none]
scop = new RemoteScopInstallation(); // depends on control dependency: [if], data = [none]
scop.setScopVersion(version); // depends on control dependency: [if], data = [none]
versionedScopDBs.put(version,scop); // depends on control dependency: [if], data = [none]
}
return scop; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean ringAlreadyInSet(IRing newRing, IRingSet ringSet) {
IRing ring;
// IBond[] bonds;
// IBond[] newBonds;
// IBond bond;
int equalCount;
boolean equals;
for (int f = 0; f < ringSet.getAtomContainerCount(); f++) {
equals = false;
equalCount = 0;
ring = (IRing) ringSet.getAtomContainer(f);
// bonds = ring.getBonds();
// newBonds = newRing.getBonds();
if (ring.getBondCount() == newRing.getBondCount()) {
for (IBond newBond : newRing.bonds()) {
for (IBond bond : ring.bonds()) {
if (newBond.equals(bond)) {
equals = true;
equalCount++;
break;
}
}
if (!equals) break;
}
}
if (equalCount == ring.getBondCount()) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean ringAlreadyInSet(IRing newRing, IRingSet ringSet) {
IRing ring;
// IBond[] bonds;
// IBond[] newBonds;
// IBond bond;
int equalCount;
boolean equals;
for (int f = 0; f < ringSet.getAtomContainerCount(); f++) {
equals = false; // depends on control dependency: [for], data = [none]
equalCount = 0; // depends on control dependency: [for], data = [none]
ring = (IRing) ringSet.getAtomContainer(f); // depends on control dependency: [for], data = [f]
// bonds = ring.getBonds();
// newBonds = newRing.getBonds();
if (ring.getBondCount() == newRing.getBondCount()) {
for (IBond newBond : newRing.bonds()) {
for (IBond bond : ring.bonds()) {
if (newBond.equals(bond)) {
equals = true; // depends on control dependency: [if], data = [none]
equalCount++; // depends on control dependency: [if], data = [none]
break;
}
}
if (!equals) break;
}
}
if (equalCount == ring.getBondCount()) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private boolean attemptDateRangeOptimization(BinaryExpression during, Retrieve retrieve, String alias) {
if (retrieve.getDateProperty() != null || retrieve.getDateRange() != null) {
return false;
}
Expression left = during.getOperand().get(0);
Expression right = during.getOperand().get(1);
String propertyPath = getPropertyPath(left, alias);
if (propertyPath != null && isRHSEligibleForDateRangeOptimization(right)) {
retrieve.setDateProperty(propertyPath);
retrieve.setDateRange(right);
return true;
}
return false;
} } | public class class_name {
private boolean attemptDateRangeOptimization(BinaryExpression during, Retrieve retrieve, String alias) {
if (retrieve.getDateProperty() != null || retrieve.getDateRange() != null) {
return false; // depends on control dependency: [if], data = [none]
}
Expression left = during.getOperand().get(0);
Expression right = during.getOperand().get(1);
String propertyPath = getPropertyPath(left, alias);
if (propertyPath != null && isRHSEligibleForDateRangeOptimization(right)) {
retrieve.setDateProperty(propertyPath); // depends on control dependency: [if], data = [(propertyPath]
retrieve.setDateRange(right); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
private void loadFileSources(final File directory, final String project) {
//clear source sequence
if (!directory.isDirectory()) {
logger.warn("Not a directory: " + directory);
}
//get supported parser extensions
final Set<String> exts = new HashSet<String>(
framework.getResourceFormatParserService().listSupportedFileExtensions());
final File[] files = directory.listFiles(new FilenameFilter() {
public boolean accept(final File file, final String s) {
return exts.contains(
ResourceFormatParserService.getFileExtension(s));
}
});
//set of previously cached file sources by file
if (null != files) {
//sort on filename
Arrays.sort(files, null);
synchronized (sourceCache) {
final HashSet<File> trackedFiles = new HashSet<File>(sourceCache.keySet());
for (final File file : files) {
//remove file that we want to keep
trackedFiles.remove(file);
if (!sourceCache.containsKey(file)) {
logger.debug("Adding new resources file to cache: " + file.getAbsolutePath());
try {
final ResourceModelSource source = createFileSource(project, file);
sourceCache.put(file, source);
} catch (ExecutionServiceException e) {
e.printStackTrace();
logger.debug("Failed adding file " + file.getAbsolutePath() + ": " + e.getMessage(), e);
}
}
}
//remaining trackedFiles are files that have been removed from the dir
for (final File oldFile : trackedFiles) {
logger.debug("Removing from cache: " + oldFile.getAbsolutePath());
sourceCache.remove(oldFile);
}
}
}
} } | public class class_name {
private void loadFileSources(final File directory, final String project) {
//clear source sequence
if (!directory.isDirectory()) {
logger.warn("Not a directory: " + directory); // depends on control dependency: [if], data = [none]
}
//get supported parser extensions
final Set<String> exts = new HashSet<String>(
framework.getResourceFormatParserService().listSupportedFileExtensions());
final File[] files = directory.listFiles(new FilenameFilter() {
public boolean accept(final File file, final String s) {
return exts.contains(
ResourceFormatParserService.getFileExtension(s));
}
});
//set of previously cached file sources by file
if (null != files) {
//sort on filename
Arrays.sort(files, null); // depends on control dependency: [if], data = [none]
synchronized (sourceCache) { // depends on control dependency: [if], data = [none]
final HashSet<File> trackedFiles = new HashSet<File>(sourceCache.keySet());
for (final File file : files) {
//remove file that we want to keep
trackedFiles.remove(file); // depends on control dependency: [for], data = [file]
if (!sourceCache.containsKey(file)) {
logger.debug("Adding new resources file to cache: " + file.getAbsolutePath()); // depends on control dependency: [if], data = [none]
try {
final ResourceModelSource source = createFileSource(project, file);
sourceCache.put(file, source); // depends on control dependency: [try], data = [none]
} catch (ExecutionServiceException e) {
e.printStackTrace();
logger.debug("Failed adding file " + file.getAbsolutePath() + ": " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
//remaining trackedFiles are files that have been removed from the dir
for (final File oldFile : trackedFiles) {
logger.debug("Removing from cache: " + oldFile.getAbsolutePath()); // depends on control dependency: [for], data = [oldFile]
sourceCache.remove(oldFile); // depends on control dependency: [for], data = [oldFile]
}
}
}
} } |
public class class_name {
private List<ResourceBuilderModel> getRegisteredListForEvent(String event) {
if(eventSubscribers.containsKey(event)) {
return eventSubscribers.get(event);
} else {
LinkedList<ResourceBuilderModel> tempList = new LinkedList<>();
eventSubscribers.put(event, tempList);
return tempList;
}
} } | public class class_name {
private List<ResourceBuilderModel> getRegisteredListForEvent(String event) {
if(eventSubscribers.containsKey(event)) {
return eventSubscribers.get(event); // depends on control dependency: [if], data = [none]
} else {
LinkedList<ResourceBuilderModel> tempList = new LinkedList<>();
eventSubscribers.put(event, tempList); // depends on control dependency: [if], data = [none]
return tempList; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static URI toURI(final String file) {
if (file == null) {
return null;
}
if (File.separatorChar == '\\' && file.indexOf('\\') != -1) {
return toURI(new File(file));
}
try {
return new URI(file);
} catch (final URISyntaxException e) {
try {
return new URI(clean(file.replace(WINDOWS_SEPARATOR, URI_SEPARATOR).trim(), false));
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex.getMessage(), ex);
}
}
} } | public class class_name {
public static URI toURI(final String file) {
if (file == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (File.separatorChar == '\\' && file.indexOf('\\') != -1) {
return toURI(new File(file)); // depends on control dependency: [if], data = [none]
}
try {
return new URI(file); // depends on control dependency: [try], data = [none]
} catch (final URISyntaxException e) {
try {
return new URI(clean(file.replace(WINDOWS_SEPARATOR, URI_SEPARATOR).trim(), false)); // depends on control dependency: [try], data = [none]
} catch (final URISyntaxException ex) {
throw new IllegalArgumentException(ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(NoteUpdate noteUpdate, ProtocolMarshaller protocolMarshaller) {
if (noteUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(noteUpdate.getText(), TEXT_BINDING);
protocolMarshaller.marshall(noteUpdate.getUpdatedBy(), UPDATEDBY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(NoteUpdate noteUpdate, ProtocolMarshaller protocolMarshaller) {
if (noteUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(noteUpdate.getText(), TEXT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(noteUpdate.getUpdatedBy(), UPDATEDBY_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected byte[] initPlainData(int payloadSize, @Nullable byte[] initVector) {
byte[] plainData = new byte[OVERHEAD_SIZE + payloadSize];
if (initVector == null) {
ByteBuffer byteBuffer = ByteBuffer.wrap(plainData);
byteBuffer.putLong(INITV_TIMESTAMP_OFFSET, millisToSecsAndMicros(System.currentTimeMillis()));
byteBuffer.putLong(INITV_SERVERID_OFFSET, ThreadLocalRandom.current().nextLong());
} else {
System.arraycopy(initVector, 0, plainData, INITV_BASE, min(INITV_SIZE, initVector.length));
}
return plainData;
} } | public class class_name {
protected byte[] initPlainData(int payloadSize, @Nullable byte[] initVector) {
byte[] plainData = new byte[OVERHEAD_SIZE + payloadSize];
if (initVector == null) {
ByteBuffer byteBuffer = ByteBuffer.wrap(plainData);
byteBuffer.putLong(INITV_TIMESTAMP_OFFSET, millisToSecsAndMicros(System.currentTimeMillis())); // depends on control dependency: [if], data = [none]
byteBuffer.putLong(INITV_SERVERID_OFFSET, ThreadLocalRandom.current().nextLong()); // depends on control dependency: [if], data = [none]
} else {
System.arraycopy(initVector, 0, plainData, INITV_BASE, min(INITV_SIZE, initVector.length)); // depends on control dependency: [if], data = [(initVector]
}
return plainData;
} } |
public class class_name {
public GetOpenIDConnectProviderResult withClientIDList(String... clientIDList) {
if (this.clientIDList == null) {
setClientIDList(new com.amazonaws.internal.SdkInternalList<String>(clientIDList.length));
}
for (String ele : clientIDList) {
this.clientIDList.add(ele);
}
return this;
} } | public class class_name {
public GetOpenIDConnectProviderResult withClientIDList(String... clientIDList) {
if (this.clientIDList == null) {
setClientIDList(new com.amazonaws.internal.SdkInternalList<String>(clientIDList.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : clientIDList) {
this.clientIDList.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static void setRouteInfo(String scName, String tbName, Object sdValue) {
scName = DDRStringUtils.toLowerCase(scName);
tbName = DDRStringUtils.toLowerCase(tbName);
if (scName == null) {
throw new IllegalArgumentException("'scName' can't be empty");
}
if (tbName == null) {
throw new IllegalArgumentException("'tbName' can't be empty");
}
if (sdValue == null) {
sdValue = NULL_OBJECT;
}
/**
* 添加两条查询索引
* schema_name.table_name <-> routeInfo
* table_name <-> routeInfo
*/
Map<String, Object> exactRouteContext = getCurContext().getExactRouteContext();
exactRouteContext.put(buildQueryKey(scName, tbName), sdValue);
Map<String, Map<String, Object>> ambiguousRouteContext = getCurContext().getAmbiguousRouteContext();
Map<String, Object> scMap = ambiguousRouteContext.get(tbName);
if (scMap == null) {
scMap = new HashMap<>();
ambiguousRouteContext.put(tbName, scMap);
}
scMap.put(scName, sdValue);
} } | public class class_name {
public static void setRouteInfo(String scName, String tbName, Object sdValue) {
scName = DDRStringUtils.toLowerCase(scName);
tbName = DDRStringUtils.toLowerCase(tbName);
if (scName == null) {
throw new IllegalArgumentException("'scName' can't be empty");
}
if (tbName == null) {
throw new IllegalArgumentException("'tbName' can't be empty");
}
if (sdValue == null) {
sdValue = NULL_OBJECT; // depends on control dependency: [if], data = [none]
}
/**
* 添加两条查询索引
* schema_name.table_name <-> routeInfo
* table_name <-> routeInfo
*/
Map<String, Object> exactRouteContext = getCurContext().getExactRouteContext();
exactRouteContext.put(buildQueryKey(scName, tbName), sdValue);
Map<String, Map<String, Object>> ambiguousRouteContext = getCurContext().getAmbiguousRouteContext();
Map<String, Object> scMap = ambiguousRouteContext.get(tbName);
if (scMap == null) {
scMap = new HashMap<>(); // depends on control dependency: [if], data = [none]
ambiguousRouteContext.put(tbName, scMap); // depends on control dependency: [if], data = [none]
}
scMap.put(scName, sdValue);
} } |
public class class_name {
public void auditRetrieveDocumentEvent(
RFC3881EventOutcomeCodes eventOutcome,
String consumerIpAddress,
String userName,
String repositoryRetrieveUri, String documentUniqueId)
{
if (!isAuditorEnabled()) {
return;
}
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocument(), null);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
exportEvent.addSourceActiveParticipant(repositoryRetrieveUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false);
if (!EventUtils.isEmptyOrNull(userName)) {
exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List<CodedValueType>) null);
}
exportEvent.addDestinationActiveParticipant(consumerIpAddress, null, null, consumerIpAddress, true);
//exportEvent.addPatientParticipantObject(patientId);
exportEvent.addDocumentUriParticipantObject(repositoryRetrieveUri, documentUniqueId);
audit(exportEvent);
} } | public class class_name {
public void auditRetrieveDocumentEvent(
RFC3881EventOutcomeCodes eventOutcome,
String consumerIpAddress,
String userName,
String repositoryRetrieveUri, String documentUniqueId)
{
if (!isAuditorEnabled()) {
return; // depends on control dependency: [if], data = [none]
}
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocument(), null);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
exportEvent.addSourceActiveParticipant(repositoryRetrieveUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryRetrieveUri, false), false);
if (!EventUtils.isEmptyOrNull(userName)) {
exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, (List<CodedValueType>) null); // depends on control dependency: [if], data = [none]
}
exportEvent.addDestinationActiveParticipant(consumerIpAddress, null, null, consumerIpAddress, true);
//exportEvent.addPatientParticipantObject(patientId);
exportEvent.addDocumentUriParticipantObject(repositoryRetrieveUri, documentUniqueId);
audit(exportEvent);
} } |
public class class_name {
@Override
public void clearRect(int x, int y, int width, int height) {
if (getBackground() == null) {
return; // we can't do anything
}
Paint saved = getPaint();
setPaint(getBackground());
fillRect(x, y, width, height);
setPaint(saved);
} } | public class class_name {
@Override
public void clearRect(int x, int y, int width, int height) {
if (getBackground() == null) {
return; // we can't do anything // depends on control dependency: [if], data = [none]
}
Paint saved = getPaint();
setPaint(getBackground());
fillRect(x, y, width, height);
setPaint(saved);
} } |
public class class_name {
public void setValue(final String key, final String value, final String profile) {
if (profile == null) {
data.putBaseProperty(key, value, false);
} else {
data.putProfileProperty(key, value, profile, false);
}
initialized = false;
} } | public class class_name {
public void setValue(final String key, final String value, final String profile) {
if (profile == null) {
data.putBaseProperty(key, value, false); // depends on control dependency: [if], data = [none]
} else {
data.putProfileProperty(key, value, profile, false); // depends on control dependency: [if], data = [none]
}
initialized = false;
} } |
public class class_name {
protected void execute(String sqlStatement, PrintWriter out, boolean acceptFailure) throws Exception {
try (Connection conn = dataSource.getConnection()) {
try (Statement stmt = conn.createStatement()) {
boolean success = execute(stmt, sqlStatement, out, acceptFailure);
// Loop over all kinds of results.
while (success) { /* 'success' is not modified below this line */
int rowCount = stmt.getUpdateCount();
if (rowCount > 0) {
// --------------------------------------------------
// Result of successful INSERT or UPDATE or the like
// --------------------------------------------------
if (options.debug) {
out.println("Rows affected: " + rowCount);
out.flush();
}
if (stmt.getMoreResults()) {
continue;
}
} else if (rowCount == 0) {
// --------------------------------------------------
// Either a DDL command or 0 updates
// --------------------------------------------------
if (options.debug) {
out.println("No rows affected or statement was DDL command");
out.flush();
}
boolean moreResults;
try {
moreResults = stmt.getMoreResults();
} catch (SQLException sqle) {
// State: 24000 - Invalid cursor state
// [Teradata: Continue request submitted but no response to return]
if (sqle.getSQLState().startsWith("24")) {
break;
} else {
throw sqle;
}
}
if (moreResults) {
continue;
}
} else { // rowCount < 0
// --------------------------------------------------
// Either we have a result set or no more results...
// --------------------------------------------------
ResultSet rs = stmt.getResultSet();
if (null != rs) {
// Ignore resultset
rs.close();
if (stmt.getMoreResults()) {
continue;
}
}
}
// No more results
break;
}
}
} catch (SQLException sqle) {
out.println("Failed to execute statement: \n" + sqlStatement);
out.println("\n\nDescription of failure: \n" + Database.squeeze(sqle));
out.flush();
throw sqle;
} catch (Exception e) {
out.println("Failed to execute statement: \n" + sqlStatement);
out.println("\n\nDescription of failure: \n" + e.getMessage());
out.flush();
throw e;
}
} } | public class class_name {
protected void execute(String sqlStatement, PrintWriter out, boolean acceptFailure) throws Exception {
try (Connection conn = dataSource.getConnection()) {
try (Statement stmt = conn.createStatement()) {
boolean success = execute(stmt, sqlStatement, out, acceptFailure);
// Loop over all kinds of results.
while (success) { /* 'success' is not modified below this line */
int rowCount = stmt.getUpdateCount();
if (rowCount > 0) {
// --------------------------------------------------
// Result of successful INSERT or UPDATE or the like
// --------------------------------------------------
if (options.debug) {
out.println("Rows affected: " + rowCount); // depends on control dependency: [if], data = [none]
out.flush(); // depends on control dependency: [if], data = [none]
}
if (stmt.getMoreResults()) {
continue;
}
} else if (rowCount == 0) {
// --------------------------------------------------
// Either a DDL command or 0 updates
// --------------------------------------------------
if (options.debug) {
out.println("No rows affected or statement was DDL command"); // depends on control dependency: [if], data = [none]
out.flush(); // depends on control dependency: [if], data = [none]
}
boolean moreResults;
try {
moreResults = stmt.getMoreResults(); // depends on control dependency: [try], data = [none]
} catch (SQLException sqle) {
// State: 24000 - Invalid cursor state
// [Teradata: Continue request submitted but no response to return]
if (sqle.getSQLState().startsWith("24")) {
break;
} else {
throw sqle;
}
} // depends on control dependency: [catch], data = [none]
if (moreResults) {
continue;
}
} else { // rowCount < 0
// --------------------------------------------------
// Either we have a result set or no more results...
// --------------------------------------------------
ResultSet rs = stmt.getResultSet();
if (null != rs) {
// Ignore resultset
rs.close(); // depends on control dependency: [if], data = [none]
if (stmt.getMoreResults()) {
continue;
}
}
}
// No more results
break;
}
}
} catch (SQLException sqle) {
out.println("Failed to execute statement: \n" + sqlStatement);
out.println("\n\nDescription of failure: \n" + Database.squeeze(sqle));
out.flush();
throw sqle;
} catch (Exception e) {
out.println("Failed to execute statement: \n" + sqlStatement);
out.println("\n\nDescription of failure: \n" + e.getMessage());
out.flush();
throw e;
}
} } |
public class class_name {
public static int ntz2(long x) {
int n = 0;
int y = (int)x;
if (y==0) {n+=32; y = (int)(x>>>32); } // the only 64 bit shift necessary
if ((y & 0x0000FFFF) == 0) { n+=16; y>>>=16; }
if ((y & 0x000000FF) == 0) { n+=8; y>>>=8; }
return (ntzTable[ y & 0xff ]) + n;
} } | public class class_name {
public static int ntz2(long x) {
int n = 0;
int y = (int)x;
if (y==0) {n+=32; y = (int)(x>>>32); } // the only 64 bit shift necessary // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
if ((y & 0x0000FFFF) == 0) { n+=16; y>>>=16; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
if ((y & 0x000000FF) == 0) { n+=8; y>>>=8; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
return (ntzTable[ y & 0xff ]) + n;
} } |
public class class_name {
@Override
public void close() throws IOException {
if (mClosed) {
return;
}
try {
// This aborts the block if the block is not fully read.
updateBlockWriter(mBlockMeta.getBlockSize());
if (mUnderFileSystemInputStream != null) {
mUfsInstreamManager.release(mUnderFileSystemInputStream);
mUnderFileSystemInputStream = null;
}
if (mBlockWriter != null) {
mBlockWriter.close();
}
mUfsResource.close();
} finally {
mClosed = true;
}
} } | public class class_name {
@Override
public void close() throws IOException {
if (mClosed) {
return;
}
try {
// This aborts the block if the block is not fully read.
updateBlockWriter(mBlockMeta.getBlockSize());
if (mUnderFileSystemInputStream != null) {
mUfsInstreamManager.release(mUnderFileSystemInputStream); // depends on control dependency: [if], data = [(mUnderFileSystemInputStream]
mUnderFileSystemInputStream = null; // depends on control dependency: [if], data = [none]
}
if (mBlockWriter != null) {
mBlockWriter.close(); // depends on control dependency: [if], data = [none]
}
mUfsResource.close();
} finally {
mClosed = true;
}
} } |
public class class_name {
private void success() {
org.hibernate.Transaction txn = session.getTransaction();
if (txn != null && txn.getStatus().equals(TransactionStatus.ACTIVE)) {
txn.commit();
}
} } | public class class_name {
private void success() {
org.hibernate.Transaction txn = session.getTransaction();
if (txn != null && txn.getStatus().equals(TransactionStatus.ACTIVE)) {
txn.commit(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addParameter( String name, String value, boolean encoded )
{
if ( name == null )
{
throw new IllegalArgumentException( "A parameter name may not be null." );
}
if ( !encoded )
{
name = encode( name );
value = encode( value );
}
if ( _parameters == null )
{
_parameters = new QueryParameters();
_opaque = false;
setSchemeSpecificPart( null );
}
_parameters.addParameter(name, value);
} } | public class class_name {
public void addParameter( String name, String value, boolean encoded )
{
if ( name == null )
{
throw new IllegalArgumentException( "A parameter name may not be null." );
}
if ( !encoded )
{
name = encode( name ); // depends on control dependency: [if], data = [none]
value = encode( value ); // depends on control dependency: [if], data = [none]
}
if ( _parameters == null )
{
_parameters = new QueryParameters(); // depends on control dependency: [if], data = [none]
_opaque = false; // depends on control dependency: [if], data = [none]
setSchemeSpecificPart( null ); // depends on control dependency: [if], data = [null )]
}
_parameters.addParameter(name, value);
} } |
public class class_name {
public List<ServiceStatus> getNonCriticalStatuses() {
List<ServiceStatus> list = new ArrayList<ServiceStatus>();
for (MonitoredService m : noncriticals) {
ServiceStatus serviceStatus = m.getServiceStatus();
list.add(serviceStatus);
}
return list;
} } | public class class_name {
public List<ServiceStatus> getNonCriticalStatuses() {
List<ServiceStatus> list = new ArrayList<ServiceStatus>();
for (MonitoredService m : noncriticals) {
ServiceStatus serviceStatus = m.getServiceStatus();
list.add(serviceStatus); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public ValueModel add(String propertyName, ValueModel valueModel, FieldMetadata metadata) {
fieldMetadata.put(propertyName, metadata);
valueModel = preProcessNewValueModel(propertyName, valueModel);
propertyValueModels.put(propertyName, valueModel);
if (logger.isDebugEnabled()) {
logger.debug("Registering '" + propertyName + "' form property, property value model=" + valueModel);
}
postProcessNewValueModel(propertyName, valueModel);
return valueModel;
} } | public class class_name {
public ValueModel add(String propertyName, ValueModel valueModel, FieldMetadata metadata) {
fieldMetadata.put(propertyName, metadata);
valueModel = preProcessNewValueModel(propertyName, valueModel);
propertyValueModels.put(propertyName, valueModel);
if (logger.isDebugEnabled()) {
logger.debug("Registering '" + propertyName + "' form property, property value model=" + valueModel); // depends on control dependency: [if], data = [none]
}
postProcessNewValueModel(propertyName, valueModel);
return valueModel;
} } |
public class class_name {
public static int fnvHash(byte[] data) {
final int p = 16777619;
int hash = (int) 2166136261L;
for (byte b : data) {
hash = (hash ^ b) * p;
}
hash += hash << 13;
hash ^= hash >> 7;
hash += hash << 3;
hash ^= hash >> 17;
hash += hash << 5;
return hash;
} } | public class class_name {
public static int fnvHash(byte[] data) {
final int p = 16777619;
int hash = (int) 2166136261L;
for (byte b : data) {
hash = (hash ^ b) * p;
// depends on control dependency: [for], data = [b]
}
hash += hash << 13;
hash ^= hash >> 7;
hash += hash << 3;
hash ^= hash >> 17;
hash += hash << 5;
return hash;
} } |
public class class_name {
public void marshall(RoleMapping roleMapping, ProtocolMarshaller protocolMarshaller) {
if (roleMapping == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(roleMapping.getType(), TYPE_BINDING);
protocolMarshaller.marshall(roleMapping.getAmbiguousRoleResolution(), AMBIGUOUSROLERESOLUTION_BINDING);
protocolMarshaller.marshall(roleMapping.getRulesConfiguration(), RULESCONFIGURATION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RoleMapping roleMapping, ProtocolMarshaller protocolMarshaller) {
if (roleMapping == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(roleMapping.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(roleMapping.getAmbiguousRoleResolution(), AMBIGUOUSROLERESOLUTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(roleMapping.getRulesConfiguration(), RULESCONFIGURATION_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 init(ServletConfig config)
throws ServletException
{
super.init(config);
try {
if (_service == null) {
String className = getInitParameter("service-class");
Class<?> serviceClass = null;
if (className != null) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader != null)
serviceClass = Class.forName(className, false, loader);
else
serviceClass = Class.forName(className);
}
else {
if (getClass().equals(BurlapServlet.class))
throw new ServletException("server must extend BurlapServlet");
serviceClass = getClass();
}
_service = serviceClass.newInstance();
if (_service instanceof BurlapServlet)
((BurlapServlet) _service).setService(this);
if (_service instanceof Service)
((Service) _service).init(getServletConfig());
else if (_service instanceof Servlet)
((Servlet) _service).init(getServletConfig());
}
if (_apiClass == null) {
String className = getInitParameter("api-class");
if (className != null) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader != null)
_apiClass = Class.forName(className, false, loader);
else
_apiClass = Class.forName(className);
}
else
_apiClass = _service.getClass();
}
_skeleton = new BurlapSkeleton(_service, _apiClass);
} catch (ServletException e) {
throw e;
} catch (Exception e) {
throw new ServletException(e);
}
} } | public class class_name {
public void init(ServletConfig config)
throws ServletException
{
super.init(config);
try {
if (_service == null) {
String className = getInitParameter("service-class");
Class<?> serviceClass = null; // depends on control dependency: [if], data = [none]
if (className != null) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader != null)
serviceClass = Class.forName(className, false, loader);
else
serviceClass = Class.forName(className);
}
else {
if (getClass().equals(BurlapServlet.class))
throw new ServletException("server must extend BurlapServlet");
serviceClass = getClass(); // depends on control dependency: [if], data = [none]
}
_service = serviceClass.newInstance(); // depends on control dependency: [if], data = [none]
if (_service instanceof BurlapServlet)
((BurlapServlet) _service).setService(this);
if (_service instanceof Service)
((Service) _service).init(getServletConfig());
else if (_service instanceof Servlet)
((Servlet) _service).init(getServletConfig());
}
if (_apiClass == null) {
String className = getInitParameter("api-class");
if (className != null) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader != null)
_apiClass = Class.forName(className, false, loader);
else
_apiClass = Class.forName(className);
}
else
_apiClass = _service.getClass();
}
_skeleton = new BurlapSkeleton(_service, _apiClass);
} catch (ServletException e) {
throw e;
} catch (Exception e) {
throw new ServletException(e);
}
} } |
public class class_name {
public void marshall(TypedLinkFacetAttributeUpdate typedLinkFacetAttributeUpdate, ProtocolMarshaller protocolMarshaller) {
if (typedLinkFacetAttributeUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(typedLinkFacetAttributeUpdate.getAttribute(), ATTRIBUTE_BINDING);
protocolMarshaller.marshall(typedLinkFacetAttributeUpdate.getAction(), ACTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TypedLinkFacetAttributeUpdate typedLinkFacetAttributeUpdate, ProtocolMarshaller protocolMarshaller) {
if (typedLinkFacetAttributeUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(typedLinkFacetAttributeUpdate.getAttribute(), ATTRIBUTE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(typedLinkFacetAttributeUpdate.getAction(), ACTION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected BeanDesc getNestedBeanDesc(Field field, Class<?> beanType) {
try {
return BeanDescFactory.getBeanDesc(beanType);
} catch (RuntimeException e) { // may be setAccessible(true) failure
throwExecuteMethodFieldNestedBeanDescFailureException(field, beanType, e);
return null; // unreachable
}
} } | public class class_name {
protected BeanDesc getNestedBeanDesc(Field field, Class<?> beanType) {
try {
return BeanDescFactory.getBeanDesc(beanType); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) { // may be setAccessible(true) failure
throwExecuteMethodFieldNestedBeanDescFailureException(field, beanType, e);
return null; // unreachable
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean isResponseAvailable(int timeout)
throws IOException {
LOG.trace("enter HttpConnection.isResponseAvailable(int)");
if (!this.isOpen) {
return false;
}
boolean result = false;
if (this.inputStream.available() > 0) {
result = true;
} else {
try {
this.socket.setSoTimeout(timeout);
inputStream.mark(1);
int byteRead = inputStream.read();
if (byteRead != -1) {
inputStream.reset();
LOG.debug("Input data available");
result = true;
} else {
LOG.debug("Input data not available");
}
} catch (InterruptedIOException e) {
if (!ExceptionUtil.isSocketTimeoutException(e)) {
throw e;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Input data not available after " + timeout + " ms");
}
} finally {
try {
socket.setSoTimeout(this.params.getSoTimeout());
} catch (IOException ioe) {
LOG.debug("An error ocurred while resetting soTimeout, we will assume that"
+ " no response is available.",
ioe);
result = false;
}
}
}
return result;
} } | public class class_name {
public boolean isResponseAvailable(int timeout)
throws IOException {
LOG.trace("enter HttpConnection.isResponseAvailable(int)");
if (!this.isOpen) {
return false;
}
boolean result = false;
if (this.inputStream.available() > 0) {
result = true;
} else {
try {
this.socket.setSoTimeout(timeout); // depends on control dependency: [try], data = [none]
inputStream.mark(1); // depends on control dependency: [try], data = [none]
int byteRead = inputStream.read();
if (byteRead != -1) {
inputStream.reset(); // depends on control dependency: [if], data = [none]
LOG.debug("Input data available"); // depends on control dependency: [if], data = [none]
result = true; // depends on control dependency: [if], data = [none]
} else {
LOG.debug("Input data not available"); // depends on control dependency: [if], data = [none]
}
} catch (InterruptedIOException e) {
if (!ExceptionUtil.isSocketTimeoutException(e)) {
throw e;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Input data not available after " + timeout + " ms"); // depends on control dependency: [if], data = [none]
}
} finally { // depends on control dependency: [catch], data = [none]
try {
socket.setSoTimeout(this.params.getSoTimeout()); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
LOG.debug("An error ocurred while resetting soTimeout, we will assume that"
+ " no response is available.",
ioe);
result = false;
} // depends on control dependency: [catch], data = [none]
}
}
return result;
} } |
public class class_name {
public static Class<?> loadClassEx(final String qualifiedClassName, final ClassLoader classLoader) throws ClassNotFoundException {
Validate.notNull(qualifiedClassName, "qualifiedClassName must be not null");
ClassLoader loader = (classLoader == null) ? getDefault() : classLoader;
// 尝试基本类型
if (abbreviationMap.containsKey(qualifiedClassName)) {
String className = '[' + abbreviationMap.get(qualifiedClassName);
return Class.forName(className, false, loader).getComponentType();
}
// 尝试用 Class.forName()
try {
String className = getCanonicalClassName(qualifiedClassName);
return Class.forName(className, false, loader);
} catch (ClassNotFoundException e) {
}
// 尝试当做一个内部类去识别
if (qualifiedClassName.indexOf('$') == -1) {
int ipos = qualifiedClassName.lastIndexOf('.');
if (ipos > 0) {
try {
String className = qualifiedClassName.substring(0, ipos) + '$' + qualifiedClassName.substring(ipos + 1);
className = getCanonicalClassName(className);
return Class.forName(className, false, loader);
} catch (ClassNotFoundException e) {
}
}
}
throw new ClassNotFoundException(qualifiedClassName);
} } | public class class_name {
public static Class<?> loadClassEx(final String qualifiedClassName, final ClassLoader classLoader) throws ClassNotFoundException {
Validate.notNull(qualifiedClassName, "qualifiedClassName must be not null");
ClassLoader loader = (classLoader == null) ? getDefault() : classLoader;
// 尝试基本类型
if (abbreviationMap.containsKey(qualifiedClassName)) {
String className = '[' + abbreviationMap.get(qualifiedClassName);
return Class.forName(className, false, loader).getComponentType();
}
// 尝试用 Class.forName()
try {
String className = getCanonicalClassName(qualifiedClassName);
return Class.forName(className, false, loader);
} catch (ClassNotFoundException e) {
}
// 尝试当做一个内部类去识别
if (qualifiedClassName.indexOf('$') == -1) {
int ipos = qualifiedClassName.lastIndexOf('.');
if (ipos > 0) {
try {
String className = qualifiedClassName.substring(0, ipos) + '$' + qualifiedClassName.substring(ipos + 1);
className = getCanonicalClassName(className); // depends on control dependency: [try], data = [none]
return Class.forName(className, false, loader); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
} // depends on control dependency: [catch], data = [none]
}
}
throw new ClassNotFoundException(qualifiedClassName);
} } |
public class class_name {
private <T> HttpUriRequest prepareRequest(URI uri, Map<String, String> headers, String jsonData) {
HttpUriRequest httpRequest;
if (jsonData != null) {
// POST data
HttpPost httpPost = new HttpPost(uri);
httpPost.setEntity(new StringEntity(jsonData, ContentType.APPLICATION_JSON));
httpRequest = httpPost;
} else {
// GET request
httpRequest = new HttpGet(uri);
}
httpRequest.addHeader(HttpHeaders.ACCEPT, "application/json");
headers.forEach(httpRequest::addHeader);
return httpRequest;
} } | public class class_name {
private <T> HttpUriRequest prepareRequest(URI uri, Map<String, String> headers, String jsonData) {
HttpUriRequest httpRequest;
if (jsonData != null) {
// POST data
HttpPost httpPost = new HttpPost(uri);
httpPost.setEntity(new StringEntity(jsonData, ContentType.APPLICATION_JSON)); // depends on control dependency: [if], data = [(jsonData]
httpRequest = httpPost; // depends on control dependency: [if], data = [none]
} else {
// GET request
httpRequest = new HttpGet(uri); // depends on control dependency: [if], data = [none]
}
httpRequest.addHeader(HttpHeaders.ACCEPT, "application/json");
headers.forEach(httpRequest::addHeader);
return httpRequest;
} } |
public class class_name {
private Collection<String> convertToGroups(List<? extends GrantedAuthority> authorities) {
List<String> groups = new ArrayList<String>();
for (GrantedAuthority authority : authorities) {
groups.add(authority.getAuthority());
}
return groups;
} } | public class class_name {
private Collection<String> convertToGroups(List<? extends GrantedAuthority> authorities) {
List<String> groups = new ArrayList<String>();
for (GrantedAuthority authority : authorities) {
groups.add(authority.getAuthority()); // depends on control dependency: [for], data = [authority]
}
return groups;
} } |
public class class_name {
public static Set<String> getWhiteList(String configDir, String property) {
Set<String> set = null;
File whiteListFile = new File(configDir, WHITE_LIST_FILE).getAbsoluteFile();
if (whiteListFile.exists()) {
try (InputStream is = new FileInputStream(whiteListFile)) {
Properties props = new Properties();
props.load(is);
String whiteList = props.getProperty(property);
if (whiteList == null) {
throw new IllegalArgumentException(String.format(WHITE_LIST_PROPERTY_MISSING_MSG, property, whiteListFile));
}
whiteList = whiteList.trim();
if (!whiteList.equals(ALL_VALUES)) {
set = new HashSet<>();
for (String name : whiteList.split(",")) {
name = name.trim();
if (!name.isEmpty()) {
set.add("+" + name.trim());
}
}
}
} catch (IOException ex) {
throw new IllegalArgumentException(String.format(WHITE_LIST_COULD_NOT_LOAD_FILE_MSG,
whiteListFile, ex.toString()), ex);
}
}
return set;
} } | public class class_name {
public static Set<String> getWhiteList(String configDir, String property) {
Set<String> set = null;
File whiteListFile = new File(configDir, WHITE_LIST_FILE).getAbsoluteFile();
if (whiteListFile.exists()) {
try (InputStream is = new FileInputStream(whiteListFile)) {
Properties props = new Properties();
props.load(is); // depends on control dependency: [if], data = [none]
String whiteList = props.getProperty(property);
if (whiteList == null) {
throw new IllegalArgumentException(String.format(WHITE_LIST_PROPERTY_MISSING_MSG, property, whiteListFile));
}
whiteList = whiteList.trim(); // depends on control dependency: [if], data = [none]
if (!whiteList.equals(ALL_VALUES)) {
set = new HashSet<>(); // depends on control dependency: [if], data = [none]
for (String name : whiteList.split(",")) {
name = name.trim(); // depends on control dependency: [for], data = [name]
if (!name.isEmpty()) {
set.add("+" + name.trim()); // depends on control dependency: [if], data = [none]
}
}
}
} catch (IOException ex) {
throw new IllegalArgumentException(String.format(WHITE_LIST_COULD_NOT_LOAD_FILE_MSG,
whiteListFile, ex.toString()), ex);
}
}
return set;
} } |
public class class_name {
@Override
public AnnotationDefinition convert(XBELExternalAnnotationDefinition t) {
if (t == null) {
return null;
}
String id = t.getId();
String url = t.getUrl();
AnnotationDefinition dest = CommonModelFactory.getInstance()
.createAnnotationDefinition(id);
dest.setURL(url);
return dest;
} } | public class class_name {
@Override
public AnnotationDefinition convert(XBELExternalAnnotationDefinition t) {
if (t == null) {
return null; // depends on control dependency: [if], data = [none]
}
String id = t.getId();
String url = t.getUrl();
AnnotationDefinition dest = CommonModelFactory.getInstance()
.createAnnotationDefinition(id);
dest.setURL(url);
return dest;
} } |
public class class_name {
public void marshall(ListHsmsRequest listHsmsRequest, ProtocolMarshaller protocolMarshaller) {
if (listHsmsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listHsmsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListHsmsRequest listHsmsRequest, ProtocolMarshaller protocolMarshaller) {
if (listHsmsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listHsmsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected static boolean isMaskCompatibleWithRange(long value, long upperValue, long maskValue, long maxValue) {
if(value == upperValue || maskValue == maxValue || maskValue == 0) {
return true;
}
//algorithm:
//here we find the highest bit that is part of the range, highestDifferingBitInRange (ie changes from lower to upper)
//then we find the highest bit in the mask that is 1 that is the same or below highestDifferingBitInRange (if such a bit exists)
//this gives us the highest bit that is part of the masked range (ie changes from lower to upper after applying the mask)
//if this latter bit exists, then any bit below it in the mask must be 1 to include the entire range.
long differing = value ^ upperValue;
boolean foundDiffering = (differing != 0);
boolean differingIsLowestBit = (differing == 1);
if(foundDiffering && !differingIsLowestBit) {
int highestDifferingBitInRange = Long.numberOfLeadingZeros(differing);
long maskMask = ~0L >>> highestDifferingBitInRange;
long differingMasked = maskValue & maskMask;
foundDiffering = (differingMasked != 0);
differingIsLowestBit = (differingMasked == 1);
if(foundDiffering && !differingIsLowestBit) {
//anything below highestDifferingBitMasked in the mask must be ones
//Also, if we have masked out any 1 bit in the original, then anything that we do not mask out that follows must be all 1s
int highestDifferingBitMasked = Long.numberOfLeadingZeros(differingMasked);
long hostMask = ~0L >>> (highestDifferingBitMasked + 1);//for the first mask bit that is 1, all bits that follow must also be 1
if((maskValue & hostMask) != hostMask) { //check if all ones below
return false;
}
if(highestDifferingBitMasked > highestDifferingBitInRange) {
//We have masked out a 1 bit, so we need to check that all bits in upper value that we do not mask out are also 1 bits, otherwise we end up missing values in the masked range
//This check is unnecessary for prefix-length subnets, only non-standard ranges might fail this check.
//For instance, if we have range 0000 to 1010
//and we mask upper and lower with 0111
//we get 0000 to 0010, but 0111 was in original range, and the mask of that value retains that value
//so that value needs to be in final range, and it's not.
//What went wrong is that we masked out the top bit, and any other bit that is not masked out must be 1.
//To work, our original range needed to be 0000 to 1111, with the three 1s following the first masked-out 1
long hostMaskUpper = ~0L >>> highestDifferingBitMasked;
if((upperValue & hostMaskUpper) != hostMaskUpper) {
return false;
}
}
}
}
return true;
} } | public class class_name {
protected static boolean isMaskCompatibleWithRange(long value, long upperValue, long maskValue, long maxValue) {
if(value == upperValue || maskValue == maxValue || maskValue == 0) {
return true; // depends on control dependency: [if], data = [none]
}
//algorithm:
//here we find the highest bit that is part of the range, highestDifferingBitInRange (ie changes from lower to upper)
//then we find the highest bit in the mask that is 1 that is the same or below highestDifferingBitInRange (if such a bit exists)
//this gives us the highest bit that is part of the masked range (ie changes from lower to upper after applying the mask)
//if this latter bit exists, then any bit below it in the mask must be 1 to include the entire range.
long differing = value ^ upperValue;
boolean foundDiffering = (differing != 0);
boolean differingIsLowestBit = (differing == 1);
if(foundDiffering && !differingIsLowestBit) {
int highestDifferingBitInRange = Long.numberOfLeadingZeros(differing);
long maskMask = ~0L >>> highestDifferingBitInRange;
long differingMasked = maskValue & maskMask;
foundDiffering = (differingMasked != 0); // depends on control dependency: [if], data = [none]
differingIsLowestBit = (differingMasked == 1); // depends on control dependency: [if], data = [none]
if(foundDiffering && !differingIsLowestBit) {
//anything below highestDifferingBitMasked in the mask must be ones
//Also, if we have masked out any 1 bit in the original, then anything that we do not mask out that follows must be all 1s
int highestDifferingBitMasked = Long.numberOfLeadingZeros(differingMasked);
long hostMask = ~0L >>> (highestDifferingBitMasked + 1);//for the first mask bit that is 1, all bits that follow must also be 1
if((maskValue & hostMask) != hostMask) { //check if all ones below
return false; // depends on control dependency: [if], data = [none]
}
if(highestDifferingBitMasked > highestDifferingBitInRange) {
//We have masked out a 1 bit, so we need to check that all bits in upper value that we do not mask out are also 1 bits, otherwise we end up missing values in the masked range
//This check is unnecessary for prefix-length subnets, only non-standard ranges might fail this check.
//For instance, if we have range 0000 to 1010
//and we mask upper and lower with 0111
//we get 0000 to 0010, but 0111 was in original range, and the mask of that value retains that value
//so that value needs to be in final range, and it's not.
//What went wrong is that we masked out the top bit, and any other bit that is not masked out must be 1.
//To work, our original range needed to be 0000 to 1111, with the three 1s following the first masked-out 1
long hostMaskUpper = ~0L >>> highestDifferingBitMasked;
if((upperValue & hostMaskUpper) != hostMaskUpper) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
}
return true;
} } |
public class class_name {
public void operationTimedOut(InvokeImpl invoke) {
// this op died cause of timeout, TC-L-CANCEL!
try {
this.dialogLock.lock();
int index = getIndexFromInvokeId(invoke.getInvokeId());
freeInvokeId(invoke.getInvokeId());
this.operationsSent[index] = null;
// lets call listener
} finally {
this.dialogLock.unlock();
}
this.provider.operationTimedOut(invoke);
} } | public class class_name {
public void operationTimedOut(InvokeImpl invoke) {
// this op died cause of timeout, TC-L-CANCEL!
try {
this.dialogLock.lock(); // depends on control dependency: [try], data = [none]
int index = getIndexFromInvokeId(invoke.getInvokeId());
freeInvokeId(invoke.getInvokeId()); // depends on control dependency: [try], data = [none]
this.operationsSent[index] = null; // depends on control dependency: [try], data = [none]
// lets call listener
} finally {
this.dialogLock.unlock();
}
this.provider.operationTimedOut(invoke);
} } |
public class class_name {
public static boolean inverseSetContains (@Nonnull final int [] aCodepointSet, final int value)
{
int nStart = 0;
int nEnd = aCodepointSet.length;
while (nEnd - nStart > 8)
{
final int i = (nEnd + nStart) >>> 1;
nStart = aCodepointSet[i] <= value ? i : nStart;
nEnd = aCodepointSet[i] > value ? i : nEnd;
}
while (nStart < nEnd)
{
if (value < aCodepointSet[nStart])
break;
nStart++;
}
return ((nStart - 1) & 1) == 0;
} } | public class class_name {
public static boolean inverseSetContains (@Nonnull final int [] aCodepointSet, final int value)
{
int nStart = 0;
int nEnd = aCodepointSet.length;
while (nEnd - nStart > 8)
{
final int i = (nEnd + nStart) >>> 1;
nStart = aCodepointSet[i] <= value ? i : nStart; // depends on control dependency: [while], data = [none]
nEnd = aCodepointSet[i] > value ? i : nEnd; // depends on control dependency: [while], data = [none]
}
while (nStart < nEnd)
{
if (value < aCodepointSet[nStart])
break;
nStart++; // depends on control dependency: [while], data = [none]
}
return ((nStart - 1) & 1) == 0;
} } |
public class class_name {
public Collection<ArtifactSpec> getDirectDependencies(boolean includeUnsolved, boolean includePresolved) {
Set<ArtifactSpec> deps = new LinkedHashSet<>();
if (includeUnsolved) {
deps.addAll(getDirectDeps());
}
if (includePresolved) {
deps.addAll(presolvedDependencies.getDirectDeps());
}
return deps;
} } | public class class_name {
public Collection<ArtifactSpec> getDirectDependencies(boolean includeUnsolved, boolean includePresolved) {
Set<ArtifactSpec> deps = new LinkedHashSet<>();
if (includeUnsolved) {
deps.addAll(getDirectDeps()); // depends on control dependency: [if], data = [none]
}
if (includePresolved) {
deps.addAll(presolvedDependencies.getDirectDeps()); // depends on control dependency: [if], data = [none]
}
return deps;
} } |
public class class_name {
public Version putWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) {
validateTimeout(requestWrapper.getRoutingTimeoutInMs());
List<Versioned<V>> versionedValues;
long startTime = System.currentTimeMillis();
String keyHexString = "";
if(logger.isDebugEnabled()) {
ByteArray key = (ByteArray) requestWrapper.getKey();
keyHexString = RestUtils.getKeyHexString(key);
logger.debug("PUT requested for key: " + keyHexString + " , for store: "
+ this.storeName + " at time(in ms): " + startTime
+ " . Nested GET and PUT VERSION requests to follow ---");
}
// We use the full timeout for doing the Get. In this, we're being
// optimistic that the subsequent put might be faster such that all the
// steps might finish within the allotted time
requestWrapper.setResolveConflicts(true);
versionedValues = getWithCustomTimeout(requestWrapper);
Versioned<V> versioned = getItemOrThrow(requestWrapper.getKey(), null, versionedValues);
long endTime = System.currentTimeMillis();
if(versioned == null)
versioned = Versioned.value(requestWrapper.getRawValue(), new VectorClock());
else
versioned.setObject(requestWrapper.getRawValue());
// This should not happen unless there's a bug in the
// getWithCustomTimeout
long timeLeft = requestWrapper.getRoutingTimeoutInMs() - (endTime - startTime);
if(timeLeft <= 0) {
throw new StoreTimeoutException("PUT request timed out");
}
CompositeVersionedPutVoldemortRequest<K, V> putVersionedRequestObject = new CompositeVersionedPutVoldemortRequest<K, V>(requestWrapper.getKey(),
versioned,
timeLeft);
putVersionedRequestObject.setRequestOriginTimeInMs(requestWrapper.getRequestOriginTimeInMs());
Version result = putVersionedWithCustomTimeout(putVersionedRequestObject);
long endTimeInMs = System.currentTimeMillis();
if(logger.isDebugEnabled()) {
logger.debug("PUT response received for key: " + keyHexString + " , for store: "
+ this.storeName + " at time(in ms): " + endTimeInMs);
}
return result;
} } | public class class_name {
public Version putWithCustomTimeout(CompositeVoldemortRequest<K, V> requestWrapper) {
validateTimeout(requestWrapper.getRoutingTimeoutInMs());
List<Versioned<V>> versionedValues;
long startTime = System.currentTimeMillis();
String keyHexString = "";
if(logger.isDebugEnabled()) {
ByteArray key = (ByteArray) requestWrapper.getKey();
keyHexString = RestUtils.getKeyHexString(key); // depends on control dependency: [if], data = [none]
logger.debug("PUT requested for key: " + keyHexString + " , for store: "
+ this.storeName + " at time(in ms): " + startTime
+ " . Nested GET and PUT VERSION requests to follow ---"); // depends on control dependency: [if], data = [none]
}
// We use the full timeout for doing the Get. In this, we're being
// optimistic that the subsequent put might be faster such that all the
// steps might finish within the allotted time
requestWrapper.setResolveConflicts(true);
versionedValues = getWithCustomTimeout(requestWrapper);
Versioned<V> versioned = getItemOrThrow(requestWrapper.getKey(), null, versionedValues);
long endTime = System.currentTimeMillis();
if(versioned == null)
versioned = Versioned.value(requestWrapper.getRawValue(), new VectorClock());
else
versioned.setObject(requestWrapper.getRawValue());
// This should not happen unless there's a bug in the
// getWithCustomTimeout
long timeLeft = requestWrapper.getRoutingTimeoutInMs() - (endTime - startTime);
if(timeLeft <= 0) {
throw new StoreTimeoutException("PUT request timed out");
}
CompositeVersionedPutVoldemortRequest<K, V> putVersionedRequestObject = new CompositeVersionedPutVoldemortRequest<K, V>(requestWrapper.getKey(),
versioned,
timeLeft);
putVersionedRequestObject.setRequestOriginTimeInMs(requestWrapper.getRequestOriginTimeInMs());
Version result = putVersionedWithCustomTimeout(putVersionedRequestObject);
long endTimeInMs = System.currentTimeMillis();
if(logger.isDebugEnabled()) {
logger.debug("PUT response received for key: " + keyHexString + " , for store: "
+ this.storeName + " at time(in ms): " + endTimeInMs); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public boolean match(String str) {
if (null != locked && locked.matcher(str).find()) {
return false;
}
if (null != actived && !actived.matcher(str).find()) {
return false;
}
return true;
} } | public class class_name {
public boolean match(String str) {
if (null != locked && locked.matcher(str).find()) {
return false; // depends on control dependency: [if], data = [none]
}
if (null != actived && !actived.matcher(str).find()) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public int getState(Var var, int defaultState) {
Integer state = config.get(var);
if (state == null) {
return defaultState;
} else {
return state;
}
} } | public class class_name {
public int getState(Var var, int defaultState) {
Integer state = config.get(var);
if (state == null) {
return defaultState; // depends on control dependency: [if], data = [none]
} else {
return state; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
Searcher searcher = getSearcher(text, 0);
while (searcher.next())
{
processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value);
}
} } | public class class_name {
public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
Searcher searcher = getSearcher(text, 0);
while (searcher.next())
{
processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
protected void setValueInternal(String argument, char separator, GenericType<?> propertyType) {
if (this.valueAlreadySet) {
CliOptionDuplicateException exception = new CliOptionDuplicateException(getParameterContainer().getName());
CliStyleHandling.EXCEPTION.handle(getLogger(), exception);
}
// TODO: separator currently ignored!
Object value = getDependencies().getConverter().convertValue(argument, getParameterContainer(),
propertyType.getAssignmentClass(), propertyType);
setValueInternal(value);
this.valueAlreadySet = true;
} } | public class class_name {
protected void setValueInternal(String argument, char separator, GenericType<?> propertyType) {
if (this.valueAlreadySet) {
CliOptionDuplicateException exception = new CliOptionDuplicateException(getParameterContainer().getName());
CliStyleHandling.EXCEPTION.handle(getLogger(), exception); // depends on control dependency: [if], data = [none]
}
// TODO: separator currently ignored!
Object value = getDependencies().getConverter().convertValue(argument, getParameterContainer(),
propertyType.getAssignmentClass(), propertyType);
setValueInternal(value);
this.valueAlreadySet = true;
} } |
public class class_name {
public static byte[] toHex(int i) {
StringBuilder buf = new StringBuilder(2);
//don't forget the second hex digit
if ((i & 0xff) < 0x10) {
buf.append("0");
}
buf.append(Long.toString(i & 0xff, 16).toUpperCase());
try {
return buf.toString().getBytes("US-ASCII");
}
catch (Exception e) {
logger.debug("Problem converting bytes to string - {}", e.getMessage());
}
return null;
} } | public class class_name {
public static byte[] toHex(int i) {
StringBuilder buf = new StringBuilder(2);
//don't forget the second hex digit
if ((i & 0xff) < 0x10) {
buf.append("0"); // depends on control dependency: [if], data = [none]
}
buf.append(Long.toString(i & 0xff, 16).toUpperCase());
try {
return buf.toString().getBytes("US-ASCII"); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
logger.debug("Problem converting bytes to string - {}", e.getMessage());
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public boolean shouldVisit(Page referringPage, WebURL url) {
if (myController.getConfig().isRespectNoFollow()) {
return !((referringPage != null &&
referringPage.getContentType() != null &&
referringPage.getContentType().contains("html") &&
((HtmlParseData)referringPage.getParseData())
.getMetaTagValue("robots")
.contains("nofollow")) ||
url.getAttribute("rel").contains("nofollow"));
}
return true;
} } | public class class_name {
public boolean shouldVisit(Page referringPage, WebURL url) {
if (myController.getConfig().isRespectNoFollow()) {
return !((referringPage != null &&
referringPage.getContentType() != null &&
referringPage.getContentType().contains("html") &&
((HtmlParseData)referringPage.getParseData())
.getMetaTagValue("robots")
.contains("nofollow")) ||
url.getAttribute("rel").contains("nofollow")); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public String getFailReason() {
String causeMsg = "";
try {
JSONObject postObj = getObject();
if (postObj != null
&& postObj.has("error")
&& postObj.getJSONObject("error").has("message")) {
causeMsg = postObj.getJSONObject("error").getString("message");
if (causeMsg != null && causeMsg.trim().length() > 0) {
causeMsg = causeMsg + ".";
}
}
} catch (Exception ignore) {
}
return causeMsg;
} } | public class class_name {
public String getFailReason() {
String causeMsg = "";
try {
JSONObject postObj = getObject();
if (postObj != null
&& postObj.has("error")
&& postObj.getJSONObject("error").has("message")) {
causeMsg = postObj.getJSONObject("error").getString("message"); // depends on control dependency: [if], data = [none]
if (causeMsg != null && causeMsg.trim().length() > 0) {
causeMsg = causeMsg + "."; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception ignore) {
} // depends on control dependency: [catch], data = [none]
return causeMsg;
} } |
public class class_name {
private void getLogOddsRatios(VarTensor[] inMsgs, double[][] spanWeights) {
Algebra s = inMsgs[0].getAlgebra();
// Compute the odds ratios of the messages for each edge in the tree.
DoubleArrays.fill(spanWeights, Double.NEGATIVE_INFINITY);
for (VarTensor inMsg : inMsgs) {
SpanVar span = (SpanVar) inMsg.getVars().get(0);
double oddsRatio = s.toLogProb(inMsg.getValue(SpanVar.TRUE)) - s.toLogProb(inMsg.getValue(SpanVar.FALSE));
spanWeights[span.getStart()][span.getEnd()] = oddsRatio;
}
checkSpanWeights(spanWeights);
} } | public class class_name {
private void getLogOddsRatios(VarTensor[] inMsgs, double[][] spanWeights) {
Algebra s = inMsgs[0].getAlgebra();
// Compute the odds ratios of the messages for each edge in the tree.
DoubleArrays.fill(spanWeights, Double.NEGATIVE_INFINITY);
for (VarTensor inMsg : inMsgs) {
SpanVar span = (SpanVar) inMsg.getVars().get(0);
double oddsRatio = s.toLogProb(inMsg.getValue(SpanVar.TRUE)) - s.toLogProb(inMsg.getValue(SpanVar.FALSE));
spanWeights[span.getStart()][span.getEnd()] = oddsRatio; // depends on control dependency: [for], data = [none]
}
checkSpanWeights(spanWeights);
} } |
public class class_name {
protected long copy(InputStream in, OutputStream out) throws IOException
{
// compare classes as in Java6 Channels.newChannel(), Java5 has a bug in newChannel().
boolean inFile = in instanceof FileInputStream && FileInputStream.class.equals(in.getClass());
boolean outFile = out instanceof FileOutputStream && FileOutputStream.class.equals(out.getClass());
if (inFile && outFile)
{
// it's user file
FileChannel infch = ((FileInputStream)in).getChannel();
FileChannel outfch = ((FileOutputStream)out).getChannel();
long size = 0;
long r = 0;
do
{
r = outfch.transferFrom(infch, r, infch.size());
size += r;
}
while (r < infch.size());
return size;
}
else
{
// it's user stream (not a file)
ReadableByteChannel inch = inFile ? ((FileInputStream)in).getChannel() : Channels.newChannel(in);
WritableByteChannel outch = outFile ? ((FileOutputStream)out).getChannel() : Channels.newChannel(out);
long size = 0;
int r = 0;
ByteBuffer buff = ByteBuffer.allocate(IOBUFFER_SIZE);
buff.clear();
while ((r = inch.read(buff)) >= 0)
{
buff.flip();
// copy all
do
{
outch.write(buff);
}
while (buff.hasRemaining());
buff.clear();
size += r;
}
if (outFile)
((FileChannel)outch).force(true); // force all data to FS
return size;
}
} } | public class class_name {
protected long copy(InputStream in, OutputStream out) throws IOException
{
// compare classes as in Java6 Channels.newChannel(), Java5 has a bug in newChannel().
boolean inFile = in instanceof FileInputStream && FileInputStream.class.equals(in.getClass());
boolean outFile = out instanceof FileOutputStream && FileOutputStream.class.equals(out.getClass());
if (inFile && outFile)
{
// it's user file
FileChannel infch = ((FileInputStream)in).getChannel();
FileChannel outfch = ((FileOutputStream)out).getChannel();
long size = 0;
long r = 0;
do
{
r = outfch.transferFrom(infch, r, infch.size());
size += r;
}
while (r < infch.size());
return size;
}
else
{
// it's user stream (not a file)
ReadableByteChannel inch = inFile ? ((FileInputStream)in).getChannel() : Channels.newChannel(in);
WritableByteChannel outch = outFile ? ((FileOutputStream)out).getChannel() : Channels.newChannel(out);
long size = 0;
int r = 0;
ByteBuffer buff = ByteBuffer.allocate(IOBUFFER_SIZE);
buff.clear();
while ((r = inch.read(buff)) >= 0)
{
buff.flip();
// depends on control dependency: [while], data = [none]
// copy all
do
{
outch.write(buff);
}
while (buff.hasRemaining());
buff.clear();
// depends on control dependency: [while], data = [none]
size += r;
// depends on control dependency: [while], data = [none]
}
if (outFile)
((FileChannel)outch).force(true); // force all data to FS
return size;
}
} } |
public class class_name {
@Value("${locator.endpoints}")
public void setLocatorEndpoints(String endpoints) {
settings.setEndpoints(endpoints);
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Locator endpoints set to " + settings.getEndpoints());
}
} } | public class class_name {
@Value("${locator.endpoints}")
public void setLocatorEndpoints(String endpoints) {
settings.setEndpoints(endpoints);
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Locator endpoints set to " + settings.getEndpoints()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Set<OrganizationSet> createCompactionSets(Table tableInfo, Collection<ShardIndexInfo> shards)
{
Collection<Collection<ShardIndexInfo>> shardsByDaysBuckets = getShardsByDaysBuckets(tableInfo, shards, temporalFunction);
ImmutableSet.Builder<OrganizationSet> compactionSets = ImmutableSet.builder();
for (Collection<ShardIndexInfo> shardInfos : shardsByDaysBuckets) {
compactionSets.addAll(buildCompactionSets(tableInfo, ImmutableSet.copyOf(shardInfos)));
}
return compactionSets.build();
} } | public class class_name {
public Set<OrganizationSet> createCompactionSets(Table tableInfo, Collection<ShardIndexInfo> shards)
{
Collection<Collection<ShardIndexInfo>> shardsByDaysBuckets = getShardsByDaysBuckets(tableInfo, shards, temporalFunction);
ImmutableSet.Builder<OrganizationSet> compactionSets = ImmutableSet.builder();
for (Collection<ShardIndexInfo> shardInfos : shardsByDaysBuckets) {
compactionSets.addAll(buildCompactionSets(tableInfo, ImmutableSet.copyOf(shardInfos))); // depends on control dependency: [for], data = [shardInfos]
}
return compactionSets.build();
} } |
public class class_name {
@Override
public T apply(T entity) {
if (this.fraction == '9') {
return entity;
}
int nano = entity.get(NANO_OF_SECOND);
int max = entity.getMaximum(NANO_OF_SECOND);
switch (this.fraction) {
case '3':
nano = (nano / MIO) * MIO + (this.up ? 999999 : 0);
return entity.with(NANO_OF_SECOND, Math.min(max, nano));
case '6':
nano = (nano / KILO) * KILO + (this.up ? 999 : 0);
return entity.with(NANO_OF_SECOND, Math.min(max, nano));
default:
throw new UnsupportedOperationException(
"Unknown: " + this.fraction);
}
} } | public class class_name {
@Override
public T apply(T entity) {
if (this.fraction == '9') {
return entity; // depends on control dependency: [if], data = [none]
}
int nano = entity.get(NANO_OF_SECOND);
int max = entity.getMaximum(NANO_OF_SECOND);
switch (this.fraction) {
case '3':
nano = (nano / MIO) * MIO + (this.up ? 999999 : 0);
return entity.with(NANO_OF_SECOND, Math.min(max, nano));
case '6':
nano = (nano / KILO) * KILO + (this.up ? 999 : 0);
return entity.with(NANO_OF_SECOND, Math.min(max, nano));
default:
throw new UnsupportedOperationException(
"Unknown: " + this.fraction);
}
} } |
public class class_name {
@Override
public String toSource() {
return runInCompilerThread(
() -> {
Tracer tracer = newTracer("toSource");
try {
CodeBuilder cb = new CodeBuilder();
if (jsRoot != null) {
int i = 0;
if (options.shouldPrintExterns()) {
for (Node scriptNode = externsRoot.getFirstChild();
scriptNode != null;
scriptNode = scriptNode.getNext()) {
toSource(cb, i++, scriptNode);
}
}
for (Node scriptNode = jsRoot.getFirstChild();
scriptNode != null;
scriptNode = scriptNode.getNext()) {
toSource(cb, i++, scriptNode);
}
}
return cb.toString();
} finally {
stopTracer(tracer, "toSource");
}
});
} } | public class class_name {
@Override
public String toSource() {
return runInCompilerThread(
() -> {
Tracer tracer = newTracer("toSource");
try {
CodeBuilder cb = new CodeBuilder();
if (jsRoot != null) {
int i = 0;
if (options.shouldPrintExterns()) {
for (Node scriptNode = externsRoot.getFirstChild();
scriptNode != null;
scriptNode = scriptNode.getNext()) {
toSource(cb, i++, scriptNode); // depends on control dependency: [for], data = [scriptNode]
}
}
for (Node scriptNode = jsRoot.getFirstChild();
scriptNode != null;
scriptNode = scriptNode.getNext()) {
toSource(cb, i++, scriptNode); // depends on control dependency: [for], data = [scriptNode]
}
}
return cb.toString(); // depends on control dependency: [try], data = [none]
} finally {
stopTracer(tracer, "toSource");
}
});
} } |
public class class_name {
public boolean isFinished()
{
if (finished)
return true;
try
{
final int code = exitCode();
finished(code);
return true;
}
catch (IllegalThreadStateException e)
{
return false;
}
} } | public class class_name {
public boolean isFinished()
{
if (finished)
return true;
try
{
final int code = exitCode();
finished(code); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
}
catch (IllegalThreadStateException e)
{
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
@SuppressWarnings("unchecked")
public NutMap mergeWith(Map<String, Object> map, boolean onlyAbsent) {
for (Map.Entry<String, Object> en : map.entrySet()) {
String key = en.getKey();
Object val = en.getValue();
if (null == key || null == val)
continue;
Object myVal = this.get(key);
// 如果两边都是 Map ,则融合
if (null != myVal && myVal instanceof Map && val instanceof Map) {
Map<String, Object> m0 = (Map<String, Object>) myVal;
Map<String, Object> m1 = (Map<String, Object>) val;
NutMap m2 = NutMap.WRAP(m0).mergeWith(m1, onlyAbsent);
// 搞出了新 Map,设置一下
if (m2 != m0)
this.put(key, m2);
}
// 只有没有的时候才设置
else if (onlyAbsent) {
this.setnx(key, val);
}
// 否则直接替换
else {
this.put(key, val);
}
}
return this;
} } | public class class_name {
@Override
@SuppressWarnings("unchecked")
public NutMap mergeWith(Map<String, Object> map, boolean onlyAbsent) {
for (Map.Entry<String, Object> en : map.entrySet()) {
String key = en.getKey();
Object val = en.getValue();
if (null == key || null == val)
continue;
Object myVal = this.get(key);
// 如果两边都是 Map ,则融合
if (null != myVal && myVal instanceof Map && val instanceof Map) {
Map<String, Object> m0 = (Map<String, Object>) myVal;
Map<String, Object> m1 = (Map<String, Object>) val;
NutMap m2 = NutMap.WRAP(m0).mergeWith(m1, onlyAbsent);
// 搞出了新 Map,设置一下
if (m2 != m0)
this.put(key, m2);
}
// 只有没有的时候才设置
else if (onlyAbsent) {
this.setnx(key, val);
// depends on control dependency: [if], data = [none]
}
// 否则直接替换
else {
this.put(key, val);
// depends on control dependency: [if], data = [none]
}
}
return this;
} } |
public class class_name {
public CreateDeploymentGroupRequest withEcsServices(ECSService... ecsServices) {
if (this.ecsServices == null) {
setEcsServices(new com.amazonaws.internal.SdkInternalList<ECSService>(ecsServices.length));
}
for (ECSService ele : ecsServices) {
this.ecsServices.add(ele);
}
return this;
} } | public class class_name {
public CreateDeploymentGroupRequest withEcsServices(ECSService... ecsServices) {
if (this.ecsServices == null) {
setEcsServices(new com.amazonaws.internal.SdkInternalList<ECSService>(ecsServices.length)); // depends on control dependency: [if], data = [none]
}
for (ECSService ele : ecsServices) {
this.ecsServices.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public <T extends BaseModel> T getQuietly(String path, Class<T> cls) {
T value;
try {
value = get(path, cls);
return value;
} catch (IOException e) {
LOGGER.debug("getQuietly({}, {})", path, cls.getName(), e);
// TODO: Is returing null a good idea?
return null;
}
} } | public class class_name {
@Override
public <T extends BaseModel> T getQuietly(String path, Class<T> cls) {
T value;
try {
value = get(path, cls); // depends on control dependency: [try], data = [none]
return value; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOGGER.debug("getQuietly({}, {})", path, cls.getName(), e);
// TODO: Is returing null a good idea?
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setAbstractTopic(final SpecTopic abstractTopic) {
if (abstractTopic == null && this.abstractTopic == null) {
return;
} else if (abstractTopic == null) {
removeChild(this.abstractTopic);
this.abstractTopic = null;
} else if (this.abstractTopic == null) {
abstractTopic.setTopicType(TopicType.ABSTRACT);
this.abstractTopic = new KeyValueNode<SpecTopic>(CommonConstants.CS_ABSTRACT_TITLE, abstractTopic);
appendChild(this.abstractTopic, false);
} else {
abstractTopic.setTopicType(TopicType.ABSTRACT);
this.abstractTopic.setValue(abstractTopic);
}
} } | public class class_name {
public void setAbstractTopic(final SpecTopic abstractTopic) {
if (abstractTopic == null && this.abstractTopic == null) {
return; // depends on control dependency: [if], data = [none]
} else if (abstractTopic == null) {
removeChild(this.abstractTopic); // depends on control dependency: [if], data = [none]
this.abstractTopic = null; // depends on control dependency: [if], data = [none]
} else if (this.abstractTopic == null) {
abstractTopic.setTopicType(TopicType.ABSTRACT); // depends on control dependency: [if], data = [none]
this.abstractTopic = new KeyValueNode<SpecTopic>(CommonConstants.CS_ABSTRACT_TITLE, abstractTopic); // depends on control dependency: [if], data = [none]
appendChild(this.abstractTopic, false); // depends on control dependency: [if], data = [(this.abstractTopic]
} else {
abstractTopic.setTopicType(TopicType.ABSTRACT); // depends on control dependency: [if], data = [none]
this.abstractTopic.setValue(abstractTopic); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void onStartServiceEvent(
javax.slee.serviceactivity.ServiceStartedEvent event,
ActivityContextInterface aci) {
tracer.info("Retreiving www.telestax.com...");
try {
HttpClientNIORequestActivity activity = httpClientRA.execute(
new HttpGet("http://www.telestax.com"), null,
System.currentTimeMillis());
httpClientACIF.getActivityContextInterface(activity).attach(
sbbContext.getSbbLocalObject());
} catch (Exception e) {
tracer.severe("failed to retrieve webpage", e);
}
} } | public class class_name {
public void onStartServiceEvent(
javax.slee.serviceactivity.ServiceStartedEvent event,
ActivityContextInterface aci) {
tracer.info("Retreiving www.telestax.com...");
try {
HttpClientNIORequestActivity activity = httpClientRA.execute(
new HttpGet("http://www.telestax.com"), null,
System.currentTimeMillis());
httpClientACIF.getActivityContextInterface(activity).attach(
sbbContext.getSbbLocalObject());
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
tracer.severe("failed to retrieve webpage", e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void setValue(final Object selectedItemId) {
if (selectedItemId != null) {
// Can happen during validation, leading to multiple database
// queries, in order to get the caption property
if (selectedItemId.equals(previousValue)) {
return;
}
selectedValueCaption = Optional.ofNullable(getContainerProperty(selectedItemId, getItemCaptionPropertyId()))
.map(Property::getValue).map(String.class::cast).orElse("");
}
super.setValue(selectedItemId);
previousValue = (Long) selectedItemId;
} } | public class class_name {
@Override
public void setValue(final Object selectedItemId) {
if (selectedItemId != null) {
// Can happen during validation, leading to multiple database
// queries, in order to get the caption property
if (selectedItemId.equals(previousValue)) {
return; // depends on control dependency: [if], data = [none]
}
selectedValueCaption = Optional.ofNullable(getContainerProperty(selectedItemId, getItemCaptionPropertyId()))
.map(Property::getValue).map(String.class::cast).orElse(""); // depends on control dependency: [if], data = [none]
}
super.setValue(selectedItemId);
previousValue = (Long) selectedItemId;
} } |
public class class_name {
public List<FeatureTileLink> queryForFeatureTableName(
String featureTableName) {
List<FeatureTileLink> results = null;
try {
results = queryForEq(FeatureTileLink.COLUMN_FEATURE_TABLE_NAME,
featureTableName);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to query for Feature Tile Link objects by Feature Table Name: "
+ featureTableName);
}
return results;
} } | public class class_name {
public List<FeatureTileLink> queryForFeatureTableName(
String featureTableName) {
List<FeatureTileLink> results = null;
try {
results = queryForEq(FeatureTileLink.COLUMN_FEATURE_TABLE_NAME,
featureTableName); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to query for Feature Tile Link objects by Feature Table Name: "
+ featureTableName);
} // depends on control dependency: [catch], data = [none]
return results;
} } |
public class class_name {
@Override
public void updatePortalCookie(HttpServletRequest request, HttpServletResponse response) {
// Get the portal cookie object
final IPortalCookie portalCookie = this.getOrCreatePortalCookie(request);
// Create the browser cookie
final Cookie cookie =
this.convertToCookie(
portalCookie, this.portalCookieAlwaysSecure || request.isSecure());
// Update the expiration date of the portal cookie stored in the DB if the update interval
// has passed
final DateTime expires = portalCookie.getExpires();
if (DateTime.now()
.minusMillis(this.maxAgeUpdateInterval)
.isAfter(expires.minusSeconds(this.maxAge))) {
try {
this.portletCookieDao.updatePortalCookieExpiration(
portalCookie, cookie.getMaxAge());
} catch (HibernateOptimisticLockingFailureException e) {
// Especially with ngPortal UI multiple requests for individual portlet content may
// come at
// the same time. Sometimes another thread updated the portal cookie between our
// dao fetch and
// dao update. If this happens, simply ignore the update since another thread has
// already
// made the update.
logger.debug(
"Attempted to update expired portal cookie but another thread beat me to it."
+ " Ignoring update since the other thread handled it.");
return;
}
// Update expiration dates of portlet cookies stored in session
removeExpiredPortletCookies(request);
}
// Update the cookie in the users browser
response.addCookie(cookie);
} } | public class class_name {
@Override
public void updatePortalCookie(HttpServletRequest request, HttpServletResponse response) {
// Get the portal cookie object
final IPortalCookie portalCookie = this.getOrCreatePortalCookie(request);
// Create the browser cookie
final Cookie cookie =
this.convertToCookie(
portalCookie, this.portalCookieAlwaysSecure || request.isSecure());
// Update the expiration date of the portal cookie stored in the DB if the update interval
// has passed
final DateTime expires = portalCookie.getExpires();
if (DateTime.now()
.minusMillis(this.maxAgeUpdateInterval)
.isAfter(expires.minusSeconds(this.maxAge))) {
try {
this.portletCookieDao.updatePortalCookieExpiration(
portalCookie, cookie.getMaxAge()); // depends on control dependency: [try], data = [none]
} catch (HibernateOptimisticLockingFailureException e) {
// Especially with ngPortal UI multiple requests for individual portlet content may
// come at
// the same time. Sometimes another thread updated the portal cookie between our
// dao fetch and
// dao update. If this happens, simply ignore the update since another thread has
// already
// made the update.
logger.debug(
"Attempted to update expired portal cookie but another thread beat me to it."
+ " Ignoring update since the other thread handled it.");
return;
} // depends on control dependency: [catch], data = [none]
// Update expiration dates of portlet cookies stored in session
removeExpiredPortletCookies(request); // depends on control dependency: [if], data = [none]
}
// Update the cookie in the users browser
response.addCookie(cookie);
} } |
public class class_name {
<T> Method getPrimaryHashKeyGetter(Class<T> clazz) {
Method hashKeyMethod;
synchronized (primaryHashKeyGetterCache) {
if ( !primaryHashKeyGetterCache.containsKey(clazz) ) {
for ( Method method : getRelevantGetters(clazz) ) {
if ( method.getParameterTypes().length == 0
&& ReflectionUtils.getterOrFieldHasAnnotation(method, DynamoDBHashKey.class)) {
primaryHashKeyGetterCache.put(clazz, method);
break;
}
}
}
hashKeyMethod = primaryHashKeyGetterCache.get(clazz);
}
if ( hashKeyMethod == null ) {
throw new DynamoDBMappingException("Public, zero-parameter hash key property must be annotated with "
+ DynamoDBHashKey.class);
}
return hashKeyMethod;
} } | public class class_name {
<T> Method getPrimaryHashKeyGetter(Class<T> clazz) {
Method hashKeyMethod;
synchronized (primaryHashKeyGetterCache) {
if ( !primaryHashKeyGetterCache.containsKey(clazz) ) {
for ( Method method : getRelevantGetters(clazz) ) {
if ( method.getParameterTypes().length == 0
&& ReflectionUtils.getterOrFieldHasAnnotation(method, DynamoDBHashKey.class)) {
primaryHashKeyGetterCache.put(clazz, method); // depends on control dependency: [if], data = [none]
break;
}
}
}
hashKeyMethod = primaryHashKeyGetterCache.get(clazz);
}
if ( hashKeyMethod == null ) {
throw new DynamoDBMappingException("Public, zero-parameter hash key property must be annotated with "
+ DynamoDBHashKey.class);
}
return hashKeyMethod;
} } |
public class class_name {
private List<ServiceRegistration<?>> registerLibraryServices(final Library library, Set<String> serviceNames) {
final BundleContext context = getGatewayBundleContext(library);
if (context == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "registerLibraryServices: can't find bundle ", library.id());
}
return Collections.emptyList();
}
final List<ServiceInfo> serviceInfos = new LinkedList<ServiceInfo>();
for (final ArtifactContainer ac : library.getContainers()) {
final ArtifactEntry servicesFolder = ac.getEntry("META-INF/services");
if (servicesFolder == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No META-INF services folder in the container: ", ac);
}
continue;
}
serviceInfos.addAll(getListOfServicesForContainer(servicesFolder.convertToContainer(), library, serviceNames));
}
final List<ServiceRegistration<?>> libServices;
if (serviceInfos.size() == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isInfoEnabled()) {
Tr.warning(tc, "bell.no.services.found", library.id());
}
libServices = Collections.emptyList();
} else {
libServices = registerServices(serviceInfos, library, context);
}
return libServices;
} } | public class class_name {
private List<ServiceRegistration<?>> registerLibraryServices(final Library library, Set<String> serviceNames) {
final BundleContext context = getGatewayBundleContext(library);
if (context == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "registerLibraryServices: can't find bundle ", library.id()); // depends on control dependency: [if], data = [none]
}
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
final List<ServiceInfo> serviceInfos = new LinkedList<ServiceInfo>();
for (final ArtifactContainer ac : library.getContainers()) {
final ArtifactEntry servicesFolder = ac.getEntry("META-INF/services");
if (servicesFolder == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No META-INF services folder in the container: ", ac); // depends on control dependency: [if], data = [none]
}
continue;
}
serviceInfos.addAll(getListOfServicesForContainer(servicesFolder.convertToContainer(), library, serviceNames)); // depends on control dependency: [for], data = [none]
}
final List<ServiceRegistration<?>> libServices;
if (serviceInfos.size() == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isInfoEnabled()) {
Tr.warning(tc, "bell.no.services.found", library.id()); // depends on control dependency: [if], data = [none]
}
libServices = Collections.emptyList();
} else {
libServices = registerServices(serviceInfos, library, context);
}
return libServices;
} } |
public class class_name {
private void processModel(final Model readModel) {
this.model = readModel;
Parent parent = readModel.getParent();
if (this.groupId == null) {
this.groupId = readModel.getGroupId();
if (this.groupId == null && parent != null) {
this.groupId = parent.getGroupId();
}
}
if (this.artifactId == null) {
this.artifactId = readModel.getArtifactId();
}
if (this.version == null) {
this.version = readModel.getVersion();
if (this.version == null && parent != null) {
this.version = parent.getVersion();
}
}
if (this.packaging == null) {
this.packaging = readModel.getPackaging();
}
} } | public class class_name {
private void processModel(final Model readModel) {
this.model = readModel;
Parent parent = readModel.getParent();
if (this.groupId == null) {
this.groupId = readModel.getGroupId();
// depends on control dependency: [if], data = [none]
if (this.groupId == null && parent != null) {
this.groupId = parent.getGroupId();
// depends on control dependency: [if], data = [none]
}
}
if (this.artifactId == null) {
this.artifactId = readModel.getArtifactId();
// depends on control dependency: [if], data = [none]
}
if (this.version == null) {
this.version = readModel.getVersion();
// depends on control dependency: [if], data = [none]
if (this.version == null && parent != null) {
this.version = parent.getVersion();
// depends on control dependency: [if], data = [none]
}
}
if (this.packaging == null) {
this.packaging = readModel.getPackaging();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void clearCacheIncludingAncestors() {
clearCache();
if (getParentMessageSource() instanceof ReloadableResourceBundleMessageSource) {
((ReloadableResourceBundleMessageSource) getParentMessageSource()).clearCacheIncludingAncestors();
} else if (getParentMessageSource() instanceof org.springframework.context.support.ReloadableResourceBundleMessageSource) {
((org.springframework.context.support.ReloadableResourceBundleMessageSource) getParentMessageSource()).clearCacheIncludingAncestors();
}
} } | public class class_name {
public void clearCacheIncludingAncestors() {
clearCache();
if (getParentMessageSource() instanceof ReloadableResourceBundleMessageSource) {
((ReloadableResourceBundleMessageSource) getParentMessageSource()).clearCacheIncludingAncestors(); // depends on control dependency: [if], data = [none]
} else if (getParentMessageSource() instanceof org.springframework.context.support.ReloadableResourceBundleMessageSource) {
((org.springframework.context.support.ReloadableResourceBundleMessageSource) getParentMessageSource()).clearCacheIncludingAncestors(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private final MultimapSubject delegate() {
MultimapSubject delegate = check().that(actual());
if (internalCustomName() != null) {
delegate = delegate.named(internalCustomName());
}
return delegate;
} } | public class class_name {
private final MultimapSubject delegate() {
MultimapSubject delegate = check().that(actual());
if (internalCustomName() != null) {
delegate = delegate.named(internalCustomName()); // depends on control dependency: [if], data = [(internalCustomName()]
}
return delegate;
} } |
public class class_name {
public final String getTranslatedName(ResourceBundle messages) {
try {
return messages.getString(getShortCodeWithCountryAndVariant());
} catch (MissingResourceException e) {
try {
return messages.getString(getShortCode());
} catch (MissingResourceException e1) {
return getName();
}
}
} } | public class class_name {
public final String getTranslatedName(ResourceBundle messages) {
try {
return messages.getString(getShortCodeWithCountryAndVariant()); // depends on control dependency: [try], data = [none]
} catch (MissingResourceException e) {
try {
return messages.getString(getShortCode()); // depends on control dependency: [try], data = [none]
} catch (MissingResourceException e1) {
return getName();
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(ResourceComplianceSummaryItem resourceComplianceSummaryItem, ProtocolMarshaller protocolMarshaller) {
if (resourceComplianceSummaryItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resourceComplianceSummaryItem.getComplianceType(), COMPLIANCETYPE_BINDING);
protocolMarshaller.marshall(resourceComplianceSummaryItem.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(resourceComplianceSummaryItem.getResourceId(), RESOURCEID_BINDING);
protocolMarshaller.marshall(resourceComplianceSummaryItem.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(resourceComplianceSummaryItem.getOverallSeverity(), OVERALLSEVERITY_BINDING);
protocolMarshaller.marshall(resourceComplianceSummaryItem.getExecutionSummary(), EXECUTIONSUMMARY_BINDING);
protocolMarshaller.marshall(resourceComplianceSummaryItem.getCompliantSummary(), COMPLIANTSUMMARY_BINDING);
protocolMarshaller.marshall(resourceComplianceSummaryItem.getNonCompliantSummary(), NONCOMPLIANTSUMMARY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ResourceComplianceSummaryItem resourceComplianceSummaryItem, ProtocolMarshaller protocolMarshaller) {
if (resourceComplianceSummaryItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resourceComplianceSummaryItem.getComplianceType(), COMPLIANCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resourceComplianceSummaryItem.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resourceComplianceSummaryItem.getResourceId(), RESOURCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resourceComplianceSummaryItem.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resourceComplianceSummaryItem.getOverallSeverity(), OVERALLSEVERITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resourceComplianceSummaryItem.getExecutionSummary(), EXECUTIONSUMMARY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resourceComplianceSummaryItem.getCompliantSummary(), COMPLIANTSUMMARY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(resourceComplianceSummaryItem.getNonCompliantSummary(), NONCOMPLIANTSUMMARY_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 void getUserSuggestions(final String categorySlug) {
getDispatcher().invokeLater(new AsyncTask(USER_SUGGESTIONS, listeners) {
@Override
public void invoke(List<TwitterListener> listeners) throws TwitterException {
ResponseList<User> users = twitter.getUserSuggestions(categorySlug);
for (TwitterListener listener : listeners) {
try {
listener.gotUserSuggestions(users);
} catch (Exception e) {
logger.warn("Exception at getUserSuggestions", e);
}
}
}
});
} } | public class class_name {
@Override
public void getUserSuggestions(final String categorySlug) {
getDispatcher().invokeLater(new AsyncTask(USER_SUGGESTIONS, listeners) {
@Override
public void invoke(List<TwitterListener> listeners) throws TwitterException {
ResponseList<User> users = twitter.getUserSuggestions(categorySlug);
for (TwitterListener listener : listeners) {
try {
listener.gotUserSuggestions(users); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.warn("Exception at getUserSuggestions", e);
} // depends on control dependency: [catch], data = [none]
}
}
});
} } |
public class class_name {
private static void changeScene(@NonNull Scene scene, @Nullable Transition transition) {
final ViewGroup sceneRoot = scene.getSceneRoot();
if (!sPendingTransitions.contains(sceneRoot)) {
Transition transitionClone = null;
if (isTransitionsAllowed()) {
sPendingTransitions.add(sceneRoot);
if (transition != null) {
transitionClone = transition.clone();
transitionClone.setSceneRoot(sceneRoot);
}
Scene oldScene = Scene.getCurrentScene(sceneRoot);
if (oldScene != null && transitionClone != null &&
oldScene.isCreatedFromLayoutResource()) {
transitionClone.setCanRemoveViews(true);
}
}
sceneChangeSetup(sceneRoot, transitionClone);
scene.enter();
sceneChangeRunTransition(sceneRoot, transitionClone);
}
} } | public class class_name {
private static void changeScene(@NonNull Scene scene, @Nullable Transition transition) {
final ViewGroup sceneRoot = scene.getSceneRoot();
if (!sPendingTransitions.contains(sceneRoot)) {
Transition transitionClone = null;
if (isTransitionsAllowed()) {
sPendingTransitions.add(sceneRoot); // depends on control dependency: [if], data = [none]
if (transition != null) {
transitionClone = transition.clone(); // depends on control dependency: [if], data = [none]
transitionClone.setSceneRoot(sceneRoot); // depends on control dependency: [if], data = [none]
}
Scene oldScene = Scene.getCurrentScene(sceneRoot);
if (oldScene != null && transitionClone != null &&
oldScene.isCreatedFromLayoutResource()) {
transitionClone.setCanRemoveViews(true); // depends on control dependency: [if], data = [none]
}
}
sceneChangeSetup(sceneRoot, transitionClone); // depends on control dependency: [if], data = [none]
scene.enter(); // depends on control dependency: [if], data = [none]
sceneChangeRunTransition(sceneRoot, transitionClone); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Method getMethodOfObj(Object obj, String methodName, Object... args) throws SecurityException {
if (null == obj || StrUtil.isBlank(methodName)) {
return null;
}
return getMethod(obj.getClass(), methodName, ClassUtil.getClasses(args));
} } | public class class_name {
public static Method getMethodOfObj(Object obj, String methodName, Object... args) throws SecurityException {
if (null == obj || StrUtil.isBlank(methodName)) {
return null;
// depends on control dependency: [if], data = [none]
}
return getMethod(obj.getClass(), methodName, ClassUtil.getClasses(args));
} } |
public class class_name {
public synchronized boolean checkCondition(Simon simon, Object... params) throws ScriptException {
if (condition == null) {
return true;
}
if (simon instanceof Stopwatch) {
return checkStopwtach((Stopwatch) simon, params);
}
if (simon instanceof Counter) {
return checkCounter((Counter) simon, params);
}
return true;
} } | public class class_name {
public synchronized boolean checkCondition(Simon simon, Object... params) throws ScriptException {
if (condition == null) {
return true;
// depends on control dependency: [if], data = [none]
}
if (simon instanceof Stopwatch) {
return checkStopwtach((Stopwatch) simon, params);
// depends on control dependency: [if], data = [none]
}
if (simon instanceof Counter) {
return checkCounter((Counter) simon, params);
// depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
private static String getValue(Enum<?> value){
try{
Method m = value.getClass().getDeclaredMethod("value");
return (String) m.invoke(value);
} catch (NoSuchMethodException ex){
} catch (IllegalAccessException ex){
} catch (InvocationTargetException ex){
}
return value.toString();
} } | public class class_name {
private static String getValue(Enum<?> value){
try{
Method m = value.getClass().getDeclaredMethod("value");
return (String) m.invoke(value); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException ex){
} catch (IllegalAccessException ex){ // depends on control dependency: [catch], data = [none]
} catch (InvocationTargetException ex){ // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
return value.toString();
} } |
public class class_name {
public void initialRead() {
try {
this.buffer = this.isc.getRequestBodyBuffer();
if (null != this.buffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Buffer returned from getRequestBodyBuffer : " + this.buffer);
}
// record the new amount of data read from the channel
this.bytesRead += this.buffer.remaining();
}
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception encountered during initialRead : " + e);
}
}
} } | public class class_name {
public void initialRead() {
try {
this.buffer = this.isc.getRequestBodyBuffer(); // depends on control dependency: [try], data = [none]
if (null != this.buffer) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Buffer returned from getRequestBodyBuffer : " + this.buffer); // depends on control dependency: [if], data = [none]
}
// record the new amount of data read from the channel
this.bytesRead += this.buffer.remaining(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception encountered during initialRead : " + e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.