code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public void displaySuggestions(boolean display) {
if (display) {
recyclerView.setVisibility(RecyclerView.VISIBLE);
} else {
recyclerView.setVisibility(RecyclerView.GONE);
}
} } | public class class_name {
@Override
public void displaySuggestions(boolean display) {
if (display) {
recyclerView.setVisibility(RecyclerView.VISIBLE); // depends on control dependency: [if], data = [none]
} else {
recyclerView.setVisibility(RecyclerView.GONE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DeleteUserRequest deleteUserRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteUserRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteUserRequest.getUserName(), USERNAME_BINDING);
protocolMarshaller.marshall(deleteUserRequest.getAwsAccountId(), AWSACCOUNTID_BINDING);
protocolMarshaller.marshall(deleteUserRequest.getNamespace(), NAMESPACE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteUserRequest deleteUserRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteUserRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteUserRequest.getUserName(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteUserRequest.getAwsAccountId(), AWSACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteUserRequest.getNamespace(), NAMESPACE_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 int calculateShift(int minimumValue, int maximumValue) {
int shift = 0;
int value = 1;
while (value < minimumValue && value < maximumValue) {
value <<= 1;
shift++;
}
return shift;
} } | public class class_name {
protected static int calculateShift(int minimumValue, int maximumValue) {
int shift = 0;
int value = 1;
while (value < minimumValue && value < maximumValue) {
value <<= 1; // depends on control dependency: [while], data = [none]
shift++; // depends on control dependency: [while], data = [none]
}
return shift;
} } |
public class class_name {
@Nullable
final T blockingGet(long timeout, TimeUnit unit) {
if (Schedulers.isInNonBlockingThread()) {
throw new IllegalStateException("block()/blockFirst()/blockLast() are blocking, which is not supported in thread " + Thread.currentThread().getName());
}
if (getCount() != 0) {
try {
if (!await(timeout, unit)) {
dispose();
throw new IllegalStateException("Timeout on blocking read for " + timeout + " " + unit);
}
}
catch (InterruptedException ex) {
dispose();
RuntimeException re = Exceptions.propagate(ex);
//this is ok, as re is always a new non-singleton instance
re.addSuppressed(new Exception("#block has been interrupted"));
throw re;
}
}
Throwable e = error;
if (e != null) {
RuntimeException re = Exceptions.propagate(e);
//this is ok, as re is always a new non-singleton instance
re.addSuppressed(new Exception("#block terminated with an error"));
throw re;
}
return value;
} } | public class class_name {
@Nullable
final T blockingGet(long timeout, TimeUnit unit) {
if (Schedulers.isInNonBlockingThread()) {
throw new IllegalStateException("block()/blockFirst()/blockLast() are blocking, which is not supported in thread " + Thread.currentThread().getName());
}
if (getCount() != 0) {
try {
if (!await(timeout, unit)) {
dispose(); // depends on control dependency: [if], data = [none]
throw new IllegalStateException("Timeout on blocking read for " + timeout + " " + unit);
}
}
catch (InterruptedException ex) {
dispose();
RuntimeException re = Exceptions.propagate(ex);
//this is ok, as re is always a new non-singleton instance
re.addSuppressed(new Exception("#block has been interrupted"));
throw re;
} // depends on control dependency: [catch], data = [none]
}
Throwable e = error;
if (e != null) {
RuntimeException re = Exceptions.propagate(e);
//this is ok, as re is always a new non-singleton instance
re.addSuppressed(new Exception("#block terminated with an error")); // depends on control dependency: [if], data = [none]
throw re;
}
return value;
} } |
public class class_name {
private void handleSetProperty(final Element element, final Map<String, Object> entityData, final Map<String, Object> config) {
String propertyName = (String)config.get(PROPERTY_NAME);
if (propertyName == null) {
propertyName = element.tagName;
}
entityData.put(propertyName, element.text);
} } | public class class_name {
private void handleSetProperty(final Element element, final Map<String, Object> entityData, final Map<String, Object> config) {
String propertyName = (String)config.get(PROPERTY_NAME);
if (propertyName == null) {
propertyName = element.tagName; // depends on control dependency: [if], data = [none]
}
entityData.put(propertyName, element.text);
} } |
public class class_name {
private static void removeFinishedCatchBlocks(Iterable<CatchInfo> infos, int pc) {
Iterator<CatchInfo> it = infos.iterator();
while (it.hasNext()) {
if (it.next().getFinish() < pc) {
it.remove();
}
}
} } | public class class_name {
private static void removeFinishedCatchBlocks(Iterable<CatchInfo> infos, int pc) {
Iterator<CatchInfo> it = infos.iterator();
while (it.hasNext()) {
if (it.next().getFinish() < pc) {
it.remove(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void sendRequest(Message request, Object context, Message.Builder responseBuilder,
Duration timeout) {
// Pack it as a no-timeout request and send it!
final REQID rid = REQID.generate();
contextMap.put(rid, context);
responseMessageMap.put(rid, responseBuilder);
// Add timeout for this request if necessary
if (timeout.getSeconds() > 0) {
registerTimerEvent(timeout, new Runnable() {
@Override
public void run() {
handleTimeout(rid);
}
});
}
OutgoingPacket opk = new OutgoingPacket(rid, request);
socketChannelHelper.sendPacket(opk);
} } | public class class_name {
public void sendRequest(Message request, Object context, Message.Builder responseBuilder,
Duration timeout) {
// Pack it as a no-timeout request and send it!
final REQID rid = REQID.generate();
contextMap.put(rid, context);
responseMessageMap.put(rid, responseBuilder);
// Add timeout for this request if necessary
if (timeout.getSeconds() > 0) {
registerTimerEvent(timeout, new Runnable() {
@Override
public void run() {
handleTimeout(rid);
}
}); // depends on control dependency: [if], data = [none]
}
OutgoingPacket opk = new OutgoingPacket(rid, request);
socketChannelHelper.sendPacket(opk);
} } |
public class class_name {
public void setArrayIfNotEmpty(@NotNull final String key, @Nullable final List<String> value) {
if (null != value && !value.isEmpty()) {
setString(key, new Gson().toJson(value));
}
} } | public class class_name {
public void setArrayIfNotEmpty(@NotNull final String key, @Nullable final List<String> value) {
if (null != value && !value.isEmpty()) {
setString(key, new Gson().toJson(value)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void setRequestUrl(MockServletRequest request,
Map<String, String> variantMap, String path, JawrConfig config) {
String domainURL = JawrConstant.HTTP_URL_PREFIX + DEFAULT_WEBAPP_URL;
if (JawrConstant.SSL.equals(variantMap
.get(JawrConstant.CONNECTION_TYPE_VARIANT_TYPE))) {
// Use the contextPathSslOverride property if it's an absolute URL
if (StringUtils.isNotEmpty(config.getContextPathSslOverride())
&& config.getContextPathSslOverride().startsWith(
JawrConstant.HTTPS_URL_PREFIX)) {
domainURL = config.getContextPathSslOverride();
} else {
domainURL = JawrConstant.HTTPS_URL_PREFIX + DEFAULT_WEBAPP_URL;
}
} else {
// Use the contextPathOverride property if it's an absolute URL
if (StringUtils.isNotEmpty(config.getContextPathOverride())
&& config.getContextPathOverride().startsWith(
JawrConstant.HTTP_URL_PREFIX)) {
domainURL = config.getContextPathOverride();
} else {
domainURL = JawrConstant.HTTP_URL_PREFIX + DEFAULT_WEBAPP_URL;
}
}
request.setRequestUrl(PathNormalizer.joinDomainToPath(domainURL, path));
} } | public class class_name {
protected void setRequestUrl(MockServletRequest request,
Map<String, String> variantMap, String path, JawrConfig config) {
String domainURL = JawrConstant.HTTP_URL_PREFIX + DEFAULT_WEBAPP_URL;
if (JawrConstant.SSL.equals(variantMap
.get(JawrConstant.CONNECTION_TYPE_VARIANT_TYPE))) {
// Use the contextPathSslOverride property if it's an absolute URL
if (StringUtils.isNotEmpty(config.getContextPathSslOverride())
&& config.getContextPathSslOverride().startsWith(
JawrConstant.HTTPS_URL_PREFIX)) {
domainURL = config.getContextPathSslOverride(); // depends on control dependency: [if], data = [none]
} else {
domainURL = JawrConstant.HTTPS_URL_PREFIX + DEFAULT_WEBAPP_URL; // depends on control dependency: [if], data = [none]
}
} else {
// Use the contextPathOverride property if it's an absolute URL
if (StringUtils.isNotEmpty(config.getContextPathOverride())
&& config.getContextPathOverride().startsWith(
JawrConstant.HTTP_URL_PREFIX)) {
domainURL = config.getContextPathOverride(); // depends on control dependency: [if], data = [none]
} else {
domainURL = JawrConstant.HTTP_URL_PREFIX + DEFAULT_WEBAPP_URL; // depends on control dependency: [if], data = [none]
}
}
request.setRequestUrl(PathNormalizer.joinDomainToPath(domainURL, path));
} } |
public class class_name {
public void setId(String name, Object value)
{
if (name == null)
{
idPropertyName = null;
idValue = null;
}
else
{
idPropertyName= name;
idValue = value;
}
} } | public class class_name {
public void setId(String name, Object value)
{
if (name == null)
{
idPropertyName = null; // depends on control dependency: [if], data = [none]
idValue = null; // depends on control dependency: [if], data = [none]
}
else
{
idPropertyName= name; // depends on control dependency: [if], data = [none]
idValue = value; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected synchronized File getExternalStorageDirectory() {
File externalStorageDirectory;
if (Build.VERSION.SDK_INT >= 8 && mContext != null) {
externalStorageDirectory = mContext.getExternalCacheDir();
} else {
externalStorageDirectory = Environment.getExternalStorageDirectory();
}
if (externalStorageDirectory != null) {
if (!externalStorageDirectory.exists()) {
if (!externalStorageDirectory.mkdirs()) {
externalStorageDirectory = null;
Log.e(TAG, "mkdirs failed on externalStorageDirectory "
+ externalStorageDirectory);
}
}
}
return externalStorageDirectory;
} } | public class class_name {
protected synchronized File getExternalStorageDirectory() {
File externalStorageDirectory;
if (Build.VERSION.SDK_INT >= 8 && mContext != null) {
externalStorageDirectory = mContext.getExternalCacheDir(); // depends on control dependency: [if], data = [none]
} else {
externalStorageDirectory = Environment.getExternalStorageDirectory(); // depends on control dependency: [if], data = [none]
}
if (externalStorageDirectory != null) {
if (!externalStorageDirectory.exists()) {
if (!externalStorageDirectory.mkdirs()) {
externalStorageDirectory = null; // depends on control dependency: [if], data = [none]
Log.e(TAG, "mkdirs failed on externalStorageDirectory "
+ externalStorageDirectory); // depends on control dependency: [if], data = [none]
}
}
}
return externalStorageDirectory;
} } |
public class class_name {
public Set<UserView> getAllActiveUsersForProject(ProjectView projectView) throws IntegrationException {
Set<UserView> users = new HashSet<>();
List<AssignedUserGroupView> assignedGroups = getAssignedGroupsToProject(projectView);
for (AssignedUserGroupView assignedUserGroupView : assignedGroups) {
if (assignedUserGroupView.getActive()) {
UserGroupView userGroupView = blackDuckService.getResponse(assignedUserGroupView.getGroup(), UserGroupView.class);
if (userGroupView.getActive()) {
List<UserView> groupUsers = blackDuckService.getAllResponses(userGroupView, UserGroupView.USERS_LINK_RESPONSE);
users.addAll(groupUsers);
}
}
}
List<AssignedUserView> assignedUsers = getAssignedUsersToProject(projectView);
for (AssignedUserView assignedUser : assignedUsers) {
UserView userView = blackDuckService.getResponse(assignedUser.getUser(), UserView.class);
users.add(userView);
}
return users
.stream()
.filter(userView -> userView.getActive())
.collect(Collectors.toSet());
} } | public class class_name {
public Set<UserView> getAllActiveUsersForProject(ProjectView projectView) throws IntegrationException {
Set<UserView> users = new HashSet<>();
List<AssignedUserGroupView> assignedGroups = getAssignedGroupsToProject(projectView);
for (AssignedUserGroupView assignedUserGroupView : assignedGroups) {
if (assignedUserGroupView.getActive()) {
UserGroupView userGroupView = blackDuckService.getResponse(assignedUserGroupView.getGroup(), UserGroupView.class);
if (userGroupView.getActive()) {
List<UserView> groupUsers = blackDuckService.getAllResponses(userGroupView, UserGroupView.USERS_LINK_RESPONSE);
users.addAll(groupUsers); // depends on control dependency: [if], data = [none]
}
}
}
List<AssignedUserView> assignedUsers = getAssignedUsersToProject(projectView);
for (AssignedUserView assignedUser : assignedUsers) {
UserView userView = blackDuckService.getResponse(assignedUser.getUser(), UserView.class);
users.add(userView);
}
return users
.stream()
.filter(userView -> userView.getActive())
.collect(Collectors.toSet());
} } |
public class class_name {
private static Map<String, Object> sessionData(String sid, StatsStorage ss) {
Map<String, Object> dataThisSession = new HashMap<>();
List<String> workerIDs = ss.listWorkerIDsForSessionAndType(sid, StatsListener.TYPE_ID);
int workerCount = (workerIDs == null ? 0 : workerIDs.size());
List<Persistable> staticInfo = ss.getAllStaticInfos(sid, StatsListener.TYPE_ID);
long initTime = Long.MAX_VALUE;
if (staticInfo != null) {
for (Persistable p : staticInfo) {
initTime = Math.min(p.getTimeStamp(), initTime);
}
}
long lastUpdateTime = Long.MIN_VALUE;
List<Persistable> lastUpdatesAllWorkers = ss.getLatestUpdateAllWorkers(sid, StatsListener.TYPE_ID);
for (Persistable p : lastUpdatesAllWorkers) {
lastUpdateTime = Math.max(lastUpdateTime, p.getTimeStamp());
}
dataThisSession.put("numWorkers", workerCount);
dataThisSession.put("initTime", initTime == Long.MAX_VALUE ? "" : initTime);
dataThisSession.put("lastUpdate", lastUpdateTime == Long.MIN_VALUE ? "" : lastUpdateTime);
// add hashmap of workers
if (workerCount > 0) {
dataThisSession.put("workers", workerIDs);
}
//Model info: type, # layers, # params...
if (staticInfo != null && !staticInfo.isEmpty()) {
StatsInitializationReport sr = (StatsInitializationReport) staticInfo.get(0);
String modelClassName = sr.getModelClassName();
if (modelClassName.endsWith("MultiLayerNetwork")) {
modelClassName = "MultiLayerNetwork";
} else if (modelClassName.endsWith("ComputationGraph")) {
modelClassName = "ComputationGraph";
}
int numLayers = sr.getModelNumLayers();
long numParams = sr.getModelNumParams();
dataThisSession.put("modelType", modelClassName);
dataThisSession.put("numLayers", numLayers);
dataThisSession.put("numParams", numParams);
} else {
dataThisSession.put("modelType", "");
dataThisSession.put("numLayers", "");
dataThisSession.put("numParams", "");
}
return dataThisSession;
} } | public class class_name {
private static Map<String, Object> sessionData(String sid, StatsStorage ss) {
Map<String, Object> dataThisSession = new HashMap<>();
List<String> workerIDs = ss.listWorkerIDsForSessionAndType(sid, StatsListener.TYPE_ID);
int workerCount = (workerIDs == null ? 0 : workerIDs.size());
List<Persistable> staticInfo = ss.getAllStaticInfos(sid, StatsListener.TYPE_ID);
long initTime = Long.MAX_VALUE;
if (staticInfo != null) {
for (Persistable p : staticInfo) {
initTime = Math.min(p.getTimeStamp(), initTime); // depends on control dependency: [for], data = [p]
}
}
long lastUpdateTime = Long.MIN_VALUE;
List<Persistable> lastUpdatesAllWorkers = ss.getLatestUpdateAllWorkers(sid, StatsListener.TYPE_ID);
for (Persistable p : lastUpdatesAllWorkers) {
lastUpdateTime = Math.max(lastUpdateTime, p.getTimeStamp()); // depends on control dependency: [for], data = [p]
}
dataThisSession.put("numWorkers", workerCount);
dataThisSession.put("initTime", initTime == Long.MAX_VALUE ? "" : initTime);
dataThisSession.put("lastUpdate", lastUpdateTime == Long.MIN_VALUE ? "" : lastUpdateTime);
// add hashmap of workers
if (workerCount > 0) {
dataThisSession.put("workers", workerIDs); // depends on control dependency: [if], data = [none]
}
//Model info: type, # layers, # params...
if (staticInfo != null && !staticInfo.isEmpty()) {
StatsInitializationReport sr = (StatsInitializationReport) staticInfo.get(0);
String modelClassName = sr.getModelClassName();
if (modelClassName.endsWith("MultiLayerNetwork")) {
modelClassName = "MultiLayerNetwork"; // depends on control dependency: [if], data = [none]
} else if (modelClassName.endsWith("ComputationGraph")) {
modelClassName = "ComputationGraph"; // depends on control dependency: [if], data = [none]
}
int numLayers = sr.getModelNumLayers();
long numParams = sr.getModelNumParams();
dataThisSession.put("modelType", modelClassName); // depends on control dependency: [if], data = [none]
dataThisSession.put("numLayers", numLayers); // depends on control dependency: [if], data = [none]
dataThisSession.put("numParams", numParams); // depends on control dependency: [if], data = [none]
} else {
dataThisSession.put("modelType", ""); // depends on control dependency: [if], data = [none]
dataThisSession.put("numLayers", ""); // depends on control dependency: [if], data = [none]
dataThisSession.put("numParams", ""); // depends on control dependency: [if], data = [none]
}
return dataThisSession;
} } |
public class class_name {
public void eachNonZeroInRow(int i, VectorProcedure procedure) {
VectorIterator it = nonZeroIteratorOfRow(i);
while (it.hasNext()) {
double x = it.next();
int j = it.index();
procedure.apply(j, x);
}
} } | public class class_name {
public void eachNonZeroInRow(int i, VectorProcedure procedure) {
VectorIterator it = nonZeroIteratorOfRow(i);
while (it.hasNext()) {
double x = it.next();
int j = it.index();
procedure.apply(j, x); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private Request bindThreadToRequest(Thread thread, EntryPoint entryPoint) {
StandardRequest boundRequest; /*= rebindingRequest;*/
// thread.setContextClassLoader(contextClassLoader);
int threadId = thread.hashCode();
synchronized (requestsByThreadId) {
StandardRequest previouslyBoundRequest = (StandardRequest) requestsByThreadId.get(threadId);
if (previouslyBoundRequest == null) {
boundRequest = new StandardRequest(entryPoint, this);
requestsByThreadId.put(threadId, boundRequest);
} else {
// request is already bound, it will not be overwritten
previouslyBoundRequest.increaseTimesEntered();
boundRequest = previouslyBoundRequest;
}
}
return boundRequest;
} } | public class class_name {
private Request bindThreadToRequest(Thread thread, EntryPoint entryPoint) {
StandardRequest boundRequest; /*= rebindingRequest;*/
// thread.setContextClassLoader(contextClassLoader);
int threadId = thread.hashCode();
synchronized (requestsByThreadId) {
StandardRequest previouslyBoundRequest = (StandardRequest) requestsByThreadId.get(threadId);
if (previouslyBoundRequest == null) {
boundRequest = new StandardRequest(entryPoint, this); // depends on control dependency: [if], data = [none]
requestsByThreadId.put(threadId, boundRequest); // depends on control dependency: [if], data = [none]
} else {
// request is already bound, it will not be overwritten
previouslyBoundRequest.increaseTimesEntered(); // depends on control dependency: [if], data = [none]
boundRequest = previouslyBoundRequest; // depends on control dependency: [if], data = [none]
}
}
return boundRequest;
} } |
public class class_name {
public void processMetadata(Metadata metadata) {
synchronized (frameListeners) {
Iterator<FrameListener> it = frameListeners.iterator();
while (it.hasNext()) {
FrameListener listener = it.next();
listener.processMetadata(metadata);
}
}
} } | public class class_name {
public void processMetadata(Metadata metadata) {
synchronized (frameListeners) {
Iterator<FrameListener> it = frameListeners.iterator();
while (it.hasNext()) {
FrameListener listener = it.next();
listener.processMetadata(metadata); // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
public static String generateExactMatchPattern(URI origin,
URI destination, String bindingVar, boolean includeUrisBound) {
List<String> patterns = new ArrayList<String>();
// Exact match pattern
StringBuffer query = new StringBuffer();
query.append(Util.generateSubclassPattern(origin, destination) + NL);
query.append(Util.generateSuperclassPattern(origin, destination) + NL);
patterns.add(query.toString());
// Find same term cases
query = new StringBuffer();
query.append("FILTER (str(").
append(sparqlWrapUri(origin)).
append(") = str(").
append(sparqlWrapUri(destination)).
append(") ) . " + NL);
patterns.add(query.toString());
StringBuffer result = new StringBuffer(generateUnionStatement(patterns));
// Bind a variable for inspection
result.append("BIND (true as ?" + bindingVar + ") ." + NL);
// Include origin and destination in the returned bindings if requested
if (includeUrisBound) {
result.append("BIND (").append(sparqlWrapUri(origin)).append(" as ?origin) .").append(NL);
result.append("BIND (").append(sparqlWrapUri(destination)).append(" as ?destination) .").append(NL);
}
return result.toString();
} } | public class class_name {
public static String generateExactMatchPattern(URI origin,
URI destination, String bindingVar, boolean includeUrisBound) {
List<String> patterns = new ArrayList<String>();
// Exact match pattern
StringBuffer query = new StringBuffer();
query.append(Util.generateSubclassPattern(origin, destination) + NL);
query.append(Util.generateSuperclassPattern(origin, destination) + NL);
patterns.add(query.toString());
// Find same term cases
query = new StringBuffer();
query.append("FILTER (str(").
append(sparqlWrapUri(origin)).
append(") = str(").
append(sparqlWrapUri(destination)).
append(") ) . " + NL);
patterns.add(query.toString());
StringBuffer result = new StringBuffer(generateUnionStatement(patterns));
// Bind a variable for inspection
result.append("BIND (true as ?" + bindingVar + ") ." + NL);
// Include origin and destination in the returned bindings if requested
if (includeUrisBound) {
result.append("BIND (").append(sparqlWrapUri(origin)).append(" as ?origin) .").append(NL); // depends on control dependency: [if], data = [none]
result.append("BIND (").append(sparqlWrapUri(destination)).append(" as ?destination) .").append(NL); // depends on control dependency: [if], data = [none]
}
return result.toString();
} } |
public class class_name {
public void init() {
try {
String[] names = tgtools.web.platform.Platform.getBeanFactory().getBeanDefinitionNames();
for (String name : names) {
if (name.endsWith("CommandImpl") && tgtools.web.platform.Platform.getBean(name) instanceof Command && mType.equals(((Command) tgtools.web.platform.Platform.getBean(name)).getType())) {
addCommand((Command)tgtools.web.platform.Platform.getBean(name));
}
}
} catch (Exception e) {
LogHelper.error("","CommandFactory 初始化失败;原因:"+e.toString(),"CommandFactory.init",e);
}
} } | public class class_name {
public void init() {
try {
String[] names = tgtools.web.platform.Platform.getBeanFactory().getBeanDefinitionNames();
for (String name : names) {
if (name.endsWith("CommandImpl") && tgtools.web.platform.Platform.getBean(name) instanceof Command && mType.equals(((Command) tgtools.web.platform.Platform.getBean(name)).getType())) {
addCommand((Command)tgtools.web.platform.Platform.getBean(name)); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
LogHelper.error("","CommandFactory 初始化失败;原因:"+e.toString(),"CommandFactory.init",e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int
getValue(String str) {
str = sanitize(str);
Integer value = (Integer) strings.get(str);
if (value != null) {
return value.intValue();
}
if (prefix != null) {
if (str.startsWith(prefix)) {
int val = parseNumeric(str.substring(prefix.length()));
if (val >= 0) {
return val;
}
}
}
if (numericok) {
return parseNumeric(str);
}
return -1;
} } | public class class_name {
public int
getValue(String str) {
str = sanitize(str);
Integer value = (Integer) strings.get(str);
if (value != null) {
return value.intValue(); // depends on control dependency: [if], data = [none]
}
if (prefix != null) {
if (str.startsWith(prefix)) {
int val = parseNumeric(str.substring(prefix.length()));
if (val >= 0) {
return val; // depends on control dependency: [if], data = [none]
}
}
}
if (numericok) {
return parseNumeric(str); // depends on control dependency: [if], data = [none]
}
return -1;
} } |
public class class_name {
@Override
public void renderInline(final String templateInline, final Map<String, Object> context, final Map<String, WComponent> taggedComponents,
final Writer writer, final Map<String, Object> options) {
LOG.debug("Rendering inline velocity template.");
try {
// Map the tagged components to be used in the replace writer
Map<String, WComponent> componentsByKey = TemplateUtil.mapTaggedComponents(context, taggedComponents);
// Setup context
VelocityContext velocityContext = new VelocityContext();
for (Map.Entry<String, Object> entry : context.entrySet()) {
velocityContext.put(entry.getKey(), entry.getValue());
}
// Write inline template
UIContext uic = UIContextHolder.getCurrent();
try (TemplateWriter velocityWriter = new TemplateWriter(writer, componentsByKey, uic)) {
getVelocityEngine().evaluate(velocityContext, velocityWriter, templateInline, templateInline);
}
} catch (Exception e) {
throw new SystemException("Problems with inline velocity template." + e.getMessage(), e);
}
} } | public class class_name {
@Override
public void renderInline(final String templateInline, final Map<String, Object> context, final Map<String, WComponent> taggedComponents,
final Writer writer, final Map<String, Object> options) {
LOG.debug("Rendering inline velocity template.");
try {
// Map the tagged components to be used in the replace writer
Map<String, WComponent> componentsByKey = TemplateUtil.mapTaggedComponents(context, taggedComponents);
// Setup context
VelocityContext velocityContext = new VelocityContext();
for (Map.Entry<String, Object> entry : context.entrySet()) {
velocityContext.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
// Write inline template
UIContext uic = UIContextHolder.getCurrent();
try (TemplateWriter velocityWriter = new TemplateWriter(writer, componentsByKey, uic)) {
getVelocityEngine().evaluate(velocityContext, velocityWriter, templateInline, templateInline);
}
} catch (Exception e) {
throw new SystemException("Problems with inline velocity template." + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static File unzip(File zipFile, File outFile, Charset charset) throws UtilException {
charset = (null == charset) ? DEFAULT_CHARSET : charset;
ZipFile zipFileObj = null;
try {
zipFileObj = new ZipFile(zipFile, charset);
final Enumeration<ZipEntry> em = (Enumeration<ZipEntry>) zipFileObj.entries();
ZipEntry zipEntry = null;
File outItemFile = null;
while (em.hasMoreElements()) {
zipEntry = em.nextElement();
//FileUtil.file会检查slip漏洞,漏洞说明见http://blog.nsfocus.net/zip-slip-2/
outItemFile = FileUtil.file(outFile, zipEntry.getName());
if (zipEntry.isDirectory()) {
outItemFile.mkdirs();
} else {
FileUtil.touch(outItemFile);
copy(zipFileObj, zipEntry, outItemFile);
}
}
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(zipFileObj);
}
return outFile;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static File unzip(File zipFile, File outFile, Charset charset) throws UtilException {
charset = (null == charset) ? DEFAULT_CHARSET : charset;
ZipFile zipFileObj = null;
try {
zipFileObj = new ZipFile(zipFile, charset);
final Enumeration<ZipEntry> em = (Enumeration<ZipEntry>) zipFileObj.entries();
ZipEntry zipEntry = null;
File outItemFile = null;
while (em.hasMoreElements()) {
zipEntry = em.nextElement();
// depends on control dependency: [while], data = [none]
//FileUtil.file会检查slip漏洞,漏洞说明见http://blog.nsfocus.net/zip-slip-2/
outItemFile = FileUtil.file(outFile, zipEntry.getName());
// depends on control dependency: [while], data = [none]
if (zipEntry.isDirectory()) {
outItemFile.mkdirs();
// depends on control dependency: [if], data = [none]
} else {
FileUtil.touch(outItemFile);
// depends on control dependency: [if], data = [none]
copy(zipFileObj, zipEntry, outItemFile);
// depends on control dependency: [if], data = [none]
}
}
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(zipFileObj);
}
return outFile;
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
public PropertyEditor find(Class<?> type) {
if(type == null){
return null;
}
Class<? extends PropertyEditor> editorClass = this.register.get(type);
if (editorClass != null) {
try {
return editorClass.newInstance();
} catch (Exception e) {
//e.printStackTrace();
}
}
final boolean isArray = type.isArray();
String editorName = BeanUtils.stripPackage(type);
if (isArray) {
editorName += EDITOR_ARRAY;
} else {
editorName += EDITOR;
}
String searchName = null;
try {
searchName = BeanUtils.stripClass(type) + "." + editorName;
editorClass = (Class<? extends PropertyEditor>) BeanUtils.findClass(searchName);
return editorClass.newInstance();
} catch (Exception e) {
//catching, to be compliant with JDK PEM
if(logger.isLoggable(Level.FINEST)){
logger.log(Level.FINEST,"Failed to instantiate property editor class '"+searchName+"'.",e);
}
}
for (String pkg : this.packages) {
try {
searchName = pkg + "." + editorName;
editorClass = (Class<? extends PropertyEditor>) BeanUtils.findClass(searchName);
return editorClass.newInstance();
} catch (Exception e) {
//catching, to be compliant with JDK PEM
if(logger.isLoggable(Level.FINEST)){
logger.log(Level.FINEST,"Failed to instantiate property editor class '"+searchName+"'.",e);
}
}
}
if (isArray) {
Class<?> cellType = type.getComponentType();
if (find(cellType) != null) {
return new GenericArrayPropertyEditor(type);
}
return null;
} else if(type.isPrimitive()){
return find(BeanUtils.getWrapperTypeFor(type));
}
return null;
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
public PropertyEditor find(Class<?> type) {
if(type == null){
return null; // depends on control dependency: [if], data = [none]
}
Class<? extends PropertyEditor> editorClass = this.register.get(type);
if (editorClass != null) {
try {
return editorClass.newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
//e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
final boolean isArray = type.isArray();
String editorName = BeanUtils.stripPackage(type);
if (isArray) {
editorName += EDITOR_ARRAY; // depends on control dependency: [if], data = [none]
} else {
editorName += EDITOR; // depends on control dependency: [if], data = [none]
}
String searchName = null;
try {
searchName = BeanUtils.stripClass(type) + "." + editorName;
editorClass = (Class<? extends PropertyEditor>) BeanUtils.findClass(searchName);
return editorClass.newInstance();
} catch (Exception e) {
//catching, to be compliant with JDK PEM
if(logger.isLoggable(Level.FINEST)){
logger.log(Level.FINEST,"Failed to instantiate property editor class '"+searchName+"'.",e);
}
}
for (String pkg : this.packages) {
try {
searchName = pkg + "." + editorName;
editorClass = (Class<? extends PropertyEditor>) BeanUtils.findClass(searchName);
return editorClass.newInstance();
} catch (Exception e) {
//catching, to be compliant with JDK PEM
if(logger.isLoggable(Level.FINEST)){
logger.log(Level.FINEST,"Failed to instantiate property editor class '"+searchName+"'.",e);
}
}
}
if (isArray) {
Class<?> cellType = type.getComponentType();
if (find(cellType) != null) {
return new GenericArrayPropertyEditor(type);
}
return null;
} else if(type.isPrimitive()){
return find(BeanUtils.getWrapperTypeFor(type));
}
return null;
} } |
public class class_name {
public void writeSetupSCode(String strMethodName, String strMethodReturns, String strMethodInterface, String strClassName)
{
Record recFieldData = new FieldData(this);
try {
String strScreenFieldName, strScreenLocation, strScreenFieldDesc, strScreenRow, strScreenCol, strScreenOutNumber, strScreenSetAnchor;
String strFileName = DBConstants.BLANK;
String getFile = "getMainRecord()";
int oldRow = 2, oldCol = 21;
Record recScreenIn = this.getRecord(ScreenIn.SCREEN_IN_FILE);
SubFileFilter newBehavior = new SubFileFilter(recScreenIn.getField(ScreenIn.SCREEN_FILE_NAME), FieldData.FIELD_FILE_NAME, recScreenIn.getField(ScreenIn.SCREEN_FIELD_NAME), FieldData.FIELD_NAME, null, null);
recFieldData.addListener(newBehavior);
recFieldData.setKeyArea(FieldData.FIELD_NAME_KEY);
recScreenIn.close();
while (recScreenIn.hasNext())
{
recScreenIn.next();
if (recScreenIn.getField(ScreenIn.SCREEN_FIELD_NAME).getString().length() != 0)
{
strScreenFieldName = recScreenIn.getField(ScreenIn.SCREEN_FIELD_NAME).getString();
strScreenLocation = recScreenIn.getField(ScreenIn.SCREEN_LOCATION).getString();
strScreenFieldDesc = recScreenIn.getField(ScreenIn.SCREEN_FIELD_DESC).getString();
strScreenOutNumber = recScreenIn.getField(ScreenIn.SCREEN_OUT_NUMBER).getString();
strScreenSetAnchor = recScreenIn.getField(ScreenIn.SCREEN_ANCHOR).getString();
int row = (int)((NumberField)recScreenIn.getField(ScreenIn.SCREEN_ROW)).getValue();
int col = (int)((NumberField)recScreenIn.getField(ScreenIn.SCREEN_COL)).getValue();
if (strScreenOutNumber.equalsIgnoreCase("1")) if (strScreenLocation.length() == 0)
{
if (row > 2)
((NumberField)recScreenIn.getField(ScreenIn.SCREEN_ROW)).setValue(row-2, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
}
strScreenRow = recScreenIn.getField(ScreenIn.SCREEN_ROW).getString();
strScreenCol = recScreenIn.getField(ScreenIn.SCREEN_COL).getString();
if (recScreenIn.getField(ScreenIn.SCREEN_FILE_NAME).getLength() != 0)
{
strFileName = recScreenIn.getField(ScreenIn.SCREEN_FILE_NAME).getString();
getFile = "getRecord(" + strFileName + "." + this.convertNameToConstant(strFileName + "File") + ")";
}
else
getFile = "getMainRecord()";
// Screen location
if (strScreenOutNumber.equalsIgnoreCase("1"))
if (strScreenLocation.length() == 0)
if (row == oldRow+1) if (col == oldCol)
strScreenLocation = "NEXT_LOGICAL"; // Next Logical
if (strScreenLocation.length() == 0)
strScreenLocation = "NEXT_LOGICAL"; // Use this R/C
if (strScreenLocation.length() == 1)
{
switch (strScreenLocation.charAt(0))
{
case 'U':
strScreenLocation = "USE_ROW_COL";break;
case 'R':
strScreenLocation = "RIGHT_OF_LAST";break;
case 'T':
strScreenLocation = "TOP_NEXT";break;
case 'B':
strScreenLocation = "BELOW_LAST";break;
case 'A':
strScreenLocation = "AT_ANCHOR";break;
case 'L':
strScreenLocation = "USE_THIS_LOCATION";break;
case 'D':
case 'N':
default:
strScreenLocation = "NEXT_LOGICAL";break;
}
}
if (strScreenLocation.equalsIgnoreCase("USE_ROW_COL"))
strScreenLocation = "this.getNextLocation(" + strScreenCol + ", " + strScreenRow;
else
strScreenLocation = "this.getNextLocation(ScreenConstants." + strScreenLocation;
// Set anchor?
if (strScreenSetAnchor.equalsIgnoreCase("N"))
strScreenSetAnchor = "DONT_SET_ANCHOR";
else if (strScreenSetAnchor.equalsIgnoreCase("Y"))
strScreenSetAnchor = "SET_ANCHOR";
else if (strScreenSetAnchor.length() == 0)
strScreenSetAnchor = "ANCHOR_DEFAULT";
strScreenLocation += ", ScreenConstants." + strScreenSetAnchor + ")";
// Display the field desc?
if (strScreenFieldDesc.equalsIgnoreCase("Y"))
strScreenFieldDesc = "DISPLAY_FIELD_DESC";
else if (strScreenFieldDesc.equalsIgnoreCase("N"))
strScreenFieldDesc = "DONT_DISPLAY_FIELD_DESC";
else if (strScreenFieldDesc.length() == 0)
strScreenFieldDesc = "DEFAULT_DISPLAY";
strScreenFieldDesc = "ScreenConstants." + strScreenFieldDesc;
// View Control type
String controlType = recScreenIn.getField(ScreenIn.SCREEN_CONTROL_TYPE).getString();
String strDisabledEnding = DBConstants.BLANK;
if ("disabled".equals(controlType))
{
controlType = DBConstants.BLANK;
strDisabledEnding = ".setEnabled(false)";
}
String fieldString = "this." + getFile + ".getField(" + strFileName + "." + this.convertNameToConstant(strScreenFieldName) + ")";
if (controlType.length() == 1)
{
switch (controlType.charAt(0))
{
case 'S': // Static
controlType = "SStaticText";break;
case 'T':
controlType = "STEView";break;
case 'N':
controlType = "SNumberText";break;
case 'C':
controlType = "SCheckBox";break;
case 'R':
controlType = "SRadioButton";break;
case 'B':
controlType = "SButtonBox";break;
case 'P':
controlType = "SPopupBox";break;
};
}
if (controlType.length() == 0) // Default
m_StreamOut.writeit("\t" + fieldString + ".setupDefaultView(" + strScreenLocation + ", this, " + strScreenFieldDesc + ")" + strDisabledEnding + ";\n");
else
{
if (controlType.startsWith("S"))
if (Character.isUpperCase(controlType.charAt(1)))
controlType = controlType.substring(1);
controlType = this.convertNameToConstant(controlType);
m_StreamOut.writeit("\tcreateScreenComponent(ScreenModel." + controlType + ", " + strScreenLocation + ", this, fieldString, " + strScreenFieldDesc + ", null)" + strDisabledEnding + ";\n");
//m_StreamOut.writeit("\tnew " + controlType + "(" + strScreenLocation + ", this, " + fieldString + ", " + strScreenFieldDesc + ", null)" + strDisabledEnding + ";\n");
}
oldRow = row;
oldCol = col;
}
if (recScreenIn.getField(ScreenIn.SCREEN_TEXT).getString().length() != 0)
{
m_StreamOut.setTabs(+1);
String tempString = recScreenIn.getField(ScreenIn.SCREEN_TEXT).getString();
m_StreamOut.writeit(tempString);
if (tempString.charAt(tempString.length() - 1) != '\n')
m_StreamOut.writeit("\n");
m_StreamOut.setTabs(-1);
}
}
recScreenIn.close();
recFieldData.removeListener(newBehavior, true); // Remove and free this listener
} catch (DBException ex) {
ex.printStackTrace();
} finally {
recFieldData.free();
}
} } | public class class_name {
public void writeSetupSCode(String strMethodName, String strMethodReturns, String strMethodInterface, String strClassName)
{
Record recFieldData = new FieldData(this);
try {
String strScreenFieldName, strScreenLocation, strScreenFieldDesc, strScreenRow, strScreenCol, strScreenOutNumber, strScreenSetAnchor;
String strFileName = DBConstants.BLANK;
String getFile = "getMainRecord()";
int oldRow = 2, oldCol = 21;
Record recScreenIn = this.getRecord(ScreenIn.SCREEN_IN_FILE);
SubFileFilter newBehavior = new SubFileFilter(recScreenIn.getField(ScreenIn.SCREEN_FILE_NAME), FieldData.FIELD_FILE_NAME, recScreenIn.getField(ScreenIn.SCREEN_FIELD_NAME), FieldData.FIELD_NAME, null, null);
recFieldData.addListener(newBehavior);
recFieldData.setKeyArea(FieldData.FIELD_NAME_KEY);
recScreenIn.close();
while (recScreenIn.hasNext())
{
recScreenIn.next(); // depends on control dependency: [while], data = [none]
if (recScreenIn.getField(ScreenIn.SCREEN_FIELD_NAME).getString().length() != 0)
{
strScreenFieldName = recScreenIn.getField(ScreenIn.SCREEN_FIELD_NAME).getString(); // depends on control dependency: [if], data = [none]
strScreenLocation = recScreenIn.getField(ScreenIn.SCREEN_LOCATION).getString(); // depends on control dependency: [if], data = [none]
strScreenFieldDesc = recScreenIn.getField(ScreenIn.SCREEN_FIELD_DESC).getString(); // depends on control dependency: [if], data = [none]
strScreenOutNumber = recScreenIn.getField(ScreenIn.SCREEN_OUT_NUMBER).getString(); // depends on control dependency: [if], data = [none]
strScreenSetAnchor = recScreenIn.getField(ScreenIn.SCREEN_ANCHOR).getString(); // depends on control dependency: [if], data = [none]
int row = (int)((NumberField)recScreenIn.getField(ScreenIn.SCREEN_ROW)).getValue();
int col = (int)((NumberField)recScreenIn.getField(ScreenIn.SCREEN_COL)).getValue();
if (strScreenOutNumber.equalsIgnoreCase("1")) if (strScreenLocation.length() == 0)
{
if (row > 2)
((NumberField)recScreenIn.getField(ScreenIn.SCREEN_ROW)).setValue(row-2, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
}
strScreenRow = recScreenIn.getField(ScreenIn.SCREEN_ROW).getString(); // depends on control dependency: [if], data = [none]
strScreenCol = recScreenIn.getField(ScreenIn.SCREEN_COL).getString(); // depends on control dependency: [if], data = [none]
if (recScreenIn.getField(ScreenIn.SCREEN_FILE_NAME).getLength() != 0)
{
strFileName = recScreenIn.getField(ScreenIn.SCREEN_FILE_NAME).getString(); // depends on control dependency: [if], data = [none]
getFile = "getRecord(" + strFileName + "." + this.convertNameToConstant(strFileName + "File") + ")"; // depends on control dependency: [if], data = [none]
}
else
getFile = "getMainRecord()";
// Screen location
if (strScreenOutNumber.equalsIgnoreCase("1"))
if (strScreenLocation.length() == 0)
if (row == oldRow+1) if (col == oldCol)
strScreenLocation = "NEXT_LOGICAL"; // Next Logical
if (strScreenLocation.length() == 0)
strScreenLocation = "NEXT_LOGICAL"; // Use this R/C
if (strScreenLocation.length() == 1)
{
switch (strScreenLocation.charAt(0))
{
case 'U':
strScreenLocation = "USE_ROW_COL";break;
case 'R':
strScreenLocation = "RIGHT_OF_LAST";break;
case 'T':
strScreenLocation = "TOP_NEXT";break;
case 'B':
strScreenLocation = "BELOW_LAST";break;
case 'A':
strScreenLocation = "AT_ANCHOR";break;
case 'L':
strScreenLocation = "USE_THIS_LOCATION";break;
case 'D':
case 'N':
default:
strScreenLocation = "NEXT_LOGICAL";break;
}
}
if (strScreenLocation.equalsIgnoreCase("USE_ROW_COL"))
strScreenLocation = "this.getNextLocation(" + strScreenCol + ", " + strScreenRow;
else
strScreenLocation = "this.getNextLocation(ScreenConstants." + strScreenLocation;
// Set anchor?
if (strScreenSetAnchor.equalsIgnoreCase("N"))
strScreenSetAnchor = "DONT_SET_ANCHOR";
else if (strScreenSetAnchor.equalsIgnoreCase("Y"))
strScreenSetAnchor = "SET_ANCHOR";
else if (strScreenSetAnchor.length() == 0)
strScreenSetAnchor = "ANCHOR_DEFAULT";
strScreenLocation += ", ScreenConstants." + strScreenSetAnchor + ")"; // depends on control dependency: [if], data = [none]
// Display the field desc?
if (strScreenFieldDesc.equalsIgnoreCase("Y"))
strScreenFieldDesc = "DISPLAY_FIELD_DESC";
else if (strScreenFieldDesc.equalsIgnoreCase("N"))
strScreenFieldDesc = "DONT_DISPLAY_FIELD_DESC";
else if (strScreenFieldDesc.length() == 0)
strScreenFieldDesc = "DEFAULT_DISPLAY";
strScreenFieldDesc = "ScreenConstants." + strScreenFieldDesc; // depends on control dependency: [if], data = [none]
// View Control type
String controlType = recScreenIn.getField(ScreenIn.SCREEN_CONTROL_TYPE).getString();
String strDisabledEnding = DBConstants.BLANK;
if ("disabled".equals(controlType))
{
controlType = DBConstants.BLANK; // depends on control dependency: [if], data = [none]
strDisabledEnding = ".setEnabled(false)"; // depends on control dependency: [if], data = [none]
}
String fieldString = "this." + getFile + ".getField(" + strFileName + "." + this.convertNameToConstant(strScreenFieldName) + ")";
if (controlType.length() == 1)
{
switch (controlType.charAt(0))
{
case 'S': // Static
controlType = "SStaticText";break;
case 'T':
controlType = "STEView";break;
case 'N':
controlType = "SNumberText";break;
case 'C':
controlType = "SCheckBox";break;
case 'R':
controlType = "SRadioButton";break;
case 'B':
controlType = "SButtonBox";break;
case 'P':
controlType = "SPopupBox";break;
};
}
if (controlType.length() == 0) // Default
m_StreamOut.writeit("\t" + fieldString + ".setupDefaultView(" + strScreenLocation + ", this, " + strScreenFieldDesc + ")" + strDisabledEnding + ";\n");
else
{
if (controlType.startsWith("S"))
if (Character.isUpperCase(controlType.charAt(1)))
controlType = controlType.substring(1);
controlType = this.convertNameToConstant(controlType); // depends on control dependency: [if], data = [none]
m_StreamOut.writeit("\tcreateScreenComponent(ScreenModel." + controlType + ", " + strScreenLocation + ", this, fieldString, " + strScreenFieldDesc + ", null)" + strDisabledEnding + ";\n"); // depends on control dependency: [if], data = [none]
//m_StreamOut.writeit("\tnew " + controlType + "(" + strScreenLocation + ", this, " + fieldString + ", " + strScreenFieldDesc + ", null)" + strDisabledEnding + ";\n");
}
oldRow = row;
oldCol = col;
}
if (recScreenIn.getField(ScreenIn.SCREEN_TEXT).getString().length() != 0)
{
m_StreamOut.setTabs(+1); // depends on control dependency: [if], data = [none]
String tempString = recScreenIn.getField(ScreenIn.SCREEN_TEXT).getString();
m_StreamOut.writeit(tempString); // depends on control dependency: [if], data = [none]
if (tempString.charAt(tempString.length() - 1) != '\n')
m_StreamOut.writeit("\n");
m_StreamOut.setTabs(-1); // depends on control dependency: [if], data = [none]
}
}
recScreenIn.close();
recFieldData.removeListener(newBehavior, true); // Remove and free this listener
} catch (DBException ex) {
ex.printStackTrace();
} finally {
recFieldData.free();
}
} } |
public class class_name {
public boolean isNotificationEnabled(Notification notification) {
if (!(notification instanceof AlarmNotification)) return false;
if (minLevel_10 != null) {
// SLEE 1.0 comparison
Level alarmLevel = ((AlarmNotification)notification).getLevel();
return alarmLevel != null && !minLevel_10.isHigherLevel(alarmLevel);
}
else {
// SLEE 1.1 comparison
AlarmLevel alarmLevel = ((AlarmNotification)notification).getAlarmLevel();
return alarmLevel != null && !minLevel_11.isHigherLevel(alarmLevel);
}
} } | public class class_name {
public boolean isNotificationEnabled(Notification notification) {
if (!(notification instanceof AlarmNotification)) return false;
if (minLevel_10 != null) {
// SLEE 1.0 comparison
Level alarmLevel = ((AlarmNotification)notification).getLevel();
return alarmLevel != null && !minLevel_10.isHigherLevel(alarmLevel); // depends on control dependency: [if], data = [none]
}
else {
// SLEE 1.1 comparison
AlarmLevel alarmLevel = ((AlarmNotification)notification).getAlarmLevel();
return alarmLevel != null && !minLevel_11.isHigherLevel(alarmLevel); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(AlgorithmStatusItem algorithmStatusItem, ProtocolMarshaller protocolMarshaller) {
if (algorithmStatusItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(algorithmStatusItem.getName(), NAME_BINDING);
protocolMarshaller.marshall(algorithmStatusItem.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(algorithmStatusItem.getFailureReason(), FAILUREREASON_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AlgorithmStatusItem algorithmStatusItem, ProtocolMarshaller protocolMarshaller) {
if (algorithmStatusItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(algorithmStatusItem.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(algorithmStatusItem.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(algorithmStatusItem.getFailureReason(), FAILUREREASON_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 updateTenantDef(TenantDefinition tenantDef) {
synchronized (m_tenantDBMap) {
DBService dbservice = m_tenantDBMap.get(tenantDef.getName());
if (dbservice != null) {
Tenant updatedTenant = new Tenant(tenantDef);
m_logger.info("Updating DBService for tenant: {}", updatedTenant.getName());
dbservice.updateTenant(updatedTenant);
}
}
} } | public class class_name {
public void updateTenantDef(TenantDefinition tenantDef) {
synchronized (m_tenantDBMap) {
DBService dbservice = m_tenantDBMap.get(tenantDef.getName());
if (dbservice != null) {
Tenant updatedTenant = new Tenant(tenantDef);
m_logger.info("Updating DBService for tenant: {}", updatedTenant.getName()); // depends on control dependency: [if], data = [none]
dbservice.updateTenant(updatedTenant); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public Element simulate(final List<Instruction> instructions) {
lock.lock();
try {
returnElement = null;
return simulateInternal(instructions);
} finally {
lock.unlock();
}
} } | public class class_name {
public Element simulate(final List<Instruction> instructions) {
lock.lock();
try {
returnElement = null; // depends on control dependency: [try], data = [none]
return simulateInternal(instructions); // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
} } |
public class class_name {
public static boolean saveSshSessionAndChannel(Session session, Channel channel, GlobalSessionObject<Map<String, SSHConnection>> sessionParam, String sessionId) {
final SSHConnection sshConnection;
if (channel != null) {
sshConnection = new SSHConnection(session, channel);
} else {
sshConnection = new SSHConnection(session);
}
if (sessionParam != null) {
Map<String, SSHConnection> tempMap = sessionParam.get();
if (tempMap == null) {
tempMap = new HashMap<>();
}
tempMap.put(sessionId, sshConnection);
sessionParam.setResource(new SSHSessionResource(tempMap));
return true;
}
return false;
} } | public class class_name {
public static boolean saveSshSessionAndChannel(Session session, Channel channel, GlobalSessionObject<Map<String, SSHConnection>> sessionParam, String sessionId) {
final SSHConnection sshConnection;
if (channel != null) {
sshConnection = new SSHConnection(session, channel); // depends on control dependency: [if], data = [none]
} else {
sshConnection = new SSHConnection(session); // depends on control dependency: [if], data = [none]
}
if (sessionParam != null) {
Map<String, SSHConnection> tempMap = sessionParam.get();
if (tempMap == null) {
tempMap = new HashMap<>(); // depends on control dependency: [if], data = [none]
}
tempMap.put(sessionId, sshConnection); // depends on control dependency: [if], data = [none]
sessionParam.setResource(new SSHSessionResource(tempMap)); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static XMLEventReader getXMLEventReader(Source source) {
if (source instanceof StAXSource) {
return ((StAXSource) source).getXMLEventReader();
} else if (source instanceof StaxSource) {
return ((StaxSource) source).getXMLEventReader();
} else {
throw new IllegalArgumentException("Source '" + source + "' is neither StaxSource nor StAXSource");
}
} } | public class class_name {
public static XMLEventReader getXMLEventReader(Source source) {
if (source instanceof StAXSource) {
return ((StAXSource) source).getXMLEventReader(); // depends on control dependency: [if], data = [none]
} else if (source instanceof StaxSource) {
return ((StaxSource) source).getXMLEventReader(); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Source '" + source + "' is neither StaxSource nor StAXSource");
}
} } |
public class class_name {
public int doEndTag()
throws JspException
{
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
if (!hasErrors()) {
if (TagConfig.isDefaultJavaScript()) {
if (_divState.id != null) {
ScriptRequestState srs = ScriptRequestState.getScriptRequestState(req);
srs.mapTagId(getScriptReporter(), _divState.id, _divState.id, null);
}
}
WriteRenderAppender writer = new WriteRenderAppender(pageContext);
TagRenderingBase divRenderer = TagRenderingBase.Factory.getRendering(TagRenderingBase.DIV_TAG, req);
divRenderer.doEndTag(writer);
}
localRelease();
return EVAL_PAGE;
} } | public class class_name {
public int doEndTag()
throws JspException
{
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
if (!hasErrors()) {
if (TagConfig.isDefaultJavaScript()) {
if (_divState.id != null) {
ScriptRequestState srs = ScriptRequestState.getScriptRequestState(req);
srs.mapTagId(getScriptReporter(), _divState.id, _divState.id, null); // depends on control dependency: [if], data = [null)]
}
}
WriteRenderAppender writer = new WriteRenderAppender(pageContext);
TagRenderingBase divRenderer = TagRenderingBase.Factory.getRendering(TagRenderingBase.DIV_TAG, req);
divRenderer.doEndTag(writer);
}
localRelease();
return EVAL_PAGE;
} } |
public class class_name {
private static XColor findAutomaticFillColor(final ThemesTable themeTable,
final CTSolidColorFillProperties colorFill) {
// if there's no solidFill, then use automaticFill color
if (colorFill == null) {
return null;
}
CTSchemeColor ctsColor = colorFill.getSchemeClr();
if (ctsColor != null) {
return getXColorFromSchemeClr(ctsColor, themeTable);
} else {
CTSRgbColor ctrColor = colorFill.getSrgbClr();
if (ctrColor != null) {
return getXColorFromRgbClr(ctrColor);
}
}
return null;
} } | public class class_name {
private static XColor findAutomaticFillColor(final ThemesTable themeTable,
final CTSolidColorFillProperties colorFill) {
// if there's no solidFill, then use automaticFill color
if (colorFill == null) {
return null;
// depends on control dependency: [if], data = [none]
}
CTSchemeColor ctsColor = colorFill.getSchemeClr();
if (ctsColor != null) {
return getXColorFromSchemeClr(ctsColor, themeTable);
// depends on control dependency: [if], data = [(ctsColor]
} else {
CTSRgbColor ctrColor = colorFill.getSrgbClr();
if (ctrColor != null) {
return getXColorFromRgbClr(ctrColor);
// depends on control dependency: [if], data = [(ctrColor]
}
}
return null;
} } |
public class class_name {
public Boolean put(String tableName, HRow hRow) {
boolean flag = false;
try {
HTable table = (HTable) getConnection().getTable(TableName.valueOf(tableName));
Put put = new Put(hRow.getRowKey());
for (HRow.HCell hCell : hRow.getCells()) {
put.addColumn(Bytes.toBytes(hCell.getFamily()), Bytes.toBytes(hCell.getQualifier()), hCell.getValue());
}
table.put(put);
flag = true;
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
return flag;
} } | public class class_name {
public Boolean put(String tableName, HRow hRow) {
boolean flag = false;
try {
HTable table = (HTable) getConnection().getTable(TableName.valueOf(tableName));
Put put = new Put(hRow.getRowKey());
for (HRow.HCell hCell : hRow.getCells()) {
put.addColumn(Bytes.toBytes(hCell.getFamily()), Bytes.toBytes(hCell.getQualifier()), hCell.getValue()); // depends on control dependency: [for], data = [hCell]
}
table.put(put); // depends on control dependency: [try], data = [none]
flag = true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
return flag;
} } |
public class class_name {
public boolean exitTheStatement(BreakStmt breakStmt) {
if (!isReachable(breakStmt)) {
return false;
}
Statement breakTarget = breakTarget(breakStmt);
for (TryStmt tryStmt : containedTryStmts(breakTarget)) {
if (contains(tryStmt.getTryBlock(), breakStmt)) {
if (!tryStmt.getFinallyBlock().isPresent() && !canCompleteNormally(tryStmt.getFinallyBlock().get())) {
return false;
}
}
}
return true;
} } | public class class_name {
public boolean exitTheStatement(BreakStmt breakStmt) {
if (!isReachable(breakStmt)) {
return false; // depends on control dependency: [if], data = [none]
}
Statement breakTarget = breakTarget(breakStmt);
for (TryStmt tryStmt : containedTryStmts(breakTarget)) {
if (contains(tryStmt.getTryBlock(), breakStmt)) {
if (!tryStmt.getFinallyBlock().isPresent() && !canCompleteNormally(tryStmt.getFinallyBlock().get())) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
@JsonMappingCompleted
protected void jsonMappingCompleted(JsonMapper jsonMapper) {
if (rawMessageTags != null) {
messageTags = createTags(rawMessageTags, jsonMapper);
}
if (rawStoryTags != null) {
storyTags = createTags(rawStoryTags, jsonMapper);
}
} } | public class class_name {
@JsonMappingCompleted
protected void jsonMappingCompleted(JsonMapper jsonMapper) {
if (rawMessageTags != null) {
messageTags = createTags(rawMessageTags, jsonMapper); // depends on control dependency: [if], data = [(rawMessageTags]
}
if (rawStoryTags != null) {
storyTags = createTags(rawStoryTags, jsonMapper); // depends on control dependency: [if], data = [(rawStoryTags]
}
} } |
public class class_name {
public void walkSourceContents(SourceWalker walker) {
for (int i = 0, len = this.children.size(); i < len; i++) {
if (this.children.get(i) instanceof SourceNode) {
((SourceNode) this.children.get(i)).walkSourceContents(walker);
}
}
for (Entry<String, String> entry : this.sourceContents.entrySet()) {
walker.walk(entry.getKey(), entry.getValue());
}
} } | public class class_name {
public void walkSourceContents(SourceWalker walker) {
for (int i = 0, len = this.children.size(); i < len; i++) {
if (this.children.get(i) instanceof SourceNode) {
((SourceNode) this.children.get(i)).walkSourceContents(walker); // depends on control dependency: [if], data = [none]
}
}
for (Entry<String, String> entry : this.sourceContents.entrySet()) {
walker.walk(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
} } |
public class class_name {
private final void setExpiration(long expirationInMinutes) {
expirationInMilliseconds = System.currentTimeMillis()+ expirationInMinutes * 60 * 1000;
signature = null;
if (userData != null) {
encryptedBytes = null;
userData.addAttribute("expire", Long.toString(expirationInMilliseconds));
} else {
encryptedBytes = null;
}
} } | public class class_name {
private final void setExpiration(long expirationInMinutes) {
expirationInMilliseconds = System.currentTimeMillis()+ expirationInMinutes * 60 * 1000;
signature = null;
if (userData != null) {
encryptedBytes = null; // depends on control dependency: [if], data = [none]
userData.addAttribute("expire", Long.toString(expirationInMilliseconds)); // depends on control dependency: [if], data = [none]
} else {
encryptedBytes = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Object remove(String key) {
if (key != null) {
return map.remove(key);
}
return null;
} } | public class class_name {
public Object remove(String key) {
if (key != null) {
return map.remove(key); // depends on control dependency: [if], data = [(key]
}
return null;
} } |
public class class_name {
public synchronized Map<TaskError, Integer> getRecentErrorCounts(long timeWindow) {
long start = System.currentTimeMillis() - timeWindow;
Map<TaskError, Integer> errorCounts = createErrorCountsMap();
Iterator<Map<TaskError, Integer>> errorCountsIter = errorCountsQueue.iterator();
Iterator<Long> startTimeIter = startTimeQueue.iterator();
while (errorCountsIter.hasNext() && start < startTimeIter.next()) {
Map<TaskError, Integer> windowErrorCounts = errorCountsIter.next();
for (Map.Entry<TaskError, Integer> entry : windowErrorCounts.entrySet()) {
errorCounts.put(entry.getKey(),
errorCounts.get(entry.getKey()) + entry.getValue());
}
}
return errorCounts;
} } | public class class_name {
public synchronized Map<TaskError, Integer> getRecentErrorCounts(long timeWindow) {
long start = System.currentTimeMillis() - timeWindow;
Map<TaskError, Integer> errorCounts = createErrorCountsMap();
Iterator<Map<TaskError, Integer>> errorCountsIter = errorCountsQueue.iterator();
Iterator<Long> startTimeIter = startTimeQueue.iterator();
while (errorCountsIter.hasNext() && start < startTimeIter.next()) {
Map<TaskError, Integer> windowErrorCounts = errorCountsIter.next();
for (Map.Entry<TaskError, Integer> entry : windowErrorCounts.entrySet()) {
errorCounts.put(entry.getKey(),
errorCounts.get(entry.getKey()) + entry.getValue()); // depends on control dependency: [for], data = [entry]
}
}
return errorCounts;
} } |
public class class_name {
public static IsotopePattern sortByMass(IsotopePattern isotopeP) {
try {
IsotopePattern isoSort = (IsotopePattern) isotopeP.clone();
// Do nothing for empty isotope pattern
if (isoSort.getNumberOfIsotopes() == 0)
return isoSort;
// Sort the isotopes
List<IsotopeContainer> listISO = isoSort.getIsotopes();
Collections.sort(listISO, new Comparator<IsotopeContainer>() {
@Override
public int compare(IsotopeContainer o1, IsotopeContainer o2) {
return Double.compare(o1.getMass(),o2.getMass());
}
});
// Set the monoisotopic peak to the one with lowest mass
isoSort.setMonoIsotope(listISO.get(0));
return isoSort;
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return null;
} } | public class class_name {
public static IsotopePattern sortByMass(IsotopePattern isotopeP) {
try {
IsotopePattern isoSort = (IsotopePattern) isotopeP.clone();
// Do nothing for empty isotope pattern
if (isoSort.getNumberOfIsotopes() == 0)
return isoSort;
// Sort the isotopes
List<IsotopeContainer> listISO = isoSort.getIsotopes();
Collections.sort(listISO, new Comparator<IsotopeContainer>() {
@Override
public int compare(IsotopeContainer o1, IsotopeContainer o2) {
return Double.compare(o1.getMass(),o2.getMass());
}
}); // depends on control dependency: [try], data = [none]
// Set the monoisotopic peak to the one with lowest mass
isoSort.setMonoIsotope(listISO.get(0)); // depends on control dependency: [try], data = [none]
return isoSort; // depends on control dependency: [try], data = [none]
} catch (CloneNotSupportedException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public Observable<ServiceResponse<Object>> getMetadataWithServiceResponseAsync(String appId) {
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
return service.getMetadata(appId, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Object>>>() {
@Override
public Observable<ServiceResponse<Object>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Object> clientResponse = getMetadataDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Object>> getMetadataWithServiceResponseAsync(String appId) {
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
return service.getMetadata(appId, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Object>>>() {
@Override
public Observable<ServiceResponse<Object>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Object> clientResponse = getMetadataDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public final Mono<T> next() {
if(this instanceof Callable){
@SuppressWarnings("unchecked")
Callable<T> m = (Callable<T>)this;
return convertToMono(m);
}
return Mono.onAssembly(new MonoNext<>(this));
} } | public class class_name {
public final Mono<T> next() {
if(this instanceof Callable){
@SuppressWarnings("unchecked")
Callable<T> m = (Callable<T>)this;
return convertToMono(m); // depends on control dependency: [if], data = [none]
}
return Mono.onAssembly(new MonoNext<>(this));
} } |
public class class_name {
private boolean isNotPresentDisplayedEnabledInput(String action, String expected, String extra) {
// wait for element to be present
if (isNotPresent(action, expected, extra)) {
return true;
}
// wait for element to be displayed
if (isNotDisplayed(action, expected, extra)) {
return true;
}
// wait for element to be enabled
return isNotEnabled(action, expected, extra) || isNotInput(action, expected, extra);
} } | public class class_name {
private boolean isNotPresentDisplayedEnabledInput(String action, String expected, String extra) {
// wait for element to be present
if (isNotPresent(action, expected, extra)) {
return true; // depends on control dependency: [if], data = [none]
}
// wait for element to be displayed
if (isNotDisplayed(action, expected, extra)) {
return true; // depends on control dependency: [if], data = [none]
}
// wait for element to be enabled
return isNotEnabled(action, expected, extra) || isNotInput(action, expected, extra);
} } |
public class class_name {
public DescribeLifecycleHooksResult withLifecycleHooks(LifecycleHook... lifecycleHooks) {
if (this.lifecycleHooks == null) {
setLifecycleHooks(new com.amazonaws.internal.SdkInternalList<LifecycleHook>(lifecycleHooks.length));
}
for (LifecycleHook ele : lifecycleHooks) {
this.lifecycleHooks.add(ele);
}
return this;
} } | public class class_name {
public DescribeLifecycleHooksResult withLifecycleHooks(LifecycleHook... lifecycleHooks) {
if (this.lifecycleHooks == null) {
setLifecycleHooks(new com.amazonaws.internal.SdkInternalList<LifecycleHook>(lifecycleHooks.length)); // depends on control dependency: [if], data = [none]
}
for (LifecycleHook ele : lifecycleHooks) {
this.lifecycleHooks.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void marshall(Stream stream, ProtocolMarshaller protocolMarshaller) {
if (stream == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stream.getStreamArn(), STREAMARN_BINDING);
protocolMarshaller.marshall(stream.getTableName(), TABLENAME_BINDING);
protocolMarshaller.marshall(stream.getStreamLabel(), STREAMLABEL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Stream stream, ProtocolMarshaller protocolMarshaller) {
if (stream == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stream.getStreamArn(), STREAMARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stream.getTableName(), TABLENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stream.getStreamLabel(), STREAMLABEL_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 {
static void filterUnwantedReferences(List<JpaRef> result, Collection<BeanId> query) {
ListIterator<JpaRef> it = result.listIterator();
while (it.hasNext()) {
// remove reference from result that was not part of the query
BeanId found = it.next().getSource();
if (!query.contains(found)) {
it.remove();
}
}
} } | public class class_name {
static void filterUnwantedReferences(List<JpaRef> result, Collection<BeanId> query) {
ListIterator<JpaRef> it = result.listIterator();
while (it.hasNext()) {
// remove reference from result that was not part of the query
BeanId found = it.next().getSource();
if (!query.contains(found)) {
it.remove(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static File createTmpFile(InputStream inputStream, String name, String ext, File tmpDirFile) throws IOException {
FileOutputStream fos = null;
try {
File tmpFile;
if (tmpDirFile == null) {
tmpFile = File.createTempFile(name, '.' + ext);
} else {
tmpFile = File.createTempFile(name, '.' + ext, tmpDirFile);
}
tmpFile.deleteOnExit();
fos = new FileOutputStream(tmpFile);
int read = 0;
byte[] bytes = new byte[1024 * 100];
while ((read = inputStream.read(bytes)) != -1) {
fos.write(bytes, 0, read);
}
fos.flush();
return tmpFile;
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
}
}
}
} } | public class class_name {
public static File createTmpFile(InputStream inputStream, String name, String ext, File tmpDirFile) throws IOException {
FileOutputStream fos = null;
try {
File tmpFile;
if (tmpDirFile == null) {
tmpFile = File.createTempFile(name, '.' + ext); // depends on control dependency: [if], data = [none]
} else {
tmpFile = File.createTempFile(name, '.' + ext, tmpDirFile); // depends on control dependency: [if], data = [none]
}
tmpFile.deleteOnExit();
fos = new FileOutputStream(tmpFile);
int read = 0;
byte[] bytes = new byte[1024 * 100];
while ((read = inputStream.read(bytes)) != -1) {
fos.write(bytes, 0, read); // depends on control dependency: [while], data = [none]
}
fos.flush();
return tmpFile;
} finally {
if (inputStream != null) {
try {
inputStream.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
}
if (fos != null) {
try {
fos.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public java.util.List<ReplicationGroup> getReplicationGroups() {
if (replicationGroups == null) {
replicationGroups = new com.amazonaws.internal.SdkInternalList<ReplicationGroup>();
}
return replicationGroups;
} } | public class class_name {
public java.util.List<ReplicationGroup> getReplicationGroups() {
if (replicationGroups == null) {
replicationGroups = new com.amazonaws.internal.SdkInternalList<ReplicationGroup>(); // depends on control dependency: [if], data = [none]
}
return replicationGroups;
} } |
public class class_name {
public static Double castDouble(Object o) {
if (o == null) {
return null;
}
if (o instanceof Number) {
return ((Number) o).doubleValue();
}
try {
return Double.valueOf(o.toString());
} catch (NumberFormatException e) {
return null;
}
} } | public class class_name {
public static Double castDouble(Object o) {
if (o == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (o instanceof Number) {
return ((Number) o).doubleValue(); // depends on control dependency: [if], data = [none]
}
try {
return Double.valueOf(o.toString()); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
final void doPopulateTimeDimensions() {
final List<TimeDimension> timeDimensions = this.timeDimensionDao.getTimeDimensions();
if (timeDimensions.isEmpty()) {
logger.info("No TimeDimensions exist, creating them");
} else if (timeDimensions.size() != (24 * 60)) {
this.logger.info(
"There are only "
+ timeDimensions.size()
+ " time dimensions in the database, there should be "
+ (24 * 60)
+ " creating missing dimensions");
} else {
this.logger.debug("Found expected " + timeDimensions.size() + " time dimensions");
return;
}
LocalTime nextTime = new LocalTime(0, 0);
final LocalTime lastTime = new LocalTime(23, 59);
for (final TimeDimension timeDimension : timeDimensions) {
LocalTime dimensionTime = timeDimension.getTime();
if (nextTime.isBefore(dimensionTime)) {
do {
checkShutdown();
this.timeDimensionDao.createTimeDimension(nextTime);
nextTime = nextTime.plusMinutes(1);
} while (nextTime.isBefore(dimensionTime));
} else if (nextTime.isAfter(dimensionTime)) {
do {
checkShutdown();
this.timeDimensionDao.createTimeDimension(dimensionTime);
dimensionTime = dimensionTime.plusMinutes(1);
} while (nextTime.isAfter(dimensionTime));
}
nextTime = dimensionTime.plusMinutes(1);
}
// Add any missing times from the tail
while (nextTime.isBefore(lastTime) || nextTime.equals(lastTime)) {
checkShutdown();
this.timeDimensionDao.createTimeDimension(nextTime);
if (nextTime.equals(lastTime)) {
break;
}
nextTime = nextTime.plusMinutes(1);
}
} } | public class class_name {
final void doPopulateTimeDimensions() {
final List<TimeDimension> timeDimensions = this.timeDimensionDao.getTimeDimensions();
if (timeDimensions.isEmpty()) {
logger.info("No TimeDimensions exist, creating them"); // depends on control dependency: [if], data = [none]
} else if (timeDimensions.size() != (24 * 60)) {
this.logger.info(
"There are only "
+ timeDimensions.size()
+ " time dimensions in the database, there should be "
+ (24 * 60)
+ " creating missing dimensions"); // depends on control dependency: [if], data = [none]
} else {
this.logger.debug("Found expected " + timeDimensions.size() + " time dimensions"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
LocalTime nextTime = new LocalTime(0, 0);
final LocalTime lastTime = new LocalTime(23, 59);
for (final TimeDimension timeDimension : timeDimensions) {
LocalTime dimensionTime = timeDimension.getTime();
if (nextTime.isBefore(dimensionTime)) {
do {
checkShutdown();
this.timeDimensionDao.createTimeDimension(nextTime);
nextTime = nextTime.plusMinutes(1);
} while (nextTime.isBefore(dimensionTime));
} else if (nextTime.isAfter(dimensionTime)) {
do {
checkShutdown();
this.timeDimensionDao.createTimeDimension(dimensionTime);
dimensionTime = dimensionTime.plusMinutes(1);
} while (nextTime.isAfter(dimensionTime));
}
nextTime = dimensionTime.plusMinutes(1); // depends on control dependency: [for], data = [none]
}
// Add any missing times from the tail
while (nextTime.isBefore(lastTime) || nextTime.equals(lastTime)) {
checkShutdown(); // depends on control dependency: [while], data = [none]
this.timeDimensionDao.createTimeDimension(nextTime); // depends on control dependency: [while], data = [none]
if (nextTime.equals(lastTime)) {
break;
}
nextTime = nextTime.plusMinutes(1); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public static ComponentImpl loadComponent(PageContext pc, Page page, String callPath, boolean isRealPath, boolean silent, boolean isExtendedComponent, boolean executeConstr)
throws PageException {
CIPage cip = toCIPage(page, callPath);
if (silent) {
// TODO is there a more direct way
BodyContent bc = pc.pushBody();
try {
return _loadComponent(pc, cip, callPath, isRealPath, isExtendedComponent, executeConstr);
}
finally {
BodyContentUtil.clearAndPop(pc, bc);
}
}
return _loadComponent(pc, cip, callPath, isRealPath, isExtendedComponent, executeConstr);
} } | public class class_name {
public static ComponentImpl loadComponent(PageContext pc, Page page, String callPath, boolean isRealPath, boolean silent, boolean isExtendedComponent, boolean executeConstr)
throws PageException {
CIPage cip = toCIPage(page, callPath);
if (silent) {
// TODO is there a more direct way
BodyContent bc = pc.pushBody();
try {
return _loadComponent(pc, cip, callPath, isRealPath, isExtendedComponent, executeConstr); // depends on control dependency: [try], data = [none]
}
finally {
BodyContentUtil.clearAndPop(pc, bc);
}
}
return _loadComponent(pc, cip, callPath, isRealPath, isExtendedComponent, executeConstr);
} } |
public class class_name {
public MockSubnet deleteSubnet(final String subnetId) {
if (subnetId != null && allMockSubnets.containsKey(subnetId)) {
return allMockSubnets.remove(subnetId);
}
return null;
} } | public class class_name {
public MockSubnet deleteSubnet(final String subnetId) {
if (subnetId != null && allMockSubnets.containsKey(subnetId)) {
return allMockSubnets.remove(subnetId); // depends on control dependency: [if], data = [(subnetId]
}
return null;
} } |
public class class_name {
public void clear() {
if (stateStack.size()>1) {
int size = stateStack.size()-1;
throw new GroovyBugError("the compile stack contains "+size+" more push instruction"+(size==1?"":"s")+" than pops.");
}
if (lhsStack.size()>1) {
int size = lhsStack.size()-1;
throw new GroovyBugError("lhs stack is supposed to be empty, but has " +
size + " elements left.");
}
if (implicitThisStack.size()>1) {
int size = implicitThisStack.size()-1;
throw new GroovyBugError("implicit 'this' stack is supposed to be empty, but has " +
size + " elements left.");
}
clear = true;
MethodVisitor mv = controller.getMethodVisitor();
// br experiment with local var table so debuggers can retrieve variable names
if (true) {//AsmClassGenerator.CREATE_DEBUG_INFO) {
if (thisEndLabel==null) setEndLabels();
if (!scope.isInStaticContext()) {
// write "this"
mv.visitLocalVariable("this", className, null, thisStartLabel, thisEndLabel, 0);
}
for (Iterator iterator = usedVariables.iterator(); iterator.hasNext();) {
BytecodeVariable v = (BytecodeVariable) iterator.next();
ClassNode t = v.getType();
if (v.isHolder()) t = ClassHelper.REFERENCE_TYPE;
String type = BytecodeHelper.getTypeDescription(t);
Label start = v.getStartLabel();
Label end = v.getEndLabel();
mv.visitLocalVariable(v.getName(), type, null, start, end, v.getIndex());
}
}
//exception table writing
for (ExceptionTableEntry ep : typedExceptions) {
mv.visitTryCatchBlock(ep.start, ep.end, ep.goal, ep.sig);
}
//exception table writing
for (ExceptionTableEntry ep : untypedExceptions) {
mv.visitTryCatchBlock(ep.start, ep.end, ep.goal, ep.sig);
}
pop();
typedExceptions.clear();
untypedExceptions.clear();
stackVariables.clear();
usedVariables.clear();
scope = null;
finallyBlocks.clear();
resetVariableIndex(false);
superBlockNamedLabels.clear();
currentBlockNamedLabels.clear();
namedLoopBreakLabel.clear();
namedLoopContinueLabel.clear();
continueLabel=null;
breakLabel=null;
thisStartLabel=null;
thisEndLabel=null;
mv = null;
} } | public class class_name {
public void clear() {
if (stateStack.size()>1) {
int size = stateStack.size()-1;
throw new GroovyBugError("the compile stack contains "+size+" more push instruction"+(size==1?"":"s")+" than pops.");
}
if (lhsStack.size()>1) {
int size = lhsStack.size()-1;
throw new GroovyBugError("lhs stack is supposed to be empty, but has " +
size + " elements left.");
}
if (implicitThisStack.size()>1) {
int size = implicitThisStack.size()-1;
throw new GroovyBugError("implicit 'this' stack is supposed to be empty, but has " +
size + " elements left.");
}
clear = true;
MethodVisitor mv = controller.getMethodVisitor();
// br experiment with local var table so debuggers can retrieve variable names
if (true) {//AsmClassGenerator.CREATE_DEBUG_INFO) {
if (thisEndLabel==null) setEndLabels();
if (!scope.isInStaticContext()) {
// write "this"
mv.visitLocalVariable("this", className, null, thisStartLabel, thisEndLabel, 0); // depends on control dependency: [if], data = [none]
}
for (Iterator iterator = usedVariables.iterator(); iterator.hasNext();) {
BytecodeVariable v = (BytecodeVariable) iterator.next();
ClassNode t = v.getType();
if (v.isHolder()) t = ClassHelper.REFERENCE_TYPE;
String type = BytecodeHelper.getTypeDescription(t);
Label start = v.getStartLabel();
Label end = v.getEndLabel();
mv.visitLocalVariable(v.getName(), type, null, start, end, v.getIndex()); // depends on control dependency: [for], data = [none]
}
}
//exception table writing
for (ExceptionTableEntry ep : typedExceptions) {
mv.visitTryCatchBlock(ep.start, ep.end, ep.goal, ep.sig); // depends on control dependency: [for], data = [ep]
}
//exception table writing
for (ExceptionTableEntry ep : untypedExceptions) {
mv.visitTryCatchBlock(ep.start, ep.end, ep.goal, ep.sig); // depends on control dependency: [for], data = [ep]
}
pop();
typedExceptions.clear();
untypedExceptions.clear();
stackVariables.clear();
usedVariables.clear();
scope = null;
finallyBlocks.clear();
resetVariableIndex(false);
superBlockNamedLabels.clear();
currentBlockNamedLabels.clear();
namedLoopBreakLabel.clear();
namedLoopContinueLabel.clear();
continueLabel=null;
breakLabel=null;
thisStartLabel=null;
thisEndLabel=null;
mv = null;
} } |
public class class_name {
public GetActiveNamesResult withActiveNames(String... activeNames) {
if (this.activeNames == null) {
setActiveNames(new java.util.ArrayList<String>(activeNames.length));
}
for (String ele : activeNames) {
this.activeNames.add(ele);
}
return this;
} } | public class class_name {
public GetActiveNamesResult withActiveNames(String... activeNames) {
if (this.activeNames == null) {
setActiveNames(new java.util.ArrayList<String>(activeNames.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : activeNames) {
this.activeNames.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@RobeService(group = "SystemParameter", description = "Create or update SystemParameter resource.")
@POST
@Path("admin")
@UnitOfWork
public Map<String, String> bulkSaveOrUpdate(Map<String, String> values) {
for (Map.Entry<String, String> entry : values.entrySet()) {
Optional<SystemParameter> optionalParameter = systemParameterDao.findByKey(entry.getKey());
SystemParameter parameter;
if (!optionalParameter.isPresent()) {
parameter = new SystemParameter();
parameter.setKey(entry.getKey());
parameter.setValue(entry.getValue());
} else {
parameter = optionalParameter.get();
parameter.setValue(entry.getValue());
}
systemParameterDao.update(parameter);
}
return values;
} } | public class class_name {
@RobeService(group = "SystemParameter", description = "Create or update SystemParameter resource.")
@POST
@Path("admin")
@UnitOfWork
public Map<String, String> bulkSaveOrUpdate(Map<String, String> values) {
for (Map.Entry<String, String> entry : values.entrySet()) {
Optional<SystemParameter> optionalParameter = systemParameterDao.findByKey(entry.getKey());
SystemParameter parameter;
if (!optionalParameter.isPresent()) {
parameter = new SystemParameter(); // depends on control dependency: [if], data = [none]
parameter.setKey(entry.getKey()); // depends on control dependency: [if], data = [none]
parameter.setValue(entry.getValue()); // depends on control dependency: [if], data = [none]
} else {
parameter = optionalParameter.get(); // depends on control dependency: [if], data = [none]
parameter.setValue(entry.getValue()); // depends on control dependency: [if], data = [none]
}
systemParameterDao.update(parameter); // depends on control dependency: [for], data = [none]
}
return values;
} } |
public class class_name {
@Override
public void visitCode(Code obj) {
try {
XMethod xMethod = getXMethod();
if (xMethod != null) {
String[] tes = xMethod.getThrownExceptions();
Set<String> thrownExceptions = new HashSet<>(Arrays.<String> asList((tes == null) ? new String[0] : tes));
blocks = new ArrayList<>();
inBlocks = new ArrayList<>();
transitionPoints = new BitSet();
CodeException[] ces = obj.getExceptionTable();
for (CodeException ce : ces) {
TryBlock tb = new TryBlock(ce);
int existingBlock = blocks.indexOf(tb);
if (existingBlock >= 0) {
tb = blocks.get(existingBlock);
tb.addCatchType(ce);
} else {
blocks.add(tb);
}
}
Iterator<TryBlock> it = blocks.iterator();
while (it.hasNext()) {
TryBlock block = it.next();
if (block.hasMultipleHandlers() || block.isFinally() || block.catchIsThrown(getConstantPool(), thrownExceptions)) {
it.remove();
}
}
if (blocks.size() > 1) {
stack.resetForMethodEntry(this);
super.visitCode(obj);
if (blocks.size() > 1) {
TryBlock firstBlock = blocks.get(0);
for (int i = 1; i < blocks.size(); i++) {
TryBlock secondBlock = blocks.get(i);
if (!blocksSplitAcrossTransitions(firstBlock, secondBlock) && (firstBlock.getCatchType() == secondBlock.getCatchType())
&& firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature())
&& firstBlock.getMessage().equals(secondBlock.getMessage())
&& firstBlock.getExceptionSignature().equals(secondBlock.getExceptionSignature())) {
bugReporter.reportBug(new BugInstance(this, BugType.STB_STACKED_TRY_BLOCKS.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addSourceLineRange(this, firstBlock.getStartPC(), firstBlock.getEndHandlerPC())
.addSourceLineRange(this, secondBlock.getStartPC(), secondBlock.getEndHandlerPC()));
}
firstBlock = secondBlock;
}
}
}
}
} finally {
blocks = null;
inBlocks = null;
transitionPoints = null;
}
} } | public class class_name {
@Override
public void visitCode(Code obj) {
try {
XMethod xMethod = getXMethod();
if (xMethod != null) {
String[] tes = xMethod.getThrownExceptions();
Set<String> thrownExceptions = new HashSet<>(Arrays.<String> asList((tes == null) ? new String[0] : tes));
blocks = new ArrayList<>(); // depends on control dependency: [if], data = [none]
inBlocks = new ArrayList<>(); // depends on control dependency: [if], data = [none]
transitionPoints = new BitSet(); // depends on control dependency: [if], data = [none]
CodeException[] ces = obj.getExceptionTable();
for (CodeException ce : ces) {
TryBlock tb = new TryBlock(ce);
int existingBlock = blocks.indexOf(tb);
if (existingBlock >= 0) {
tb = blocks.get(existingBlock); // depends on control dependency: [if], data = [(existingBlock]
tb.addCatchType(ce); // depends on control dependency: [if], data = [none]
} else {
blocks.add(tb); // depends on control dependency: [if], data = [none]
}
}
Iterator<TryBlock> it = blocks.iterator();
while (it.hasNext()) {
TryBlock block = it.next();
if (block.hasMultipleHandlers() || block.isFinally() || block.catchIsThrown(getConstantPool(), thrownExceptions)) {
it.remove(); // depends on control dependency: [if], data = [none]
}
}
if (blocks.size() > 1) {
stack.resetForMethodEntry(this); // depends on control dependency: [if], data = [none]
super.visitCode(obj); // depends on control dependency: [if], data = [none]
if (blocks.size() > 1) {
TryBlock firstBlock = blocks.get(0);
for (int i = 1; i < blocks.size(); i++) {
TryBlock secondBlock = blocks.get(i);
if (!blocksSplitAcrossTransitions(firstBlock, secondBlock) && (firstBlock.getCatchType() == secondBlock.getCatchType())
&& firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature())
&& firstBlock.getMessage().equals(secondBlock.getMessage())
&& firstBlock.getExceptionSignature().equals(secondBlock.getExceptionSignature())) {
bugReporter.reportBug(new BugInstance(this, BugType.STB_STACKED_TRY_BLOCKS.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addSourceLineRange(this, firstBlock.getStartPC(), firstBlock.getEndHandlerPC())
.addSourceLineRange(this, secondBlock.getStartPC(), secondBlock.getEndHandlerPC())); // depends on control dependency: [if], data = [none]
}
firstBlock = secondBlock; // depends on control dependency: [for], data = [none]
}
}
}
}
} finally {
blocks = null;
inBlocks = null;
transitionPoints = null;
}
} } |
public class class_name {
protected void moveSelectionBottom() {
final IStructuredSelection selection = this.list.getStructuredSelection();
final int index = this.conversions.indexOf(selection.getFirstElement());
if (index >= 0 && (index + selection.size()) < this.conversions.size()) {
for (int i = 0; i < selection.size(); ++i) {
final ConversionMapping previous = this.conversions.remove(index);
this.conversions.addLast(previous);
}
refreshListUI();
this.list.refresh(true);
enableButtons();
preferenceValueChanged();
}
} } | public class class_name {
protected void moveSelectionBottom() {
final IStructuredSelection selection = this.list.getStructuredSelection();
final int index = this.conversions.indexOf(selection.getFirstElement());
if (index >= 0 && (index + selection.size()) < this.conversions.size()) {
for (int i = 0; i < selection.size(); ++i) {
final ConversionMapping previous = this.conversions.remove(index);
this.conversions.addLast(previous); // depends on control dependency: [for], data = [none]
}
refreshListUI(); // depends on control dependency: [if], data = [none]
this.list.refresh(true); // depends on control dependency: [if], data = [none]
enableButtons(); // depends on control dependency: [if], data = [none]
preferenceValueChanged(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String[] names(){
List<String> namesList = new ArrayList<String>();
Enumeration<String> names = session.getAttributeNames();//request.getSession(true).getAttributeNames();
if (names == null) return null;
while (names.hasMoreElements()) {
Object o = names.nextElement();
namesList.add(o.toString());
}
return namesList.toArray(new String[namesList.size()]);
} } | public class class_name {
public String[] names(){
List<String> namesList = new ArrayList<String>();
Enumeration<String> names = session.getAttributeNames();//request.getSession(true).getAttributeNames();
if (names == null) return null;
while (names.hasMoreElements()) {
Object o = names.nextElement();
namesList.add(o.toString()); // depends on control dependency: [while], data = [none]
}
return namesList.toArray(new String[namesList.size()]);
} } |
public class class_name {
@Override
public String getSolrTypeName() {
Indexed indexedAnnotation = getIndexAnnotation();
if (indexedAnnotation != null && StringUtils.hasText(indexedAnnotation.type())) {
return indexedAnnotation.type();
}
return getActualType().getSimpleName().toLowerCase();
} } | public class class_name {
@Override
public String getSolrTypeName() {
Indexed indexedAnnotation = getIndexAnnotation();
if (indexedAnnotation != null && StringUtils.hasText(indexedAnnotation.type())) {
return indexedAnnotation.type(); // depends on control dependency: [if], data = [none]
}
return getActualType().getSimpleName().toLowerCase();
} } |
public class class_name {
public void marshall(GetDeviceRequest getDeviceRequest, ProtocolMarshaller protocolMarshaller) {
if (getDeviceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getDeviceRequest.getArn(), ARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetDeviceRequest getDeviceRequest, ProtocolMarshaller protocolMarshaller) {
if (getDeviceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getDeviceRequest.getArn(), ARN_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 overrideMinorityDefault(int index) {
if (targetMinorityDistMap.containsKey(index)) {
minorityLabelMap.put(index, 0);
} else {
throw new IllegalArgumentException(
"Index specified is not contained in the target minority distribution map specified with the preprocessor. Map contains "
+ ArrayUtils.toString(targetMinorityDistMap.keySet().toArray()));
}
} } | public class class_name {
public void overrideMinorityDefault(int index) {
if (targetMinorityDistMap.containsKey(index)) {
minorityLabelMap.put(index, 0); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException(
"Index specified is not contained in the target minority distribution map specified with the preprocessor. Map contains "
+ ArrayUtils.toString(targetMinorityDistMap.keySet().toArray()));
}
} } |
public class class_name {
protected void solverSampleReceived(IoSession session,
SampleMessage sampleMessage) {
for (SampleListener listener : this.sampleListeners) {
listener.sampleReceived(this, sampleMessage);
}
} } | public class class_name {
protected void solverSampleReceived(IoSession session,
SampleMessage sampleMessage) {
for (SampleListener listener : this.sampleListeners) {
listener.sampleReceived(this, sampleMessage); // depends on control dependency: [for], data = [listener]
}
} } |
public class class_name {
void start() {
/* make sure any currently running dispatchers are stopped */
stop();
/* create the download dispatcher and start it. */
for (int i = 0; i < dispatchers.length; i++) {
DownloadDispatcher dispatcher = new DownloadDispatcher(downloadQueue, delivery, logger);
dispatchers[i] = dispatcher;
dispatcher.start();
}
logger.log("Thread pool size: " + dispatchers.length);
} } | public class class_name {
void start() {
/* make sure any currently running dispatchers are stopped */
stop();
/* create the download dispatcher and start it. */
for (int i = 0; i < dispatchers.length; i++) {
DownloadDispatcher dispatcher = new DownloadDispatcher(downloadQueue, delivery, logger);
dispatchers[i] = dispatcher; // depends on control dependency: [for], data = [i]
dispatcher.start(); // depends on control dependency: [for], data = [none]
}
logger.log("Thread pool size: " + dispatchers.length);
} } |
public class class_name {
public void moveMessage(boolean discard)
throws SIMPControllableNotFoundException,
SIMPRuntimeOperationFailedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "moveMessage", new Object[] { Boolean.valueOf(discard) });
assertValidControllable();
LocalTransaction tran = _txManager.createLocalTransaction(false);
SIMPMessage msg = null;
try
{
msg = getSIMPMessage();
}
catch (SIResourceException e)
{
// No FFDC code needed
SIMPRuntimeOperationFailedException finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {"QueuedMessage.moveMessage",
"1:473:1.66",
e,
Long.toString(_messageID)},
null), e,
"INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {Long.toString(_messageID)});
SibTr.exception(tc, finalE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveMessage", finalE);
throw finalE;
}
if(!discard)
{
try
{
copyMessageToExceptionDestination(tran);
}
catch (Exception e)
{
// No FFDC code needed
SIMPRuntimeOperationFailedException finalE =
new SIMPRuntimeOperationFailedException(e);
SibTr.exception(tc, finalE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveMessage", finalE);
throw finalE;
}
discard = true;
}
if (discard)
{
try
{
if(msg.isInStore())
{
if(msg.getLockID()==AbstractItem.NO_LOCK_ID)
{
//lock the message
// Cache a lock ID to lock the items with
long lockID = _messageProcessor.getMessageStore().getUniqueLockID(AbstractItem.STORE_NEVER);
msg.lockItemIfAvailable(lockID);
}
Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(tran);
msg.remove(msTran, msg.getLockID());
}
}
catch (Exception e)
{
// No FFDC code needed
SIMPRuntimeOperationFailedException finalE = null;
boolean adding = false;
boolean removing = false;
if (msg instanceof MessageItem)
{
adding = ((MessageItem)msg).isAdding();
removing = ((MessageItem)msg).isRemoving();
}
else
{
adding = ((MessageItemReference)msg).isAdding();
removing = ((MessageItemReference)msg).isRemoving();
}
if (adding)
{
// If the message is adding it probably means that
// we have an indoubt transaction which hasn't been committed
finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"MESSAGE_INDOUBT_WARNING_CWSIP0361",
new Object[] {Long.toString(_messageID),
_destinationHandler.getName()},
null),
e,
"MESSAGE_INDOUBT_WARNING_CWSIP0361", new Object[] {Long.toString(_messageID),
_destinationHandler.getName() });
}
else if (removing)
{
// If the message is deleting it probably means that
// we have delivered the message to a consumer
finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"MESSAGE_INDOUBT_WARNING_CWSIP0362",
new Object[] {Long.toString(_messageID),
_destinationHandler.getName()},
null),
e,
"MESSAGE_INDOUBT_WARNING_CWSIP0362", new Object[] { Long.toString(_messageID),
_destinationHandler.getName() });
}
else
{
// Unexpected exception
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.runtime.QueuedMessage.moveMessage",
"1:579:1.66",
this);
finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {"QueuedMessage.removeMessage",
"1:587:1.66",
e,
Long.toString(_messageID)},
null), e,
"INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] { Long.toString(_messageID)});
}
try
{
tran.rollback();
}
catch (SIException ee)
{
FFDCFilter.processException(
ee,
"com.ibm.ws.sib.processor.runtime.QueuedMessage.moveMessage",
"1:603:1.66",
this);
SibTr.exception(tc, ee);
}
SibTr.exception(tc, finalE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveMessage", finalE);
throw finalE;
}
}
try
{
tran.commit();
}
catch (SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.runtime.QueuedMessage.moveMessage",
"1:625:1.66",
this);
SIMPRuntimeOperationFailedException finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {"QueuedMessage.removeMessage",
"1:633:1.66",
e,
Long.toString(_messageID)},
null), e,
"INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {Long.toString(_messageID)});
SibTr.exception(tc, finalE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "moveMessage", finalE);
throw finalE;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveMessage");
} } | public class class_name {
public void moveMessage(boolean discard)
throws SIMPControllableNotFoundException,
SIMPRuntimeOperationFailedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "moveMessage", new Object[] { Boolean.valueOf(discard) });
assertValidControllable();
LocalTransaction tran = _txManager.createLocalTransaction(false);
SIMPMessage msg = null;
try
{
msg = getSIMPMessage();
}
catch (SIResourceException e)
{
// No FFDC code needed
SIMPRuntimeOperationFailedException finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {"QueuedMessage.moveMessage",
"1:473:1.66",
e,
Long.toString(_messageID)},
null), e,
"INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {Long.toString(_messageID)});
SibTr.exception(tc, finalE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveMessage", finalE);
throw finalE;
}
if(!discard)
{
try
{
copyMessageToExceptionDestination(tran); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
// No FFDC code needed
SIMPRuntimeOperationFailedException finalE =
new SIMPRuntimeOperationFailedException(e);
SibTr.exception(tc, finalE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveMessage", finalE);
throw finalE;
} // depends on control dependency: [catch], data = [none]
discard = true;
}
if (discard)
{
try
{
if(msg.isInStore())
{
if(msg.getLockID()==AbstractItem.NO_LOCK_ID)
{
//lock the message
// Cache a lock ID to lock the items with
long lockID = _messageProcessor.getMessageStore().getUniqueLockID(AbstractItem.STORE_NEVER);
msg.lockItemIfAvailable(lockID); // depends on control dependency: [if], data = [none]
}
Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(tran);
msg.remove(msTran, msg.getLockID()); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e)
{
// No FFDC code needed
SIMPRuntimeOperationFailedException finalE = null;
boolean adding = false;
boolean removing = false;
if (msg instanceof MessageItem)
{
adding = ((MessageItem)msg).isAdding(); // depends on control dependency: [if], data = [none]
removing = ((MessageItem)msg).isRemoving(); // depends on control dependency: [if], data = [none]
}
else
{
adding = ((MessageItemReference)msg).isAdding(); // depends on control dependency: [if], data = [none]
removing = ((MessageItemReference)msg).isRemoving(); // depends on control dependency: [if], data = [none]
}
if (adding)
{
// If the message is adding it probably means that
// we have an indoubt transaction which hasn't been committed
finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"MESSAGE_INDOUBT_WARNING_CWSIP0361",
new Object[] {Long.toString(_messageID),
_destinationHandler.getName()},
null),
e,
"MESSAGE_INDOUBT_WARNING_CWSIP0361", new Object[] {Long.toString(_messageID),
_destinationHandler.getName() }); // depends on control dependency: [if], data = [none]
}
else if (removing)
{
// If the message is deleting it probably means that
// we have delivered the message to a consumer
finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"MESSAGE_INDOUBT_WARNING_CWSIP0362",
new Object[] {Long.toString(_messageID),
_destinationHandler.getName()},
null),
e,
"MESSAGE_INDOUBT_WARNING_CWSIP0362", new Object[] { Long.toString(_messageID),
_destinationHandler.getName() }); // depends on control dependency: [if], data = [none]
}
else
{
// Unexpected exception
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.runtime.QueuedMessage.moveMessage",
"1:579:1.66",
this); // depends on control dependency: [if], data = [none]
finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {"QueuedMessage.removeMessage",
"1:587:1.66",
e,
Long.toString(_messageID)},
null), e,
"INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] { Long.toString(_messageID)}); // depends on control dependency: [if], data = [none]
}
try
{
tran.rollback(); // depends on control dependency: [try], data = [none]
}
catch (SIException ee)
{
FFDCFilter.processException(
ee,
"com.ibm.ws.sib.processor.runtime.QueuedMessage.moveMessage",
"1:603:1.66",
this);
SibTr.exception(tc, ee);
} // depends on control dependency: [catch], data = [none]
SibTr.exception(tc, finalE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveMessage", finalE);
throw finalE;
} // depends on control dependency: [catch], data = [none]
}
try
{
tran.commit();
}
catch (SIException e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.runtime.QueuedMessage.moveMessage",
"1:625:1.66",
this);
SIMPRuntimeOperationFailedException finalE =
new SIMPRuntimeOperationFailedException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {"QueuedMessage.removeMessage",
"1:633:1.66",
e,
Long.toString(_messageID)},
null), e,
"INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {Long.toString(_messageID)});
SibTr.exception(tc, finalE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "moveMessage", finalE);
throw finalE;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "moveMessage");
} } |
public class class_name {
private Properties loadQuartzProperties() {
InputStream resourceStream = AgentScheduler.class.getResourceAsStream("/logspace-quartz.properties");
try {
Properties properties = new Properties();
properties.load(resourceStream);
List<Object> keys = new ArrayList<Object>(properties.keySet());
for (Object eachKey : keys) {
String key = eachKey.toString();
properties.put(QUARTZ_PREFIX + key, this.replacePackagePlaceholderIfNecessary(properties.get(key)));
properties.remove(key);
}
return properties;
} catch (Exception e) {
throw new AgentControllerInitializationException("Error loading logspace-quartz.properties.", e);
} finally {
try {
resourceStream.close();
} catch (IOException e) {
// do nothing
}
}
} } | public class class_name {
private Properties loadQuartzProperties() {
InputStream resourceStream = AgentScheduler.class.getResourceAsStream("/logspace-quartz.properties");
try {
Properties properties = new Properties();
properties.load(resourceStream); // depends on control dependency: [try], data = [none]
List<Object> keys = new ArrayList<Object>(properties.keySet());
for (Object eachKey : keys) {
String key = eachKey.toString();
properties.put(QUARTZ_PREFIX + key, this.replacePackagePlaceholderIfNecessary(properties.get(key))); // depends on control dependency: [for], data = [none]
properties.remove(key); // depends on control dependency: [for], data = [none]
}
return properties; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new AgentControllerInitializationException("Error loading logspace-quartz.properties.", e);
} finally { // depends on control dependency: [catch], data = [none]
try {
resourceStream.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// do nothing
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static void closeQuietly(final Connection connection)
{
if (connection != null) {
try {
connection.close();
}
catch (JMSException je) {
if (je.getCause() instanceof InterruptedException) {
LOG.trace("ActiveMQ caught and wrapped InterruptedException");
}
if (je.getCause() instanceof InterruptedIOException) {
LOG.trace("ActiveMQ caught and wrapped InterruptedIOException");
}
else {
LOG.warnDebug(je, "While closing connection");
}
}
}
} } | public class class_name {
public static void closeQuietly(final Connection connection)
{
if (connection != null) {
try {
connection.close(); // depends on control dependency: [try], data = [none]
}
catch (JMSException je) {
if (je.getCause() instanceof InterruptedException) {
LOG.trace("ActiveMQ caught and wrapped InterruptedException"); // depends on control dependency: [if], data = [none]
}
if (je.getCause() instanceof InterruptedIOException) {
LOG.trace("ActiveMQ caught and wrapped InterruptedIOException"); // depends on control dependency: [if], data = [none]
}
else {
LOG.warnDebug(je, "While closing connection"); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static int v(String tag, String msg) {
collectLogEntry(Constants.VERBOSE, tag, msg, null);
if (isLoggable(tag, Constants.VERBOSE)) {
return android.util.Log.v(tag, msg);
}
return 0;
} } | public class class_name {
public static int v(String tag, String msg) {
collectLogEntry(Constants.VERBOSE, tag, msg, null);
if (isLoggable(tag, Constants.VERBOSE)) {
return android.util.Log.v(tag, msg); // depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
private void updateEditorValues(
CmsEntity previous,
CmsEntity updated,
CmsEntity target,
List<String> parentPathElements) {
for (String attributeName : m_entityBackend.getType(target.getTypeName()).getAttributeNames()) {
CmsAttributeHandler handler = getAttributeHandler(attributeName, parentPathElements);
if (handler == null) {
// non visible attribute, skip it
continue;
}
if (previous.hasAttribute(attributeName)
&& updated.hasAttribute(attributeName)
&& target.hasAttribute(attributeName)) {
CmsEntityAttribute updatedAttribute = updated.getAttribute(attributeName);
CmsEntityAttribute previousAttribute = previous.getAttribute(attributeName);
CmsEntityAttribute targetAttribute = target.getAttribute(attributeName);
if (updatedAttribute.isSimpleValue()) {
if ((updatedAttribute.getValueCount() == previousAttribute.getValueCount())
&& (updatedAttribute.getValueCount() == targetAttribute.getValueCount())) {
for (int i = 0; i < updatedAttribute.getValueCount(); i++) {
if (!updatedAttribute.getSimpleValues().get(i).equals(
previousAttribute.getSimpleValues().get(i))
&& previousAttribute.getSimpleValues().get(i).equals(
targetAttribute.getSimpleValues().get(i))) {
changeSimpleValue(
attributeName,
i,
updatedAttribute.getSimpleValues().get(i),
parentPathElements);
}
}
} else {
if (targetAttribute.getValueCount() == previousAttribute.getValueCount()) {
// only act, if the value count has not been altered while executing the server request
if (updatedAttribute.getValueCount() > previousAttribute.getValueCount()) {
// new values have been added
for (int i = 0; i < updatedAttribute.getValueCount(); i++) {
if (i >= previousAttribute.getSimpleValues().size()) {
handler.addNewAttributeValue(updatedAttribute.getSimpleValues().get(i));
} else if (!updatedAttribute.getSimpleValues().get(i).equals(
previousAttribute.getSimpleValues().get(i))
&& previousAttribute.getSimpleValues().get(i).equals(
targetAttribute.getSimpleValues().get(i))) {
changeSimpleValue(
attributeName,
i,
updatedAttribute.getSimpleValues().get(i),
parentPathElements);
}
}
} else {
// values have been removed
for (int i = previousAttribute.getValueCount() - 1; i >= 0; i--) {
if (i >= updatedAttribute.getSimpleValues().size()) {
handler.removeAttributeValue(i);
} else if (!updatedAttribute.getSimpleValues().get(i).equals(
previousAttribute.getSimpleValues().get(i))
&& previousAttribute.getSimpleValues().get(i).equals(
targetAttribute.getSimpleValues().get(i))) {
changeSimpleValue(
attributeName,
i,
updatedAttribute.getSimpleValues().get(i),
parentPathElements);
}
}
}
}
}
} else {
if (targetAttribute.getValueCount() == previousAttribute.getValueCount()) {
// only act, if the value count has not been altered while executing the server request
if (updatedAttribute.getValueCount() > previousAttribute.getValueCount()) {
// new values have been added
for (int i = 0; i < updatedAttribute.getValueCount(); i++) {
if (i >= previousAttribute.getSimpleValues().size()) {
handler.addNewAttributeValue(
m_entityBackend.registerEntity(
updatedAttribute.getComplexValues().get(i),
true));
} else {
List<String> childPathElements = new ArrayList<String>(parentPathElements);
childPathElements.add(attributeName + "[" + i + "]");
updateEditorValues(
previousAttribute.getComplexValues().get(i),
updatedAttribute.getComplexValues().get(i),
targetAttribute.getComplexValues().get(i),
childPathElements);
}
}
} else {
// values have been removed
for (int i = previousAttribute.getValueCount() - 1; i >= 0; i--) {
if (i >= updatedAttribute.getValueCount()) {
handler.removeAttributeValue(i);
} else {
List<String> childPathElements = new ArrayList<String>(parentPathElements);
childPathElements.add(attributeName + "[" + i + "]");
updateEditorValues(
previousAttribute.getComplexValues().get(i),
updatedAttribute.getComplexValues().get(i),
targetAttribute.getComplexValues().get(i),
childPathElements);
}
}
}
}
}
} else if (previous.hasAttribute(attributeName) && target.hasAttribute(attributeName)) {
for (int i = target.getAttribute(attributeName).getValueCount() - 1; i >= 0; i--) {
handler.removeAttributeValue(i);
}
} else if (!previous.hasAttribute(attributeName)
&& !target.hasAttribute(attributeName)
&& updated.hasAttribute(attributeName)) {
CmsEntityAttribute updatedAttribute = updated.getAttribute(attributeName);
for (int i = 0; i < updatedAttribute.getValueCount(); i++) {
if (updatedAttribute.isSimpleValue()) {
handler.addNewAttributeValue(updatedAttribute.getSimpleValues().get(i));
} else {
handler.addNewAttributeValue(
m_entityBackend.registerEntity(updatedAttribute.getComplexValues().get(i), true));
}
}
}
}
} } | public class class_name {
private void updateEditorValues(
CmsEntity previous,
CmsEntity updated,
CmsEntity target,
List<String> parentPathElements) {
for (String attributeName : m_entityBackend.getType(target.getTypeName()).getAttributeNames()) {
CmsAttributeHandler handler = getAttributeHandler(attributeName, parentPathElements);
if (handler == null) {
// non visible attribute, skip it
continue;
}
if (previous.hasAttribute(attributeName)
&& updated.hasAttribute(attributeName)
&& target.hasAttribute(attributeName)) {
CmsEntityAttribute updatedAttribute = updated.getAttribute(attributeName);
CmsEntityAttribute previousAttribute = previous.getAttribute(attributeName);
CmsEntityAttribute targetAttribute = target.getAttribute(attributeName);
if (updatedAttribute.isSimpleValue()) {
if ((updatedAttribute.getValueCount() == previousAttribute.getValueCount())
&& (updatedAttribute.getValueCount() == targetAttribute.getValueCount())) {
for (int i = 0; i < updatedAttribute.getValueCount(); i++) {
if (!updatedAttribute.getSimpleValues().get(i).equals(
previousAttribute.getSimpleValues().get(i))
&& previousAttribute.getSimpleValues().get(i).equals(
targetAttribute.getSimpleValues().get(i))) {
changeSimpleValue(
attributeName,
i,
updatedAttribute.getSimpleValues().get(i),
parentPathElements);
// depends on control dependency: [if], data = [none]
}
}
} else {
if (targetAttribute.getValueCount() == previousAttribute.getValueCount()) {
// only act, if the value count has not been altered while executing the server request
if (updatedAttribute.getValueCount() > previousAttribute.getValueCount()) {
// new values have been added
for (int i = 0; i < updatedAttribute.getValueCount(); i++) {
if (i >= previousAttribute.getSimpleValues().size()) {
handler.addNewAttributeValue(updatedAttribute.getSimpleValues().get(i));
// depends on control dependency: [if], data = [(i]
} else if (!updatedAttribute.getSimpleValues().get(i).equals(
previousAttribute.getSimpleValues().get(i))
&& previousAttribute.getSimpleValues().get(i).equals(
targetAttribute.getSimpleValues().get(i))) {
changeSimpleValue(
attributeName,
i,
updatedAttribute.getSimpleValues().get(i),
parentPathElements);
// depends on control dependency: [if], data = [none]
}
}
} else {
// values have been removed
for (int i = previousAttribute.getValueCount() - 1; i >= 0; i--) {
if (i >= updatedAttribute.getSimpleValues().size()) {
handler.removeAttributeValue(i);
// depends on control dependency: [if], data = [(i]
} else if (!updatedAttribute.getSimpleValues().get(i).equals(
previousAttribute.getSimpleValues().get(i))
&& previousAttribute.getSimpleValues().get(i).equals(
targetAttribute.getSimpleValues().get(i))) {
changeSimpleValue(
attributeName,
i,
updatedAttribute.getSimpleValues().get(i),
parentPathElements);
// depends on control dependency: [if], data = [none]
}
}
}
}
}
} else {
if (targetAttribute.getValueCount() == previousAttribute.getValueCount()) {
// only act, if the value count has not been altered while executing the server request
if (updatedAttribute.getValueCount() > previousAttribute.getValueCount()) {
// new values have been added
for (int i = 0; i < updatedAttribute.getValueCount(); i++) {
if (i >= previousAttribute.getSimpleValues().size()) {
handler.addNewAttributeValue(
m_entityBackend.registerEntity(
updatedAttribute.getComplexValues().get(i),
true));
// depends on control dependency: [if], data = [none]
} else {
List<String> childPathElements = new ArrayList<String>(parentPathElements);
childPathElements.add(attributeName + "[" + i + "]");
// depends on control dependency: [if], data = [none]
updateEditorValues(
previousAttribute.getComplexValues().get(i),
updatedAttribute.getComplexValues().get(i),
targetAttribute.getComplexValues().get(i),
childPathElements);
// depends on control dependency: [if], data = [none]
}
}
} else {
// values have been removed
for (int i = previousAttribute.getValueCount() - 1; i >= 0; i--) {
if (i >= updatedAttribute.getValueCount()) {
handler.removeAttributeValue(i);
// depends on control dependency: [if], data = [(i]
} else {
List<String> childPathElements = new ArrayList<String>(parentPathElements);
childPathElements.add(attributeName + "[" + i + "]");
// depends on control dependency: [if], data = [none]
updateEditorValues(
previousAttribute.getComplexValues().get(i),
updatedAttribute.getComplexValues().get(i),
targetAttribute.getComplexValues().get(i),
childPathElements);
// depends on control dependency: [if], data = [none]
}
}
}
}
}
} else if (previous.hasAttribute(attributeName) && target.hasAttribute(attributeName)) {
for (int i = target.getAttribute(attributeName).getValueCount() - 1; i >= 0; i--) {
handler.removeAttributeValue(i);
// depends on control dependency: [for], data = [i]
}
} else if (!previous.hasAttribute(attributeName)
&& !target.hasAttribute(attributeName)
&& updated.hasAttribute(attributeName)) {
CmsEntityAttribute updatedAttribute = updated.getAttribute(attributeName);
for (int i = 0; i < updatedAttribute.getValueCount(); i++) {
if (updatedAttribute.isSimpleValue()) {
handler.addNewAttributeValue(updatedAttribute.getSimpleValues().get(i));
// depends on control dependency: [if], data = [none]
} else {
handler.addNewAttributeValue(
m_entityBackend.registerEntity(updatedAttribute.getComplexValues().get(i), true));
// depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
@Override
public boolean put(String s, V v) {
int t = 0;
int limit = s.length();
int last = 0;
for (int k = 0; k < limit; k++) {
char c = s.charAt(k);
if (isCaseInsensitive() && c < 128)
c = StringUtils.lowercases[c];
while (true) {
int row = ROW_SIZE * t;
// Do we need to create the new row?
if (t == _rows) {
_rows++;
if (_rows >= _key.length) {
_rows--;
return false;
}
_tree[row] = c;
}
char n = _tree[row];
int diff = n - c;
if (diff == 0)
t = _tree[last = (row + EQ)];
else if (diff < 0)
t = _tree[last = (row + LO)];
else
t = _tree[last = (row + HI)];
// do we need a new row?
if (t == 0) {
t = _rows;
_tree[last] = (char) t;
}
if (diff == 0)
break;
}
}
// Do we need to create the new row?
if (t == _rows) {
_rows++;
if (_rows >= _key.length) {
_rows--;
return false;
}
}
// Put the key and value
_key[t] = v == null ? null : s;
_value[t] = v;
return true;
} } | public class class_name {
@Override
public boolean put(String s, V v) {
int t = 0;
int limit = s.length();
int last = 0;
for (int k = 0; k < limit; k++) {
char c = s.charAt(k);
if (isCaseInsensitive() && c < 128)
c = StringUtils.lowercases[c];
while (true) {
int row = ROW_SIZE * t;
// Do we need to create the new row?
if (t == _rows) {
_rows++; // depends on control dependency: [if], data = [none]
if (_rows >= _key.length) {
_rows--; // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
_tree[row] = c; // depends on control dependency: [if], data = [none]
}
char n = _tree[row];
int diff = n - c;
if (diff == 0)
t = _tree[last = (row + EQ)];
else if (diff < 0)
t = _tree[last = (row + LO)];
else
t = _tree[last = (row + HI)];
// do we need a new row?
if (t == 0) {
t = _rows; // depends on control dependency: [if], data = [none]
_tree[last] = (char) t; // depends on control dependency: [if], data = [none]
}
if (diff == 0)
break;
}
}
// Do we need to create the new row?
if (t == _rows) {
_rows++; // depends on control dependency: [if], data = [none]
if (_rows >= _key.length) {
_rows--; // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
// Put the key and value
_key[t] = v == null ? null : s;
_value[t] = v;
return true;
} } |
public class class_name {
public void buildFinishedClosure(BuildResult buildResult) {
Throwable failure = buildResult.getFailure();
Result result = failure == null ? Result.success() : Result.failure(failure);
logger.info("Build finished with result " + result);
MetricsDispatcher dispatcher = dispatcherSupplier.get();
dispatcher.result(result);
InfoBrokerPlugin infoBrokerPlugin = getNebulaInfoBrokerPlugin(buildResult.getGradle().getRootProject());
if (infoBrokerPlugin != null) {
Map<String, Object> reports = infoBrokerPlugin.buildReports();
for (Map.Entry<String, Object> report : reports.entrySet()) {
dispatcher.report(report.getKey(), report.getValue());
}
}
buildResultComplete.getAndSet(true);
shutdownIfComplete();
} } | public class class_name {
public void buildFinishedClosure(BuildResult buildResult) {
Throwable failure = buildResult.getFailure();
Result result = failure == null ? Result.success() : Result.failure(failure);
logger.info("Build finished with result " + result);
MetricsDispatcher dispatcher = dispatcherSupplier.get();
dispatcher.result(result);
InfoBrokerPlugin infoBrokerPlugin = getNebulaInfoBrokerPlugin(buildResult.getGradle().getRootProject());
if (infoBrokerPlugin != null) {
Map<String, Object> reports = infoBrokerPlugin.buildReports();
for (Map.Entry<String, Object> report : reports.entrySet()) {
dispatcher.report(report.getKey(), report.getValue()); // depends on control dependency: [for], data = [report]
}
}
buildResultComplete.getAndSet(true);
shutdownIfComplete();
} } |
public class class_name {
public void removeProfile(int position) {
if (mAccountHeaderBuilder.mProfiles != null && mAccountHeaderBuilder.mProfiles.size() > position) {
mAccountHeaderBuilder.mProfiles.remove(position);
}
mAccountHeaderBuilder.updateHeaderAndList();
} } | public class class_name {
public void removeProfile(int position) {
if (mAccountHeaderBuilder.mProfiles != null && mAccountHeaderBuilder.mProfiles.size() > position) {
mAccountHeaderBuilder.mProfiles.remove(position); // depends on control dependency: [if], data = [none]
}
mAccountHeaderBuilder.updateHeaderAndList();
} } |
public class class_name {
private String getLinkIncremental(final CommandLineLinkerConfiguration linkerConfig) {
String incremental = "0";
final String[] args = linkerConfig.getPreArguments();
for (final String arg : args) {
if ("/INCREMENTAL:NO".equals(arg)) {
incremental = "1";
}
if ("/INCREMENTAL:YES".equals(arg)) {
incremental = "2";
}
}
return incremental;
} } | public class class_name {
private String getLinkIncremental(final CommandLineLinkerConfiguration linkerConfig) {
String incremental = "0";
final String[] args = linkerConfig.getPreArguments();
for (final String arg : args) {
if ("/INCREMENTAL:NO".equals(arg)) {
incremental = "1"; // depends on control dependency: [if], data = [none]
}
if ("/INCREMENTAL:YES".equals(arg)) {
incremental = "2"; // depends on control dependency: [if], data = [none]
}
}
return incremental;
} } |
public class class_name {
public Object executeHelper(String sql,
String mediaType,
Map<String, ParameterBindingDTO> bindValues,
boolean describeOnly,
boolean internal)
throws SnowflakeSQLException, SFException
{
ScheduledExecutorService executor = null;
try
{
synchronized (this)
{
if (isClosed)
{
throw new SFException(ErrorCode.STATEMENT_CLOSED);
}
// initialize a sequence id if not closed or not for aborting
if (canceling.get())
{
// nothing to do if canceled
throw new SFException(ErrorCode.QUERY_CANCELED);
}
if (this.requestId != null)
{
throw new SnowflakeSQLException(SqlState.FEATURE_NOT_SUPPORTED,
ErrorCode.STATEMENT_ALREADY_RUNNING_QUERY.getMessageCode());
}
this.requestId = UUID.randomUUID().toString();
this.sequenceId = session.getAndIncrementSequenceId();
this.sqlText = sql;
}
EventUtil.triggerStateTransition(BasicEvent.QueryState.QUERY_STARTED,
String.format(QueryState.QUERY_STARTED.getArgString(), requestId));
// if there are a large number of bind values, we should upload them to stage
// instead of passing them in the payload (if enabled)
int numBinds = BindUploader.arrayBindValueCount(bindValues);
String bindStagePath = null;
if (0 < session.getArrayBindStageThreshold()
&& session.getArrayBindStageThreshold() <= numBinds
&& !describeOnly
&& !hasUnsupportedStageBind
&& BindUploader.isArrayBind(bindValues))
{
try (BindUploader uploader = BindUploader.newInstance(session, requestId))
{
uploader.upload(bindValues);
bindStagePath = uploader.getStagePath();
}
catch (BindException ex)
{
logger.debug("Exception encountered trying to upload binds to stage. Attaching binds in payload instead. ", ex);
TelemetryData errorLog = TelemetryUtil.buildJobData(this.requestId, ex.type.field, 1);
this.session.getTelemetryClient().tryAddLogToBatch(errorLog);
IncidentUtil.generateIncidentV2WithException(
session,
new SFException(ErrorCode.NON_FATAL_ERROR,
IncidentUtil.oneLiner("Failed to upload binds " +
"to stage:", ex)),
null,
requestId);
}
}
StmtUtil.StmtInput stmtInput = new StmtUtil.StmtInput();
stmtInput.setSql(sql)
.setMediaType(mediaType)
.setInternal(internal)
.setDescribeOnly(describeOnly)
.setServerUrl(session.getServerUrl())
.setRequestId(requestId)
.setSequenceId(sequenceId)
.setParametersMap(statementParametersMap)
.setSessionToken(session.getSessionToken())
.setNetworkTimeoutInMillis(session.getNetworkTimeoutInMilli())
.setInjectSocketTimeout(session.getInjectSocketTimeout())
.setInjectClientPause(session.getInjectClientPause())
.setCanceling(canceling)
.setRetry(false)
.setDescribedJobId(describeJobUUID)
.setCombineDescribe(session.getEnableCombineDescribe())
.setQuerySubmissionTime(System.currentTimeMillis())
.setServiceName(session.getServiceName());
if (bindStagePath != null)
{
stmtInput.setBindValues(null)
.setBindStage(bindStagePath);
// use the new SQL format for this query so dates/timestamps are parsed correctly
setUseNewSqlFormat(true);
}
else
{
stmtInput.setBindValues(bindValues)
.setBindStage(null);
}
if (canceling.get())
{
logger.debug("Query cancelled");
throw new SFException(ErrorCode.QUERY_CANCELED);
}
// if timeout is set, start a thread to cancel the request after timeout
// reached.
if (this.queryTimeout > 0)
{
executor = Executors.newScheduledThreadPool(1);
setTimeBomb(executor);
}
StmtUtil.StmtOutput stmtOutput = null;
boolean sessionRenewed;
do
{
sessionRenewed = false;
try
{
stmtOutput = StmtUtil.execute(stmtInput);
break;
}
catch (SnowflakeSQLException ex)
{
if (ex.getErrorCode() == Constants.SESSION_EXPIRED_GS_CODE)
{
try
{
// renew the session
session.renewSession(stmtInput.sessionToken);
}
catch (SnowflakeReauthenticationRequest ex0)
{
if (session.isExternalbrowserAuthenticator())
{
reauthenticate();
}
else
{
throw ex0;
}
}
// SNOW-18822: reset session token for the statement
stmtInput.setSessionToken(session.getSessionToken());
stmtInput.setRetry(true);
sessionRenewed = true;
logger.debug("Session got renewed, will retry");
}
else
{
throw ex;
}
}
}
while (sessionRenewed && !canceling.get());
// Debugging/Testing for incidents
if (System.getProperty("snowflake.enable_incident_test1") != null &&
System.getProperty("snowflake.enable_incident_test1").equals("true"))
{
throw (SFException) IncidentUtil.generateIncidentV2WithException(
session,
new SFException(ErrorCode.STATEMENT_CLOSED),
null,
this.requestId);
}
synchronized (this)
{
/*
* done with the remote execution of the query. set sequenceId to -1
* and request id to null so that we don't try to abort it upon canceling.
*/
this.sequenceId = -1;
this.requestId = null;
}
if (canceling.get())
{
// If we are here, this is the context for the initial query that
// is being canceled. Raise an exception anyway here even if
// the server fails to abort it.
throw new SFException(ErrorCode.QUERY_CANCELED);
}
logger.debug("Returning from executeHelper");
if (stmtOutput != null)
{
return stmtOutput.getResult();
}
throw new SFException(ErrorCode.INTERNAL_ERROR);
}
catch (SFException | SnowflakeSQLException ex)
{
isClosed = true;
throw ex;
}
finally
{
if (executor != null)
{
executor.shutdownNow();
}
// if this query enabled the new SQL format, re-disable it now
setUseNewSqlFormat(false);
}
} } | public class class_name {
public Object executeHelper(String sql,
String mediaType,
Map<String, ParameterBindingDTO> bindValues,
boolean describeOnly,
boolean internal)
throws SnowflakeSQLException, SFException
{
ScheduledExecutorService executor = null;
try
{
synchronized (this)
{
if (isClosed)
{
throw new SFException(ErrorCode.STATEMENT_CLOSED);
}
// initialize a sequence id if not closed or not for aborting
if (canceling.get())
{
// nothing to do if canceled
throw new SFException(ErrorCode.QUERY_CANCELED);
}
if (this.requestId != null)
{
throw new SnowflakeSQLException(SqlState.FEATURE_NOT_SUPPORTED,
ErrorCode.STATEMENT_ALREADY_RUNNING_QUERY.getMessageCode());
}
this.requestId = UUID.randomUUID().toString();
this.sequenceId = session.getAndIncrementSequenceId();
this.sqlText = sql;
}
EventUtil.triggerStateTransition(BasicEvent.QueryState.QUERY_STARTED,
String.format(QueryState.QUERY_STARTED.getArgString(), requestId));
// if there are a large number of bind values, we should upload them to stage
// instead of passing them in the payload (if enabled)
int numBinds = BindUploader.arrayBindValueCount(bindValues);
String bindStagePath = null;
if (0 < session.getArrayBindStageThreshold()
&& session.getArrayBindStageThreshold() <= numBinds
&& !describeOnly
&& !hasUnsupportedStageBind
&& BindUploader.isArrayBind(bindValues))
{
try (BindUploader uploader = BindUploader.newInstance(session, requestId))
{
uploader.upload(bindValues);
bindStagePath = uploader.getStagePath(); // depends on control dependency: [if], data = [none]
}
catch (BindException ex)
{
logger.debug("Exception encountered trying to upload binds to stage. Attaching binds in payload instead. ", ex);
TelemetryData errorLog = TelemetryUtil.buildJobData(this.requestId, ex.type.field, 1);
this.session.getTelemetryClient().tryAddLogToBatch(errorLog);
IncidentUtil.generateIncidentV2WithException(
session,
new SFException(ErrorCode.NON_FATAL_ERROR,
IncidentUtil.oneLiner("Failed to upload binds " +
"to stage:", ex)),
null,
requestId);
}
}
StmtUtil.StmtInput stmtInput = new StmtUtil.StmtInput();
stmtInput.setSql(sql)
.setMediaType(mediaType)
.setInternal(internal)
.setDescribeOnly(describeOnly)
.setServerUrl(session.getServerUrl())
.setRequestId(requestId)
.setSequenceId(sequenceId)
.setParametersMap(statementParametersMap)
.setSessionToken(session.getSessionToken())
.setNetworkTimeoutInMillis(session.getNetworkTimeoutInMilli())
.setInjectSocketTimeout(session.getInjectSocketTimeout())
.setInjectClientPause(session.getInjectClientPause())
.setCanceling(canceling)
.setRetry(false)
.setDescribedJobId(describeJobUUID)
.setCombineDescribe(session.getEnableCombineDescribe())
.setQuerySubmissionTime(System.currentTimeMillis())
.setServiceName(session.getServiceName());
if (bindStagePath != null)
{
stmtInput.setBindValues(null)
.setBindStage(bindStagePath);
// use the new SQL format for this query so dates/timestamps are parsed correctly
setUseNewSqlFormat(true);
}
else
{
stmtInput.setBindValues(bindValues)
.setBindStage(null);
}
if (canceling.get())
{
logger.debug("Query cancelled");
throw new SFException(ErrorCode.QUERY_CANCELED);
}
// if timeout is set, start a thread to cancel the request after timeout
// reached.
if (this.queryTimeout > 0)
{
executor = Executors.newScheduledThreadPool(1);
setTimeBomb(executor);
}
StmtUtil.StmtOutput stmtOutput = null;
boolean sessionRenewed;
do
{
sessionRenewed = false;
try
{
stmtOutput = StmtUtil.execute(stmtInput); // depends on control dependency: [try], data = [none]
break;
}
catch (SnowflakeSQLException ex)
{
if (ex.getErrorCode() == Constants.SESSION_EXPIRED_GS_CODE)
{
try
{
// renew the session
session.renewSession(stmtInput.sessionToken); // depends on control dependency: [try], data = [none]
}
catch (SnowflakeReauthenticationRequest ex0)
{
if (session.isExternalbrowserAuthenticator())
{
reauthenticate(); // depends on control dependency: [if], data = [none]
}
else
{
throw ex0;
}
} // depends on control dependency: [catch], data = [none]
// SNOW-18822: reset session token for the statement
stmtInput.setSessionToken(session.getSessionToken()); // depends on control dependency: [if], data = [none]
stmtInput.setRetry(true); // depends on control dependency: [if], data = [none]
sessionRenewed = true; // depends on control dependency: [if], data = [none]
logger.debug("Session got renewed, will retry"); // depends on control dependency: [if], data = [none]
}
else
{
throw ex;
}
} // depends on control dependency: [catch], data = [none]
}
while (sessionRenewed && !canceling.get());
// Debugging/Testing for incidents
if (System.getProperty("snowflake.enable_incident_test1") != null &&
System.getProperty("snowflake.enable_incident_test1").equals("true"))
{
throw (SFException) IncidentUtil.generateIncidentV2WithException(
session,
new SFException(ErrorCode.STATEMENT_CLOSED),
null,
this.requestId);
}
synchronized (this)
{
/*
* done with the remote execution of the query. set sequenceId to -1
* and request id to null so that we don't try to abort it upon canceling.
*/
this.sequenceId = -1;
this.requestId = null;
}
if (canceling.get())
{
// If we are here, this is the context for the initial query that
// is being canceled. Raise an exception anyway here even if
// the server fails to abort it.
throw new SFException(ErrorCode.QUERY_CANCELED);
}
logger.debug("Returning from executeHelper");
if (stmtOutput != null)
{
return stmtOutput.getResult();
}
throw new SFException(ErrorCode.INTERNAL_ERROR);
}
catch (SFException | SnowflakeSQLException ex)
{
isClosed = true;
throw ex;
}
finally
{
if (executor != null)
{
executor.shutdownNow();
}
// if this query enabled the new SQL format, re-disable it now
setUseNewSqlFormat(false);
}
} } |
public class class_name {
@SuppressWarnings( "unchecked" )
public <V> Key<V> getRoot() {
if ( this.getParent() == null ) {
return (Key<V>) this;
} else {
return this.getParent().getRoot();
}
} } | public class class_name {
@SuppressWarnings( "unchecked" )
public <V> Key<V> getRoot() {
if ( this.getParent() == null ) {
return (Key<V>) this; // depends on control dependency: [if], data = [none]
} else {
return this.getParent().getRoot(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static byte[] copyToBytes(MemorySegment[] segments, int offset, byte[] bytes,
int bytesOffset, int numBytes) {
if (inFirstSegment(segments, offset, numBytes)) {
segments[0].get(offset, bytes, bytesOffset, numBytes);
} else {
copyMultiSegmentsToBytes(segments, offset, bytes, bytesOffset, numBytes);
}
return bytes;
} } | public class class_name {
public static byte[] copyToBytes(MemorySegment[] segments, int offset, byte[] bytes,
int bytesOffset, int numBytes) {
if (inFirstSegment(segments, offset, numBytes)) {
segments[0].get(offset, bytes, bytesOffset, numBytes); // depends on control dependency: [if], data = [none]
} else {
copyMultiSegmentsToBytes(segments, offset, bytes, bytesOffset, numBytes); // depends on control dependency: [if], data = [none]
}
return bytes;
} } |
public class class_name {
private String[] parseData(String hashedPassword) throws IllegalArgumentException {
// <algorithm>:<iterations>:<base64(salt)>:<base64(hash)>
String[] items = hashedPassword.split(":");
String error = null;
if (items.length == 4) {
if (SUPPORTED_ALGORITHMS.contains(items[0])) {
try {
Integer.parseInt(items[1]);
return items; // good.
} catch (Exception e) {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ITERATION", items[1]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the iterations is not a number : " + items[1]);
}
}
} else {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ALGORITHM", items[0]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the hash algorithm is not supported : " + items[0]);
}
}
} else {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ELEMENTS", items.length);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the number of the elements is not 4 but " + items.length);
}
}
String message = Tr.formatMessage(tc, "JAVAEESEC_CDI_ERROR_PASSWORDHASH_INVALID_DATA", error);
Tr.error(tc, message);
throw new IllegalArgumentException(message);
} } | public class class_name {
private String[] parseData(String hashedPassword) throws IllegalArgumentException {
// <algorithm>:<iterations>:<base64(salt)>:<base64(hash)>
String[] items = hashedPassword.split(":");
String error = null;
if (items.length == 4) {
if (SUPPORTED_ALGORITHMS.contains(items[0])) {
try {
Integer.parseInt(items[1]); // depends on control dependency: [try], data = [none]
return items; // good. // depends on control dependency: [try], data = [none]
} catch (Exception e) {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ITERATION", items[1]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the iterations is not a number : " + items[1]); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} else {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ALGORITHM", items[0]);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the hash algorithm is not supported : " + items[0]);
}
}
} else {
error = Tr.formatMessage(tc, "JAVAEESEC_CDI_INVALID_ELEMENTS", items.length);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid format: the number of the elements is not 4 but " + items.length); // depends on control dependency: [if], data = [none]
}
}
String message = Tr.formatMessage(tc, "JAVAEESEC_CDI_ERROR_PASSWORDHASH_INVALID_DATA", error);
Tr.error(tc, message);
throw new IllegalArgumentException(message);
} } |
public class class_name {
static <T> T checkNotNull(T reference, String name) {
if (reference != null) {
return reference;
}
NullPointerException npe = new NullPointerException(name);
throw new ConfigurationException(ImmutableSet.of(new Message(npe.toString(), npe)));
} } | public class class_name {
static <T> T checkNotNull(T reference, String name) {
if (reference != null) {
return reference; // depends on control dependency: [if], data = [none]
}
NullPointerException npe = new NullPointerException(name);
throw new ConfigurationException(ImmutableSet.of(new Message(npe.toString(), npe)));
} } |
public class class_name {
private synchronized static ServiceFactory createServiceFactory(Class<?> aClass, String configurationFile)
{
String factoryClassName = null;
if(aClass != null)
{
factoryClassName = Config.getProperty(new StringBuilder(ServiceFactory.class.getName()).append(".").append(aClass.getName()).toString());
}
//check to use default
if(factoryClassName == null || factoryClassName.length() == 0)
factoryClassName = Config.getProperty(SERVICE_FACTORY_PROP_NM,DEFAULT_SERVICE_FACTORY);
//Debugger.println(ServiceFactory.class,"factoryClassName="+factoryClassName);
try
{
Class<?> factoryClass =Class.forName(factoryClassName);
if(configurationFile == null || configurationFile.length() == 0)
{
return (ServiceFactory)ClassPath.newInstance(factoryClassName);
}
//Called passing configuration file to constructor
Object[] inputs = { configurationFile };
Class<?> [] parameterTypes = { String.class};
return (ServiceFactory)factoryClass.getConstructor(parameterTypes).newInstance(inputs);
}
catch (SetupException e)
{
throw e;
}
catch (Exception e)
{
throw new SetupException(e.getMessage(),e);
}
} } | public class class_name {
private synchronized static ServiceFactory createServiceFactory(Class<?> aClass, String configurationFile)
{
String factoryClassName = null;
if(aClass != null)
{
factoryClassName = Config.getProperty(new StringBuilder(ServiceFactory.class.getName()).append(".").append(aClass.getName()).toString());
// depends on control dependency: [if], data = [(aClass]
}
//check to use default
if(factoryClassName == null || factoryClassName.length() == 0)
factoryClassName = Config.getProperty(SERVICE_FACTORY_PROP_NM,DEFAULT_SERVICE_FACTORY);
//Debugger.println(ServiceFactory.class,"factoryClassName="+factoryClassName);
try
{
Class<?> factoryClass =Class.forName(factoryClassName);
if(configurationFile == null || configurationFile.length() == 0)
{
return (ServiceFactory)ClassPath.newInstance(factoryClassName);
// depends on control dependency: [if], data = [none]
}
//Called passing configuration file to constructor
Object[] inputs = { configurationFile };
Class<?> [] parameterTypes = { String.class};
return (ServiceFactory)factoryClass.getConstructor(parameterTypes).newInstance(inputs);
// depends on control dependency: [try], data = [none]
}
catch (SetupException e)
{
throw e;
}
// depends on control dependency: [catch], data = [none]
catch (Exception e)
{
throw new SetupException(e.getMessage(),e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Collection<String> buildQueueNames(Response response) {
Collection<String> queueNames = new HashSet<>();
Collection<String> detectionSystemNames = appSensorServer.getConfiguration().getRelatedDetectionSystems(response.getDetectionSystem());
for(String detectionSystemName : detectionSystemNames) {
queueNames.add(RabbitMqUtils.buildResponseQueueName(detectionSystemName));
}
return queueNames;
} } | public class class_name {
private Collection<String> buildQueueNames(Response response) {
Collection<String> queueNames = new HashSet<>();
Collection<String> detectionSystemNames = appSensorServer.getConfiguration().getRelatedDetectionSystems(response.getDetectionSystem());
for(String detectionSystemName : detectionSystemNames) {
queueNames.add(RabbitMqUtils.buildResponseQueueName(detectionSystemName)); // depends on control dependency: [for], data = [detectionSystemName]
}
return queueNames;
} } |
public class class_name {
public static void createZip(String sourcePath, String zipPath) {
FileOutputStream fos = null;
ZipOutputStream zos = null;
try {
fos = new FileOutputStream(zipPath);
zos = new ZipOutputStream(fos);
writeZip(new File(sourcePath), "", zos);
} catch (FileNotFoundException e) {
LOG.error("创建ZIP文件失败",e);
} finally {
try {
if (zos != null) {
zos.close();
}
} catch (IOException e) {
LOG.error("创建ZIP文件失败",e);
}
}
} } | public class class_name {
public static void createZip(String sourcePath, String zipPath) {
FileOutputStream fos = null;
ZipOutputStream zos = null;
try {
fos = new FileOutputStream(zipPath); // depends on control dependency: [try], data = [none]
zos = new ZipOutputStream(fos); // depends on control dependency: [try], data = [none]
writeZip(new File(sourcePath), "", zos); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
LOG.error("创建ZIP文件失败",e);
} finally { // depends on control dependency: [catch], data = [none]
try {
if (zos != null) {
zos.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
LOG.error("创建ZIP文件失败",e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void marshall(AwsSecurityFindingFilters awsSecurityFindingFilters, ProtocolMarshaller protocolMarshaller) {
if (awsSecurityFindingFilters == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(awsSecurityFindingFilters.getProductArn(), PRODUCTARN_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getAwsAccountId(), AWSACCOUNTID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getId(), ID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getGeneratorId(), GENERATORID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getType(), TYPE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getFirstObservedAt(), FIRSTOBSERVEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getLastObservedAt(), LASTOBSERVEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getUpdatedAt(), UPDATEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getSeverityProduct(), SEVERITYPRODUCT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getSeverityNormalized(), SEVERITYNORMALIZED_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getSeverityLabel(), SEVERITYLABEL_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getConfidence(), CONFIDENCE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getCriticality(), CRITICALITY_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getTitle(), TITLE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getRecommendationText(), RECOMMENDATIONTEXT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getSourceUrl(), SOURCEURL_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getProductFields(), PRODUCTFIELDS_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getProductName(), PRODUCTNAME_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getCompanyName(), COMPANYNAME_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getUserDefinedFields(), USERDEFINEDFIELDS_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getMalwareName(), MALWARENAME_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getMalwareType(), MALWARETYPE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getMalwarePath(), MALWAREPATH_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getMalwareState(), MALWARESTATE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDirection(), NETWORKDIRECTION_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkProtocol(), NETWORKPROTOCOL_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourceIpV4(), NETWORKSOURCEIPV4_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourceIpV6(), NETWORKSOURCEIPV6_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourcePort(), NETWORKSOURCEPORT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourceDomain(), NETWORKSOURCEDOMAIN_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourceMac(), NETWORKSOURCEMAC_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDestinationIpV4(), NETWORKDESTINATIONIPV4_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDestinationIpV6(), NETWORKDESTINATIONIPV6_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDestinationPort(), NETWORKDESTINATIONPORT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDestinationDomain(), NETWORKDESTINATIONDOMAIN_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessName(), PROCESSNAME_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessPath(), PROCESSPATH_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessPid(), PROCESSPID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessParentPid(), PROCESSPARENTPID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessLaunchedAt(), PROCESSLAUNCHEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessTerminatedAt(), PROCESSTERMINATEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorType(), THREATINTELINDICATORTYPE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorValue(), THREATINTELINDICATORVALUE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorCategory(), THREATINTELINDICATORCATEGORY_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorLastObservedAt(), THREATINTELINDICATORLASTOBSERVEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorSource(), THREATINTELINDICATORSOURCE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorSourceUrl(), THREATINTELINDICATORSOURCEURL_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceId(), RESOURCEID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourcePartition(), RESOURCEPARTITION_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceRegion(), RESOURCEREGION_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceTags(), RESOURCETAGS_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceType(), RESOURCEAWSEC2INSTANCETYPE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceImageId(), RESOURCEAWSEC2INSTANCEIMAGEID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceIpV4Addresses(), RESOURCEAWSEC2INSTANCEIPV4ADDRESSES_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceIpV6Addresses(), RESOURCEAWSEC2INSTANCEIPV6ADDRESSES_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceKeyName(), RESOURCEAWSEC2INSTANCEKEYNAME_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceIamInstanceProfileArn(),
RESOURCEAWSEC2INSTANCEIAMINSTANCEPROFILEARN_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceVpcId(), RESOURCEAWSEC2INSTANCEVPCID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceSubnetId(), RESOURCEAWSEC2INSTANCESUBNETID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceLaunchedAt(), RESOURCEAWSEC2INSTANCELAUNCHEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsS3BucketOwnerId(), RESOURCEAWSS3BUCKETOWNERID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsS3BucketOwnerName(), RESOURCEAWSS3BUCKETOWNERNAME_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsIamAccessKeyUserName(), RESOURCEAWSIAMACCESSKEYUSERNAME_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsIamAccessKeyStatus(), RESOURCEAWSIAMACCESSKEYSTATUS_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsIamAccessKeyCreatedAt(), RESOURCEAWSIAMACCESSKEYCREATEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceContainerName(), RESOURCECONTAINERNAME_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceContainerImageId(), RESOURCECONTAINERIMAGEID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceContainerImageName(), RESOURCECONTAINERIMAGENAME_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceContainerLaunchedAt(), RESOURCECONTAINERLAUNCHEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceDetailsOther(), RESOURCEDETAILSOTHER_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getComplianceStatus(), COMPLIANCESTATUS_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getVerificationState(), VERIFICATIONSTATE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getWorkflowState(), WORKFLOWSTATE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getRecordState(), RECORDSTATE_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getRelatedFindingsProductArn(), RELATEDFINDINGSPRODUCTARN_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getRelatedFindingsId(), RELATEDFINDINGSID_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNoteText(), NOTETEXT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNoteUpdatedAt(), NOTEUPDATEDAT_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getNoteUpdatedBy(), NOTEUPDATEDBY_BINDING);
protocolMarshaller.marshall(awsSecurityFindingFilters.getKeyword(), KEYWORD_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AwsSecurityFindingFilters awsSecurityFindingFilters, ProtocolMarshaller protocolMarshaller) {
if (awsSecurityFindingFilters == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(awsSecurityFindingFilters.getProductArn(), PRODUCTARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getAwsAccountId(), AWSACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getGeneratorId(), GENERATORID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getFirstObservedAt(), FIRSTOBSERVEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getLastObservedAt(), LASTOBSERVEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getUpdatedAt(), UPDATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getSeverityProduct(), SEVERITYPRODUCT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getSeverityNormalized(), SEVERITYNORMALIZED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getSeverityLabel(), SEVERITYLABEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getConfidence(), CONFIDENCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getCriticality(), CRITICALITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getTitle(), TITLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getRecommendationText(), RECOMMENDATIONTEXT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getSourceUrl(), SOURCEURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getProductFields(), PRODUCTFIELDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getProductName(), PRODUCTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getCompanyName(), COMPANYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getUserDefinedFields(), USERDEFINEDFIELDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getMalwareName(), MALWARENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getMalwareType(), MALWARETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getMalwarePath(), MALWAREPATH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getMalwareState(), MALWARESTATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDirection(), NETWORKDIRECTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkProtocol(), NETWORKPROTOCOL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourceIpV4(), NETWORKSOURCEIPV4_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourceIpV6(), NETWORKSOURCEIPV6_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourcePort(), NETWORKSOURCEPORT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourceDomain(), NETWORKSOURCEDOMAIN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkSourceMac(), NETWORKSOURCEMAC_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDestinationIpV4(), NETWORKDESTINATIONIPV4_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDestinationIpV6(), NETWORKDESTINATIONIPV6_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDestinationPort(), NETWORKDESTINATIONPORT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNetworkDestinationDomain(), NETWORKDESTINATIONDOMAIN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessName(), PROCESSNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessPath(), PROCESSPATH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessPid(), PROCESSPID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessParentPid(), PROCESSPARENTPID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessLaunchedAt(), PROCESSLAUNCHEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getProcessTerminatedAt(), PROCESSTERMINATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorType(), THREATINTELINDICATORTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorValue(), THREATINTELINDICATORVALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorCategory(), THREATINTELINDICATORCATEGORY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorLastObservedAt(), THREATINTELINDICATORLASTOBSERVEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorSource(), THREATINTELINDICATORSOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getThreatIntelIndicatorSourceUrl(), THREATINTELINDICATORSOURCEURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceId(), RESOURCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourcePartition(), RESOURCEPARTITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceRegion(), RESOURCEREGION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceTags(), RESOURCETAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceType(), RESOURCEAWSEC2INSTANCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceImageId(), RESOURCEAWSEC2INSTANCEIMAGEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceIpV4Addresses(), RESOURCEAWSEC2INSTANCEIPV4ADDRESSES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceIpV6Addresses(), RESOURCEAWSEC2INSTANCEIPV6ADDRESSES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceKeyName(), RESOURCEAWSEC2INSTANCEKEYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceIamInstanceProfileArn(),
RESOURCEAWSEC2INSTANCEIAMINSTANCEPROFILEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceVpcId(), RESOURCEAWSEC2INSTANCEVPCID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceSubnetId(), RESOURCEAWSEC2INSTANCESUBNETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsEc2InstanceLaunchedAt(), RESOURCEAWSEC2INSTANCELAUNCHEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsS3BucketOwnerId(), RESOURCEAWSS3BUCKETOWNERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsS3BucketOwnerName(), RESOURCEAWSS3BUCKETOWNERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsIamAccessKeyUserName(), RESOURCEAWSIAMACCESSKEYUSERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsIamAccessKeyStatus(), RESOURCEAWSIAMACCESSKEYSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceAwsIamAccessKeyCreatedAt(), RESOURCEAWSIAMACCESSKEYCREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceContainerName(), RESOURCECONTAINERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceContainerImageId(), RESOURCECONTAINERIMAGEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceContainerImageName(), RESOURCECONTAINERIMAGENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceContainerLaunchedAt(), RESOURCECONTAINERLAUNCHEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getResourceDetailsOther(), RESOURCEDETAILSOTHER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getComplianceStatus(), COMPLIANCESTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getVerificationState(), VERIFICATIONSTATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getWorkflowState(), WORKFLOWSTATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getRecordState(), RECORDSTATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getRelatedFindingsProductArn(), RELATEDFINDINGSPRODUCTARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getRelatedFindingsId(), RELATEDFINDINGSID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNoteText(), NOTETEXT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNoteUpdatedAt(), NOTEUPDATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getNoteUpdatedBy(), NOTEUPDATEDBY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(awsSecurityFindingFilters.getKeyword(), KEYWORD_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static int encode(Weekday... weekdays) {
int bitmask = 0;
for (Weekday weekday : weekdays) {
bitmask = bitmask | (1 << weekday.ordinal());
}
return bitmask;
} } | public class class_name {
private static int encode(Weekday... weekdays) {
int bitmask = 0;
for (Weekday weekday : weekdays) {
bitmask = bitmask | (1 << weekday.ordinal()); // depends on control dependency: [for], data = [weekday]
}
return bitmask;
} } |
public class class_name {
static public <D extends ImageGray<D>>
void nonMaxSuppressionCrude4(GrayF32 intensity , D derivX , D derivY , GrayF32 output )
{
if( derivX instanceof GrayF32) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayF32) derivX, (GrayF32) derivY,output);
} else if( derivX instanceof GrayS16) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS16) derivX, (GrayS16) derivY,output);
} else if( derivX instanceof GrayS32) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS32) derivX, (GrayS32) derivY,output);
} else {
throw new IllegalArgumentException("Unknown input type");
}
} } | public class class_name {
static public <D extends ImageGray<D>>
void nonMaxSuppressionCrude4(GrayF32 intensity , D derivX , D derivY , GrayF32 output )
{
if( derivX instanceof GrayF32) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayF32) derivX, (GrayF32) derivY,output); // depends on control dependency: [if], data = [none]
} else if( derivX instanceof GrayS16) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS16) derivX, (GrayS16) derivY,output); // depends on control dependency: [if], data = [none]
} else if( derivX instanceof GrayS32) {
GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS32) derivX, (GrayS32) derivY,output); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown input type");
}
} } |
public class class_name {
private synchronized void keepAliveSessions(long lastKeepAliveTime, long sessionTimeout) {
// Filter the list of sessions by timeout.
List<RaftSessionState> needKeepAlive = sessions.values()
.stream()
.filter(session -> session.getSessionTimeout() == sessionTimeout)
.collect(Collectors.toList());
// If no sessions need keep-alives to be sent, skip and reschedule the keep-alive.
if (needKeepAlive.isEmpty()) {
return;
}
// Allocate session IDs, command response sequence numbers, and event index arrays.
long[] sessionIds = new long[needKeepAlive.size()];
long[] commandResponses = new long[needKeepAlive.size()];
long[] eventIndexes = new long[needKeepAlive.size()];
// For each session that needs to be kept alive, populate batch request arrays.
int i = 0;
for (RaftSessionState sessionState : needKeepAlive) {
sessionIds[i] = sessionState.getSessionId().id();
commandResponses[i] = sessionState.getCommandResponse();
eventIndexes[i] = sessionState.getEventIndex();
i++;
}
log.trace("Keeping {} sessions alive", sessionIds.length);
KeepAliveRequest request = KeepAliveRequest.builder()
.withSessionIds(sessionIds)
.withCommandSequences(commandResponses)
.withEventIndexes(eventIndexes)
.build();
long keepAliveTime = System.currentTimeMillis();
connection.keepAlive(request).whenComplete((response, error) -> {
if (open.get()) {
long delta = System.currentTimeMillis() - keepAliveTime;
if (error == null) {
// If the request was successful, update the address selector and schedule the next keep-alive.
if (response.status() == RaftResponse.Status.OK) {
selectorManager.resetAll(response.leader(), response.members());
// Iterate through sessions and close sessions that weren't kept alive by the request (have already been closed).
Set<Long> keptAliveSessions = Sets.newHashSet(Longs.asList(response.sessionIds()));
for (RaftSessionState session : needKeepAlive) {
if (keptAliveSessions.contains(session.getSessionId().id())) {
session.setState(PrimitiveState.CONNECTED);
} else {
session.setState(PrimitiveState.EXPIRED);
}
}
scheduleKeepAlive(System.currentTimeMillis(), sessionTimeout, delta);
}
// If the timeout has not been passed, attempt to keep the session alive again with no delay.
// We will continue to retry until the session expiration has passed.
else if (System.currentTimeMillis() - lastKeepAliveTime < sessionTimeout) {
selectorManager.resetAll(null, connection.members());
keepAliveSessions(lastKeepAliveTime, sessionTimeout);
}
// If no leader was set, set the session state to unstable and schedule another keep-alive.
else {
needKeepAlive.forEach(s -> s.setState(PrimitiveState.SUSPENDED));
selectorManager.resetAll();
scheduleKeepAlive(lastKeepAliveTime, sessionTimeout, delta);
}
}
// If the timeout has not been passed, reset the connection and attempt to keep the session alive
// again with no delay.
else if (System.currentTimeMillis() - lastKeepAliveTime < sessionTimeout && connection.leader() != null) {
selectorManager.resetAll(null, connection.members());
keepAliveSessions(lastKeepAliveTime, sessionTimeout);
}
// If no leader was set, set the session state to unstable and schedule another keep-alive.
else {
needKeepAlive.forEach(s -> s.setState(PrimitiveState.SUSPENDED));
selectorManager.resetAll();
scheduleKeepAlive(lastKeepAliveTime, sessionTimeout, delta);
}
}
});
} } | public class class_name {
private synchronized void keepAliveSessions(long lastKeepAliveTime, long sessionTimeout) {
// Filter the list of sessions by timeout.
List<RaftSessionState> needKeepAlive = sessions.values()
.stream()
.filter(session -> session.getSessionTimeout() == sessionTimeout)
.collect(Collectors.toList());
// If no sessions need keep-alives to be sent, skip and reschedule the keep-alive.
if (needKeepAlive.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
// Allocate session IDs, command response sequence numbers, and event index arrays.
long[] sessionIds = new long[needKeepAlive.size()];
long[] commandResponses = new long[needKeepAlive.size()];
long[] eventIndexes = new long[needKeepAlive.size()];
// For each session that needs to be kept alive, populate batch request arrays.
int i = 0;
for (RaftSessionState sessionState : needKeepAlive) {
sessionIds[i] = sessionState.getSessionId().id(); // depends on control dependency: [for], data = [sessionState]
commandResponses[i] = sessionState.getCommandResponse(); // depends on control dependency: [for], data = [sessionState]
eventIndexes[i] = sessionState.getEventIndex(); // depends on control dependency: [for], data = [sessionState]
i++; // depends on control dependency: [for], data = [none]
}
log.trace("Keeping {} sessions alive", sessionIds.length);
KeepAliveRequest request = KeepAliveRequest.builder()
.withSessionIds(sessionIds)
.withCommandSequences(commandResponses)
.withEventIndexes(eventIndexes)
.build();
long keepAliveTime = System.currentTimeMillis();
connection.keepAlive(request).whenComplete((response, error) -> {
if (open.get()) {
long delta = System.currentTimeMillis() - keepAliveTime;
if (error == null) {
// If the request was successful, update the address selector and schedule the next keep-alive.
if (response.status() == RaftResponse.Status.OK) {
selectorManager.resetAll(response.leader(), response.members()); // depends on control dependency: [if], data = [none]
// Iterate through sessions and close sessions that weren't kept alive by the request (have already been closed).
Set<Long> keptAliveSessions = Sets.newHashSet(Longs.asList(response.sessionIds()));
for (RaftSessionState session : needKeepAlive) {
if (keptAliveSessions.contains(session.getSessionId().id())) {
session.setState(PrimitiveState.CONNECTED); // depends on control dependency: [if], data = [none]
} else {
session.setState(PrimitiveState.EXPIRED); // depends on control dependency: [if], data = [none]
}
}
scheduleKeepAlive(System.currentTimeMillis(), sessionTimeout, delta); // depends on control dependency: [if], data = [none]
}
// If the timeout has not been passed, attempt to keep the session alive again with no delay.
// We will continue to retry until the session expiration has passed.
else if (System.currentTimeMillis() - lastKeepAliveTime < sessionTimeout) {
selectorManager.resetAll(null, connection.members()); // depends on control dependency: [if], data = [none]
keepAliveSessions(lastKeepAliveTime, sessionTimeout); // depends on control dependency: [if], data = [sessionTimeout)]
}
// If no leader was set, set the session state to unstable and schedule another keep-alive.
else {
needKeepAlive.forEach(s -> s.setState(PrimitiveState.SUSPENDED)); // depends on control dependency: [if], data = [none]
selectorManager.resetAll(); // depends on control dependency: [if], data = [none]
scheduleKeepAlive(lastKeepAliveTime, sessionTimeout, delta); // depends on control dependency: [if], data = [none]
}
}
// If the timeout has not been passed, reset the connection and attempt to keep the session alive
// again with no delay.
else if (System.currentTimeMillis() - lastKeepAliveTime < sessionTimeout && connection.leader() != null) {
selectorManager.resetAll(null, connection.members()); // depends on control dependency: [if], data = [none]
keepAliveSessions(lastKeepAliveTime, sessionTimeout); // depends on control dependency: [if], data = [none]
}
// If no leader was set, set the session state to unstable and schedule another keep-alive.
else {
needKeepAlive.forEach(s -> s.setState(PrimitiveState.SUSPENDED)); // depends on control dependency: [if], data = [none]
selectorManager.resetAll(); // depends on control dependency: [if], data = [none]
scheduleKeepAlive(lastKeepAliveTime, sessionTimeout, delta); // depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
private Map<String, List<CmsRelation>> getBrokenRelations(List<String> resourceNames, boolean includeSiblings) {
Map<String, List<CmsRelation>> brokenRelations = new HashMap<String, List<CmsRelation>>();
Set<String> resources = new HashSet<String>();
// expand the folders to single resources
String site = m_cms.getRequestContext().getSiteRoot();
String oldSite = site;
try {
m_cms.getRequestContext().setSiteRoot("/");
List<CmsResource> resourceList = new ArrayList<CmsResource>();
Iterator<String> itResourceNames = resourceNames.iterator();
while (itResourceNames.hasNext()) {
// get the root path
String resName = m_cms.getRequestContext().addSiteRoot(site, itResourceNames.next());
try {
CmsResource resource = m_cms.readResource(resName);
resourceList.add(resource);
if (resource.isFolder()) {
resourceList.addAll(m_cms.readResources(resName, CmsResourceFilter.IGNORE_EXPIRATION, true));
}
} catch (CmsException e) {
// should never happen
if (LOG.isDebugEnabled()) {
LOG.debug(e.getLocalizedMessage(), e);
}
}
}
// collect the root paths
Iterator<CmsResource> itResources = resourceList.iterator();
while (itResources.hasNext()) {
CmsResource resource = itResources.next();
resources.add(resource.getRootPath());
}
if (Boolean.valueOf(includeSiblings).booleanValue()) {
// expand the siblings
itResources = new ArrayList<CmsResource>(resourceList).iterator();
while (itResources.hasNext()) {
CmsResource resource = itResources.next();
try {
if (!resource.isFolder() && (resource.getSiblingCount() > 1)) {
Iterator<CmsResource> itSiblings = m_cms.readSiblings(
resource.getRootPath(),
CmsResourceFilter.IGNORE_EXPIRATION).iterator();
while (itSiblings.hasNext()) {
CmsResource sibling = itSiblings.next();
if (!resources.contains(sibling.getRootPath())) {
resources.add(sibling.getRootPath());
resourceList.add(sibling);
}
}
}
} catch (CmsException e) {
// should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
}
// check every resource
itResources = resourceList.iterator();
while (itResources.hasNext()) {
CmsResource resource = itResources.next();
String resourceName = resource.getRootPath();
try {
Iterator<CmsRelation> it = m_cms.getRelationsForResource(
resource,
CmsRelationFilter.SOURCES).iterator();
while (it.hasNext()) {
CmsRelation relation = it.next();
String relationName = relation.getSourcePath();
// add only if the source is not to be deleted too
if (!resources.contains(relationName)) {
List<CmsRelation> broken = brokenRelations.get(resourceName);
if (broken == null) {
broken = new ArrayList<CmsRelation>();
brokenRelations.put(resourceName, broken);
}
broken.add(relation);
}
}
} catch (CmsException e) {
// should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
} finally {
m_cms.getRequestContext().setSiteRoot(oldSite);
}
return brokenRelations;
} } | public class class_name {
private Map<String, List<CmsRelation>> getBrokenRelations(List<String> resourceNames, boolean includeSiblings) {
Map<String, List<CmsRelation>> brokenRelations = new HashMap<String, List<CmsRelation>>();
Set<String> resources = new HashSet<String>();
// expand the folders to single resources
String site = m_cms.getRequestContext().getSiteRoot();
String oldSite = site;
try {
m_cms.getRequestContext().setSiteRoot("/"); // depends on control dependency: [try], data = [none]
List<CmsResource> resourceList = new ArrayList<CmsResource>();
Iterator<String> itResourceNames = resourceNames.iterator();
while (itResourceNames.hasNext()) {
// get the root path
String resName = m_cms.getRequestContext().addSiteRoot(site, itResourceNames.next());
try {
CmsResource resource = m_cms.readResource(resName);
resourceList.add(resource); // depends on control dependency: [try], data = [none]
if (resource.isFolder()) {
resourceList.addAll(m_cms.readResources(resName, CmsResourceFilter.IGNORE_EXPIRATION, true)); // depends on control dependency: [if], data = [none]
}
} catch (CmsException e) {
// should never happen
if (LOG.isDebugEnabled()) {
LOG.debug(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
// collect the root paths
Iterator<CmsResource> itResources = resourceList.iterator();
while (itResources.hasNext()) {
CmsResource resource = itResources.next();
resources.add(resource.getRootPath()); // depends on control dependency: [while], data = [none]
}
if (Boolean.valueOf(includeSiblings).booleanValue()) {
// expand the siblings
itResources = new ArrayList<CmsResource>(resourceList).iterator(); // depends on control dependency: [if], data = [none]
while (itResources.hasNext()) {
CmsResource resource = itResources.next();
try {
if (!resource.isFolder() && (resource.getSiblingCount() > 1)) {
Iterator<CmsResource> itSiblings = m_cms.readSiblings(
resource.getRootPath(),
CmsResourceFilter.IGNORE_EXPIRATION).iterator();
while (itSiblings.hasNext()) {
CmsResource sibling = itSiblings.next();
if (!resources.contains(sibling.getRootPath())) {
resources.add(sibling.getRootPath()); // depends on control dependency: [if], data = [none]
resourceList.add(sibling); // depends on control dependency: [if], data = [none]
}
}
}
} catch (CmsException e) {
// should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
// check every resource
itResources = resourceList.iterator(); // depends on control dependency: [try], data = [none]
while (itResources.hasNext()) {
CmsResource resource = itResources.next();
String resourceName = resource.getRootPath();
try {
Iterator<CmsRelation> it = m_cms.getRelationsForResource(
resource,
CmsRelationFilter.SOURCES).iterator();
while (it.hasNext()) {
CmsRelation relation = it.next();
String relationName = relation.getSourcePath();
// add only if the source is not to be deleted too
if (!resources.contains(relationName)) {
List<CmsRelation> broken = brokenRelations.get(resourceName);
if (broken == null) {
broken = new ArrayList<CmsRelation>(); // depends on control dependency: [if], data = [none]
brokenRelations.put(resourceName, broken); // depends on control dependency: [if], data = [none]
}
broken.add(relation); // depends on control dependency: [if], data = [none]
}
}
} catch (CmsException e) {
// should never happen
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
} finally {
m_cms.getRequestContext().setSiteRoot(oldSite);
}
return brokenRelations;
} } |
public class class_name {
static <I extends Request, O extends Response>
Router<CompositeServiceEntry<I, O>> wrapCompositeServiceRouter(
Router<CompositeServiceEntry<I, O>> delegate) {
final Cache<PathMappingContext, CompositeServiceEntry<I, O>> cache =
Flags.compositeServiceCacheSpec().map(RouteCache::<CompositeServiceEntry<I, O>>buildCache)
.orElse(null);
if (cache == null) {
return delegate;
}
return new CachingRouter<>(delegate, cache, CompositeServiceEntry::pathMapping);
} } | public class class_name {
static <I extends Request, O extends Response>
Router<CompositeServiceEntry<I, O>> wrapCompositeServiceRouter(
Router<CompositeServiceEntry<I, O>> delegate) {
final Cache<PathMappingContext, CompositeServiceEntry<I, O>> cache =
Flags.compositeServiceCacheSpec().map(RouteCache::<CompositeServiceEntry<I, O>>buildCache)
.orElse(null);
if (cache == null) {
return delegate; // depends on control dependency: [if], data = [none]
}
return new CachingRouter<>(delegate, cache, CompositeServiceEntry::pathMapping);
} } |
public class class_name {
public static double spacheScore(String strText) {
//http://simple.wikipedia.org/wiki/Spache_Readability_Formula
strText = cleanText(strText);
int intUniqueUnfamiliarWordCount = 0;
Set<String> arrWords = new HashSet<>((new WhitespaceTokenizer()).tokenize(strText));
for(String word : arrWords) {
if (!SPACHE_WORDLIST.contains(word)) {
++intUniqueUnfamiliarWordCount;
}
}
int intSentenceCount=sentenceCount(strText);
int intWordCount = wordCount(strText);
return 0.121*intWordCount/(double)intSentenceCount+0.082*intUniqueUnfamiliarWordCount+0.659;
} } | public class class_name {
public static double spacheScore(String strText) {
//http://simple.wikipedia.org/wiki/Spache_Readability_Formula
strText = cleanText(strText);
int intUniqueUnfamiliarWordCount = 0;
Set<String> arrWords = new HashSet<>((new WhitespaceTokenizer()).tokenize(strText));
for(String word : arrWords) {
if (!SPACHE_WORDLIST.contains(word)) {
++intUniqueUnfamiliarWordCount; // depends on control dependency: [if], data = [none]
}
}
int intSentenceCount=sentenceCount(strText);
int intWordCount = wordCount(strText);
return 0.121*intWordCount/(double)intSentenceCount+0.082*intUniqueUnfamiliarWordCount+0.659;
} } |
public class class_name {
private ObjectType findMethodOwner(Node n) {
if (n == null) {
return null;
}
Node parent = n.getParent();
FunctionType ctor = null;
if (parent.isAssign()) {
Node target = parent.getFirstChild();
if (NodeUtil.isPrototypeProperty(target)) {
// TODO(johnlenz): handle non-global types
JSType type = registry.getGlobalType(target.getFirstFirstChild().getQualifiedName());
ctor = type != null ? ((ObjectType) type).getConstructor() : null;
}
} else if (parent.isClass()) {
// TODO(sdh): test this case once the type checker understands ES6 classes
ctor = parent.getJSType().toMaybeFunctionType();
}
return ctor != null ? ctor.getInstanceType() : null;
} } | public class class_name {
private ObjectType findMethodOwner(Node n) {
if (n == null) {
return null; // depends on control dependency: [if], data = [none]
}
Node parent = n.getParent();
FunctionType ctor = null;
if (parent.isAssign()) {
Node target = parent.getFirstChild();
if (NodeUtil.isPrototypeProperty(target)) {
// TODO(johnlenz): handle non-global types
JSType type = registry.getGlobalType(target.getFirstFirstChild().getQualifiedName());
ctor = type != null ? ((ObjectType) type).getConstructor() : null; // depends on control dependency: [if], data = [none]
}
} else if (parent.isClass()) {
// TODO(sdh): test this case once the type checker understands ES6 classes
ctor = parent.getJSType().toMaybeFunctionType(); // depends on control dependency: [if], data = [none]
}
return ctor != null ? ctor.getInstanceType() : null;
} } |
public class class_name {
public void marshall(TransformInput transformInput, ProtocolMarshaller protocolMarshaller) {
if (transformInput == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(transformInput.getDataSource(), DATASOURCE_BINDING);
protocolMarshaller.marshall(transformInput.getContentType(), CONTENTTYPE_BINDING);
protocolMarshaller.marshall(transformInput.getCompressionType(), COMPRESSIONTYPE_BINDING);
protocolMarshaller.marshall(transformInput.getSplitType(), SPLITTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TransformInput transformInput, ProtocolMarshaller protocolMarshaller) {
if (transformInput == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(transformInput.getDataSource(), DATASOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transformInput.getContentType(), CONTENTTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transformInput.getCompressionType(), COMPRESSIONTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transformInput.getSplitType(), SPLITTYPE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int compareTo(final boolean caseSensitive, final CharSequence text1, final CharSequence text2) {
if (text1 == null) {
throw new IllegalArgumentException("First text being compared cannot be null");
}
if (text2 == null) {
throw new IllegalArgumentException("Second text being compared cannot be null");
}
if (text1 instanceof String && text2 instanceof String) {
return (caseSensitive ? ((String)text1).compareTo((String)text2) : ((String)text1).compareToIgnoreCase((String)text2));
}
return compareTo(caseSensitive, text1, 0, text1.length(), text2, 0, text2.length());
} } | public class class_name {
public static int compareTo(final boolean caseSensitive, final CharSequence text1, final CharSequence text2) {
if (text1 == null) {
throw new IllegalArgumentException("First text being compared cannot be null");
}
if (text2 == null) {
throw new IllegalArgumentException("Second text being compared cannot be null");
}
if (text1 instanceof String && text2 instanceof String) {
return (caseSensitive ? ((String)text1).compareTo((String)text2) : ((String)text1).compareToIgnoreCase((String)text2)); // depends on control dependency: [if], data = [none]
}
return compareTo(caseSensitive, text1, 0, text1.length(), text2, 0, text2.length());
} } |
public class class_name {
public TableCellStyle addChildCellStyle(final TableCellStyle style, final DataStyle dataStyle) {
final ChildCellStyle childKey = new ChildCellStyle(style, dataStyle);
TableCellStyle anonymousStyle = this.anonymousStyleByChildCellStyle.get(childKey);
if (anonymousStyle == null) {
this.addDataStyle(dataStyle);
if (!style.hasParent()) { // here, the style may already be a child style
this.addContentFontFaceContainerStyle(style);
}
final String name = style.getRealName() + "-_-" + dataStyle.getName();
final TableCellStyleBuilder anonymousStyleBuilder = TableCellStyle.builder(name)
.parentCellStyle(style).dataStyle(dataStyle);
if (dataStyle.isHidden()) {
anonymousStyleBuilder.hidden();
}
anonymousStyle = anonymousStyleBuilder.build();
this.addContentFontFaceContainerStyle(anonymousStyle);
this.anonymousStyleByChildCellStyle.put(childKey, anonymousStyle);
}
return anonymousStyle;
} } | public class class_name {
public TableCellStyle addChildCellStyle(final TableCellStyle style, final DataStyle dataStyle) {
final ChildCellStyle childKey = new ChildCellStyle(style, dataStyle);
TableCellStyle anonymousStyle = this.anonymousStyleByChildCellStyle.get(childKey);
if (anonymousStyle == null) {
this.addDataStyle(dataStyle); // depends on control dependency: [if], data = [none]
if (!style.hasParent()) { // here, the style may already be a child style
this.addContentFontFaceContainerStyle(style); // depends on control dependency: [if], data = [none]
}
final String name = style.getRealName() + "-_-" + dataStyle.getName();
final TableCellStyleBuilder anonymousStyleBuilder = TableCellStyle.builder(name)
.parentCellStyle(style).dataStyle(dataStyle);
if (dataStyle.isHidden()) {
anonymousStyleBuilder.hidden(); // depends on control dependency: [if], data = [none]
}
anonymousStyle = anonymousStyleBuilder.build(); // depends on control dependency: [if], data = [none]
this.addContentFontFaceContainerStyle(anonymousStyle); // depends on control dependency: [if], data = [(anonymousStyle]
this.anonymousStyleByChildCellStyle.put(childKey, anonymousStyle); // depends on control dependency: [if], data = [none]
}
return anonymousStyle;
} } |
public class class_name {
private void preparePrint(final AbstractPrint _print) throws EFapsException {
for (final Select select : _print.getSelection().getAllSelects()) {
for (final AbstractElement<?> element : select.getElements()) {
if (element instanceof AbstractDataElement) {
((AbstractDataElement<?>) element).append2SQLSelect(sqlSelect);
}
}
}
if (sqlSelect.getColumns().size() > 0) {
for (final Select select : _print.getSelection().getAllSelects()) {
for (final AbstractElement<?> element : select.getElements()) {
if (element instanceof AbstractDataElement) {
((AbstractDataElement<?>) element).append2SQLWhere(sqlSelect.getWhere());
}
}
}
if (_print instanceof ObjectPrint) {
addWhere4ObjectPrint((ObjectPrint) _print);
} else if (_print instanceof ListPrint) {
addWhere4ListPrint((ListPrint) _print);
} else {
addTypeCriteria((QueryPrint) _print);
addWhere4QueryPrint((QueryPrint) _print);
}
addCompanyCriteria(_print);
}
} } | public class class_name {
private void preparePrint(final AbstractPrint _print) throws EFapsException {
for (final Select select : _print.getSelection().getAllSelects()) {
for (final AbstractElement<?> element : select.getElements()) {
if (element instanceof AbstractDataElement) {
((AbstractDataElement<?>) element).append2SQLSelect(sqlSelect); // depends on control dependency: [if], data = [none]
}
}
}
if (sqlSelect.getColumns().size() > 0) {
for (final Select select : _print.getSelection().getAllSelects()) {
for (final AbstractElement<?> element : select.getElements()) {
if (element instanceof AbstractDataElement) {
((AbstractDataElement<?>) element).append2SQLWhere(sqlSelect.getWhere());
}
}
}
if (_print instanceof ObjectPrint) {
addWhere4ObjectPrint((ObjectPrint) _print);
} else if (_print instanceof ListPrint) {
addWhere4ListPrint((ListPrint) _print);
} else {
addTypeCriteria((QueryPrint) _print);
addWhere4QueryPrint((QueryPrint) _print);
}
addCompanyCriteria(_print);
}
} } |
public class class_name {
static Drawable maybeWrapWithRoundedOverlayColor(
@Nullable Drawable drawable,
@Nullable RoundingParams roundingParams) {
try {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("WrappingUtils#maybeWrapWithRoundedOverlayColor");
}
if (drawable == null
|| roundingParams == null
|| roundingParams.getRoundingMethod() != RoundingParams.RoundingMethod.OVERLAY_COLOR) {
return drawable;
}
RoundedCornersDrawable roundedCornersDrawable = new RoundedCornersDrawable(drawable);
applyRoundingParams(roundedCornersDrawable, roundingParams);
roundedCornersDrawable.setOverlayColor(roundingParams.getOverlayColor());
return roundedCornersDrawable;
} finally {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
}
} } | public class class_name {
static Drawable maybeWrapWithRoundedOverlayColor(
@Nullable Drawable drawable,
@Nullable RoundingParams roundingParams) {
try {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("WrappingUtils#maybeWrapWithRoundedOverlayColor"); // depends on control dependency: [if], data = [none]
}
if (drawable == null
|| roundingParams == null
|| roundingParams.getRoundingMethod() != RoundingParams.RoundingMethod.OVERLAY_COLOR) {
return drawable; // depends on control dependency: [if], data = [none]
}
RoundedCornersDrawable roundedCornersDrawable = new RoundedCornersDrawable(drawable);
applyRoundingParams(roundedCornersDrawable, roundingParams); // depends on control dependency: [try], data = [none]
roundedCornersDrawable.setOverlayColor(roundingParams.getOverlayColor()); // depends on control dependency: [try], data = [none]
return roundedCornersDrawable; // depends on control dependency: [try], data = [none]
} finally {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public AudioWife init(Context ctx, Uri uri) {
if (uri == null) {
throw new IllegalArgumentException("Uri cannot be null");
}
if (mAudioWife == null) {
mAudioWife = new AudioWife();
}
mUri = uri;
mProgressUpdateHandler = new Handler();
initPlayer(ctx);
return this;
} } | public class class_name {
public AudioWife init(Context ctx, Uri uri) {
if (uri == null) {
throw new IllegalArgumentException("Uri cannot be null");
}
if (mAudioWife == null) {
mAudioWife = new AudioWife(); // depends on control dependency: [if], data = [none]
}
mUri = uri;
mProgressUpdateHandler = new Handler();
initPlayer(ctx);
return this;
} } |
public class class_name {
public void setVerificationState(java.util.Collection<StringFilter> verificationState) {
if (verificationState == null) {
this.verificationState = null;
return;
}
this.verificationState = new java.util.ArrayList<StringFilter>(verificationState);
} } | public class class_name {
public void setVerificationState(java.util.Collection<StringFilter> verificationState) {
if (verificationState == null) {
this.verificationState = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.verificationState = new java.util.ArrayList<StringFilter>(verificationState);
} } |
public class class_name {
public EEnum getCDDYocBase() {
if (cddYocBaseEEnum == null) {
cddYocBaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(9);
}
return cddYocBaseEEnum;
} } | public class class_name {
public EEnum getCDDYocBase() {
if (cddYocBaseEEnum == null) {
cddYocBaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(9); // depends on control dependency: [if], data = [none]
}
return cddYocBaseEEnum;
} } |
public class class_name {
public static STextualDS getTextualDSForNode(SNode node, SDocumentGraph graph)
{
if (node != null)
{
List<DataSourceSequence> dataSources = graph.getOverlappedDataSourceSequence(
node,
SALT_TYPE.STEXT_OVERLAPPING_RELATION);
if (dataSources != null)
{
for (DataSourceSequence seq : dataSources)
{
if (seq.getDataSource() instanceof STextualDS)
{
return (STextualDS) seq.getDataSource();
}
}
}
}
return null;
} } | public class class_name {
public static STextualDS getTextualDSForNode(SNode node, SDocumentGraph graph)
{
if (node != null)
{
List<DataSourceSequence> dataSources = graph.getOverlappedDataSourceSequence(
node,
SALT_TYPE.STEXT_OVERLAPPING_RELATION);
if (dataSources != null)
{
for (DataSourceSequence seq : dataSources)
{
if (seq.getDataSource() instanceof STextualDS)
{
return (STextualDS) seq.getDataSource(); // depends on control dependency: [if], data = [none]
}
}
}
}
return null;
} } |
public class class_name {
public HttpExecutor getHttpExecutor(BodyType bodyType) {
if (httpClient == null) {
synchronized (HttpExecutorFactory.class) {
if (httpClient == null) {
httpClient = HttpClients.createDefault();
}
}
}
return getHttpExecutor(bodyType, httpClient);
} } | public class class_name {
public HttpExecutor getHttpExecutor(BodyType bodyType) {
if (httpClient == null) {
synchronized (HttpExecutorFactory.class) { // depends on control dependency: [if], data = [none]
if (httpClient == null) {
httpClient = HttpClients.createDefault(); // depends on control dependency: [if], data = [none]
}
}
}
return getHttpExecutor(bodyType, httpClient);
} } |
public class class_name {
public void trackers(List<String> value) {
string_vector v = new string_vector();
for (String s : value) {
v.push_back(s);
}
p.set_trackers(v);
} } | public class class_name {
public void trackers(List<String> value) {
string_vector v = new string_vector();
for (String s : value) {
v.push_back(s); // depends on control dependency: [for], data = [s]
}
p.set_trackers(v);
} } |
public class class_name {
public MetadataBuilder addExecuteAfter(Class<? extends RuleProvider> type)
{
if (type != null)
{
executeAfter.add(type);
}
return this;
} } | public class class_name {
public MetadataBuilder addExecuteAfter(Class<? extends RuleProvider> type)
{
if (type != null)
{
executeAfter.add(type); // depends on control dependency: [if], data = [(type]
}
return this;
} } |
public class class_name {
protected BundleHashcodeType isValidBundle(String requestedPath) {
BundleHashcodeType bundleHashcodeType = BundleHashcodeType.VALID_HASHCODE;
if (!jawrConfig.isDebugModeOn()) {
bundleHashcodeType = bundlesHandler.getBundleHashcodeType(requestedPath);
}
return bundleHashcodeType;
} } | public class class_name {
protected BundleHashcodeType isValidBundle(String requestedPath) {
BundleHashcodeType bundleHashcodeType = BundleHashcodeType.VALID_HASHCODE;
if (!jawrConfig.isDebugModeOn()) {
bundleHashcodeType = bundlesHandler.getBundleHashcodeType(requestedPath); // depends on control dependency: [if], data = [none]
}
return bundleHashcodeType;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.