code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static void replaceInZip(File zip, String file, String data, String encoding) throws IOException {
// open the output side
File zipOutFile = File.createTempFile("ZipReplace", ".zip");
try {
FileOutputStream fos = new FileOutputStream(zipOutFile);
try (ZipOutputStream zos = new ZipOutputStream(fos)) {
// open the input side
try (ZipFile zipFile = new ZipFile(zip)) {
boolean found = false;
// walk all entries and copy them into the new file
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
try {
if (entry.getName().equals(file)) {
zos.putNextEntry(new ZipEntry(entry.getName()));
IOUtils.write(data, zos, encoding);
found = true;
} else {
zos.putNextEntry(entry);
IOUtils.copy(zipFile.getInputStream(entry), zos);
}
} finally {
zos.closeEntry();
}
}
if(!found) {
zos.putNextEntry(new ZipEntry(file));
try {
IOUtils.write(data, zos, "UTF-8");
} finally {
zos.closeEntry();
}
}
}
}
// copy over the data
FileUtils.copyFile(zipOutFile, zip);
} finally {
if(!zipOutFile.delete()) {
//noinspection ThrowFromFinallyBlock
throw new IOException("Error deleting file: " + zipOutFile);
}
}
} }
|
public class class_name {
public static void replaceInZip(File zip, String file, String data, String encoding) throws IOException {
// open the output side
File zipOutFile = File.createTempFile("ZipReplace", ".zip");
try {
FileOutputStream fos = new FileOutputStream(zipOutFile);
try (ZipOutputStream zos = new ZipOutputStream(fos)) {
// open the input side
try (ZipFile zipFile = new ZipFile(zip)) {
boolean found = false;
// walk all entries and copy them into the new file
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
try {
if (entry.getName().equals(file)) {
zos.putNextEntry(new ZipEntry(entry.getName())); // depends on control dependency: [if], data = [none]
IOUtils.write(data, zos, encoding); // depends on control dependency: [if], data = [none]
found = true; // depends on control dependency: [if], data = [none]
} else {
zos.putNextEntry(entry); // depends on control dependency: [if], data = [none]
IOUtils.copy(zipFile.getInputStream(entry), zos); // depends on control dependency: [if], data = [none]
}
} finally {
zos.closeEntry();
}
}
if(!found) {
zos.putNextEntry(new ZipEntry(file)); // depends on control dependency: [if], data = [none]
try {
IOUtils.write(data, zos, "UTF-8"); // depends on control dependency: [try], data = [none]
} finally {
zos.closeEntry();
}
}
}
}
// copy over the data
FileUtils.copyFile(zipOutFile, zip);
} finally {
if(!zipOutFile.delete()) {
//noinspection ThrowFromFinallyBlock
throw new IOException("Error deleting file: " + zipOutFile);
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public void deassociate(HttpServletRequest context) {
Map<Descriptor<?>, Object> components
= (Map<Descriptor<?>, Object>) context.getAttribute(COMPONENTS);
for (Object component : components.values()) {
try {
Event.of(Passivated.class).on(component).fire();
} catch (Exception e) {}
}
context.removeAttribute(COMPONENTS);
for (Object component : components.values()) {
try {
Event.of(Destroyed.class).on(component).fire();
} catch (Exception e) {}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public void deassociate(HttpServletRequest context) {
Map<Descriptor<?>, Object> components
= (Map<Descriptor<?>, Object>) context.getAttribute(COMPONENTS);
for (Object component : components.values()) {
try {
Event.of(Passivated.class).on(component).fire(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
}
context.removeAttribute(COMPONENTS);
for (Object component : components.values()) {
try {
Event.of(Destroyed.class).on(component).fire(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static TransactionImpl[] getAllTransactions()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getAllTransactions");
final Collection<TransactionImpl> txns = localTIDMap.values();
if (txns != null)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "getAllTransactions", txns);
return txns.toArray(noTxns);
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getAllTransactions", noTxns);
return noTxns;
} }
|
public class class_name {
public static TransactionImpl[] getAllTransactions()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getAllTransactions");
final Collection<TransactionImpl> txns = localTIDMap.values();
if (txns != null)
{
if (tc.isEntryEnabled()) Tr.exit(tc, "getAllTransactions", txns);
return txns.toArray(noTxns); // depends on control dependency: [if], data = [none]
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getAllTransactions", noTxns);
return noTxns;
} }
|
public class class_name {
public void complete() {
this.endDate = new Date();
if (reports.stream().allMatch(report -> report.isSuccessful() == true)) {
this.successful = true;
}
} }
|
public class class_name {
public void complete() {
this.endDate = new Date();
if (reports.stream().allMatch(report -> report.isSuccessful() == true)) {
this.successful = true; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void clear() {
if (staticResourceHandlers != null) {
staticResourceHandlers.clear();
staticResourceHandlers = null;
}
staticResourcesSet = false;
externalStaticResourcesSet = false;
} }
|
public class class_name {
public void clear() {
if (staticResourceHandlers != null) {
staticResourceHandlers.clear(); // depends on control dependency: [if], data = [none]
staticResourceHandlers = null; // depends on control dependency: [if], data = [none]
}
staticResourcesSet = false;
externalStaticResourcesSet = false;
} }
|
public class class_name {
@Override
public synchronized void refresh() {
IntervalProperty[] properties = getProperties();
for(IntervalProperty p : properties ) {
p.refresh();
}
} }
|
public class class_name {
@Override
public synchronized void refresh() {
IntervalProperty[] properties = getProperties();
for(IntervalProperty p : properties ) {
p.refresh(); // depends on control dependency: [for], data = [p]
}
} }
|
public class class_name {
protected void computeBarycentricCoordinates(FastQueue<Point3D_F64> controlWorldPts,
DMatrixRMaj alphas,
List<Point3D_F64> worldPts )
{
alphas.reshape(worldPts.size(),numControl,false);
v_temp.reshape(3,1);
A_temp.reshape(3, numControl - 1);
for( int i = 0; i < numControl-1; i++ ) {
Point3D_F64 c = controlWorldPts.get(i);
A_temp.set(0, i, c.x - meanWorldPts.x);
A_temp.set(1, i, c.y - meanWorldPts.y);
A_temp.set(2, i, c.z - meanWorldPts.z);
}
// invert the matrix
solverPinv.setA(A_temp);
A_temp.reshape(A_temp.numCols, A_temp.numRows);
solverPinv.invert(A_temp);
w_temp.reshape(numControl - 1, 1);
for( int i = 0; i < worldPts.size(); i++ ) {
Point3D_F64 p = worldPts.get(i);
v_temp.data[0] = p.x- meanWorldPts.x;
v_temp.data[1] = p.y- meanWorldPts.y;
v_temp.data[2] = p.z- meanWorldPts.z;
MatrixVectorMult_DDRM.mult(A_temp, v_temp, w_temp);
int rowIndex = alphas.numCols*i;
for( int j = 0; j < numControl-1; j++ )
alphas.data[rowIndex++] = w_temp.data[j];
if( numControl == 4 )
alphas.data[rowIndex] = 1 - w_temp.data[0] - w_temp.data[1] - w_temp.data[2];
else
alphas.data[rowIndex] = 1 - w_temp.data[0] - w_temp.data[1];
}
} }
|
public class class_name {
protected void computeBarycentricCoordinates(FastQueue<Point3D_F64> controlWorldPts,
DMatrixRMaj alphas,
List<Point3D_F64> worldPts )
{
alphas.reshape(worldPts.size(),numControl,false);
v_temp.reshape(3,1);
A_temp.reshape(3, numControl - 1);
for( int i = 0; i < numControl-1; i++ ) {
Point3D_F64 c = controlWorldPts.get(i);
A_temp.set(0, i, c.x - meanWorldPts.x); // depends on control dependency: [for], data = [i]
A_temp.set(1, i, c.y - meanWorldPts.y); // depends on control dependency: [for], data = [i]
A_temp.set(2, i, c.z - meanWorldPts.z); // depends on control dependency: [for], data = [i]
}
// invert the matrix
solverPinv.setA(A_temp);
A_temp.reshape(A_temp.numCols, A_temp.numRows);
solverPinv.invert(A_temp);
w_temp.reshape(numControl - 1, 1);
for( int i = 0; i < worldPts.size(); i++ ) {
Point3D_F64 p = worldPts.get(i);
v_temp.data[0] = p.x- meanWorldPts.x; // depends on control dependency: [for], data = [none]
v_temp.data[1] = p.y- meanWorldPts.y; // depends on control dependency: [for], data = [none]
v_temp.data[2] = p.z- meanWorldPts.z; // depends on control dependency: [for], data = [none]
MatrixVectorMult_DDRM.mult(A_temp, v_temp, w_temp); // depends on control dependency: [for], data = [none]
int rowIndex = alphas.numCols*i;
for( int j = 0; j < numControl-1; j++ )
alphas.data[rowIndex++] = w_temp.data[j];
if( numControl == 4 )
alphas.data[rowIndex] = 1 - w_temp.data[0] - w_temp.data[1] - w_temp.data[2];
else
alphas.data[rowIndex] = 1 - w_temp.data[0] - w_temp.data[1];
}
} }
|
public class class_name {
@Override
public void visit(NodeVisitor v) {
if (v.visit(this)) {
target.visit(v);
if (initializer != null) {
initializer.visit(v);
}
}
} }
|
public class class_name {
@Override
public void visit(NodeVisitor v) {
if (v.visit(this)) {
target.visit(v); // depends on control dependency: [if], data = [none]
if (initializer != null) {
initializer.visit(v); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static double diagProd( DMatrix1Row T )
{
double prod = 1.0;
int N = Math.min(T.numRows,T.numCols);
for( int i = 0; i < N; i++ ) {
prod *= T.unsafe_get(i,i);
}
return prod;
} }
|
public class class_name {
public static double diagProd( DMatrix1Row T )
{
double prod = 1.0;
int N = Math.min(T.numRows,T.numCols);
for( int i = 0; i < N; i++ ) {
prod *= T.unsafe_get(i,i); // depends on control dependency: [for], data = [i]
}
return prod;
} }
|
public class class_name {
public static CommandLine forAssist(String rawCommandLine) {
final List<String> splitCommandLine = splitCommandLine(rawCommandLine);
// If the commandLine ends with a space (or is empty), we manually insert an empty arg.
// This implies that the user wanted assistance about the NEXT argument and not the last one that was typed.
if (rawCommandLine.isEmpty() || rawCommandLine.endsWith(" ")) {
splitCommandLine.add("");
}
return new CommandLine(splitCommandLine);
} }
|
public class class_name {
public static CommandLine forAssist(String rawCommandLine) {
final List<String> splitCommandLine = splitCommandLine(rawCommandLine);
// If the commandLine ends with a space (or is empty), we manually insert an empty arg.
// This implies that the user wanted assistance about the NEXT argument and not the last one that was typed.
if (rawCommandLine.isEmpty() || rawCommandLine.endsWith(" ")) {
splitCommandLine.add(""); // depends on control dependency: [if], data = [none]
}
return new CommandLine(splitCommandLine);
} }
|
public class class_name {
public Observable<ComapiResult<MessageSentResponse>> sendMessage(@NonNull final String conversationId, @NonNull final MessageToSend message) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueSendMessage(conversationId, message);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doSendMessage(token, conversationId, message);
}
} }
|
public class class_name {
public Observable<ComapiResult<MessageSentResponse>> sendMessage(@NonNull final String conversationId, @NonNull final MessageToSend message) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueSendMessage(conversationId, message); // depends on control dependency: [if], data = [none]
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription()); // depends on control dependency: [if], data = [none]
} else {
return doSendMessage(token, conversationId, message); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void handleRequest(final Request request) {
if (!isInitialised()) {
getOrCreateComponentModel().delegate = new SafetyContainerDelegate(UIContextHolder.
getCurrent());
setInitialised(true);
}
try {
UIContext delegate = getComponentModel().delegate;
UIContextHolder.pushContext(delegate);
try {
for (int i = 0; i < shim.getChildCount(); i++) {
shim.getChildAt(i).serviceRequest(request);
}
delegate.doInvokeLaters();
} finally {
UIContextHolder.popContext();
}
} catch (final ActionEscape e) {
// We don't want to catch ActionEscapes (e.g. ForwardExceptions)
throw e;
} catch (final Exception e) {
if (isAjaxOrTargetedRequest(request)) {
throw new SystemException(e.getMessage(), e);
} else {
setAttribute(ERROR_KEY, e);
}
}
} }
|
public class class_name {
@Override
public void handleRequest(final Request request) {
if (!isInitialised()) {
getOrCreateComponentModel().delegate = new SafetyContainerDelegate(UIContextHolder.
getCurrent()); // depends on control dependency: [if], data = [none]
setInitialised(true); // depends on control dependency: [if], data = [none]
}
try {
UIContext delegate = getComponentModel().delegate;
UIContextHolder.pushContext(delegate); // depends on control dependency: [try], data = [none]
try {
for (int i = 0; i < shim.getChildCount(); i++) {
shim.getChildAt(i).serviceRequest(request); // depends on control dependency: [for], data = [i]
}
delegate.doInvokeLaters(); // depends on control dependency: [try], data = [none]
} finally {
UIContextHolder.popContext();
}
} catch (final ActionEscape e) {
// We don't want to catch ActionEscapes (e.g. ForwardExceptions)
throw e;
} catch (final Exception e) { // depends on control dependency: [catch], data = [none]
if (isAjaxOrTargetedRequest(request)) {
throw new SystemException(e.getMessage(), e);
} else {
setAttribute(ERROR_KEY, e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public boolean cancel(T task) {
CancellableTask<K, T> cancellableTask = this.cancellableTaskMap.getIfPresent(task.getKey());
if (cancellableTask != null && cancellableTask.getScheduledTask() == task && cancellableTask.cancel()) {
this.cancellableTaskMap.invalidate(task.getKey());
return true;
}
return false;
} }
|
public class class_name {
public boolean cancel(T task) {
CancellableTask<K, T> cancellableTask = this.cancellableTaskMap.getIfPresent(task.getKey());
if (cancellableTask != null && cancellableTask.getScheduledTask() == task && cancellableTask.cancel()) {
this.cancellableTaskMap.invalidate(task.getKey()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public void setLocales(List<Locale> locales) {
m_textSearchFields = new ArrayList<String>();
if ((locales == null) || locales.isEmpty()) {
m_textSearchFields.add(CmsSearchField.FIELD_TEXT);
if (getFilterQueries() != null) {
for (String fq : getFilterQueries()) {
if (fq.startsWith(CmsSearchField.FIELD_CONTENT_LOCALES + ":")) {
removeFilterQuery(fq);
}
}
}
} else {
List<String> localeStrings = new ArrayList<String>();
for (Locale locale : locales) {
localeStrings.add(locale.toString());
if (!m_textSearchFields.contains("text")
&& !OpenCms.getLocaleManager().getAvailableLocales().contains(locale)) {
// if the locale is not configured in the opencms-system.xml
// there will no localized text fields, so take the general one
m_textSearchFields.add("text");
} else {
m_textSearchFields.add("text_" + locale);
}
}
addFilterQuery(CmsSearchField.FIELD_CONTENT_LOCALES, localeStrings, false, false);
}
if (m_text != null) {
setText(m_text);
}
} }
|
public class class_name {
public void setLocales(List<Locale> locales) {
m_textSearchFields = new ArrayList<String>();
if ((locales == null) || locales.isEmpty()) {
m_textSearchFields.add(CmsSearchField.FIELD_TEXT); // depends on control dependency: [if], data = [none]
if (getFilterQueries() != null) {
for (String fq : getFilterQueries()) {
if (fq.startsWith(CmsSearchField.FIELD_CONTENT_LOCALES + ":")) {
removeFilterQuery(fq); // depends on control dependency: [if], data = [none]
}
}
}
} else {
List<String> localeStrings = new ArrayList<String>();
for (Locale locale : locales) {
localeStrings.add(locale.toString()); // depends on control dependency: [for], data = [locale]
if (!m_textSearchFields.contains("text")
&& !OpenCms.getLocaleManager().getAvailableLocales().contains(locale)) {
// if the locale is not configured in the opencms-system.xml
// there will no localized text fields, so take the general one
m_textSearchFields.add("text"); // depends on control dependency: [if], data = [none]
} else {
m_textSearchFields.add("text_" + locale); // depends on control dependency: [if], data = [none]
}
}
addFilterQuery(CmsSearchField.FIELD_CONTENT_LOCALES, localeStrings, false, false); // depends on control dependency: [if], data = [none]
}
if (m_text != null) {
setText(m_text); // depends on control dependency: [if], data = [(m_text]
}
} }
|
public class class_name {
@Override
public void processXML() throws InjectionException {
@SuppressWarnings("unchecked")
List<ServiceRef> serviceRefs = (List<ServiceRef>) ivNameSpaceConfig.getWebServiceRefs();
// no need to do any work if there are no service refs in the XML
if (serviceRefs == null || serviceRefs.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No service-refs in XML for module: " + ivNameSpaceConfig.getModuleName());
}
return;
}
ClassLoader moduleClassLoader = ivNameSpaceConfig.getClassLoader();
if (moduleClassLoader == null) {
throw new InjectionException("Internal Error: The classloader of module " + ivNameSpaceConfig.getModuleName() + " is null.");
}
// get all JAX-WS service refs from deployment descriptor
List<ServiceRef> jaxwsServiceRefs = InjectionHelper.normalizeJaxWsServiceRefs(serviceRefs, moduleClassLoader);
if (jaxwsServiceRefs.isEmpty()) {
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found JAX-WS service refs in XML for module: " + ivNameSpaceConfig.getModuleName());
}
// build up the metadata and create WebServiceRefBinding instances that will be used by the injection engine,
// then we will be saving off this metadata in the module or component metadata slot for later use by our ServiceRefObjectFactory
List<InjectionBinding<WebServiceRef>> bindingList = WebServiceRefBindingBuilder.buildJaxWsWebServiceRefBindings(jaxwsServiceRefs, ivNameSpaceConfig);
// now add all the bindings that were created
if (bindingList != null && !bindingList.isEmpty()) {
for (InjectionBinding<WebServiceRef> binding : bindingList) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Adding binding for JAX-WS service-ref: " + binding.getJndiName());
}
addInjectionBinding(binding);
}
}
} }
|
public class class_name {
@Override
public void processXML() throws InjectionException {
@SuppressWarnings("unchecked")
List<ServiceRef> serviceRefs = (List<ServiceRef>) ivNameSpaceConfig.getWebServiceRefs();
// no need to do any work if there are no service refs in the XML
if (serviceRefs == null || serviceRefs.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No service-refs in XML for module: " + ivNameSpaceConfig.getModuleName()); // depends on control dependency: [if], data = [none]
}
return;
}
ClassLoader moduleClassLoader = ivNameSpaceConfig.getClassLoader();
if (moduleClassLoader == null) {
throw new InjectionException("Internal Error: The classloader of module " + ivNameSpaceConfig.getModuleName() + " is null.");
}
// get all JAX-WS service refs from deployment descriptor
List<ServiceRef> jaxwsServiceRefs = InjectionHelper.normalizeJaxWsServiceRefs(serviceRefs, moduleClassLoader);
if (jaxwsServiceRefs.isEmpty()) {
return;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found JAX-WS service refs in XML for module: " + ivNameSpaceConfig.getModuleName());
}
// build up the metadata and create WebServiceRefBinding instances that will be used by the injection engine,
// then we will be saving off this metadata in the module or component metadata slot for later use by our ServiceRefObjectFactory
List<InjectionBinding<WebServiceRef>> bindingList = WebServiceRefBindingBuilder.buildJaxWsWebServiceRefBindings(jaxwsServiceRefs, ivNameSpaceConfig);
// now add all the bindings that were created
if (bindingList != null && !bindingList.isEmpty()) {
for (InjectionBinding<WebServiceRef> binding : bindingList) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Adding binding for JAX-WS service-ref: " + binding.getJndiName()); // depends on control dependency: [if], data = [none]
}
addInjectionBinding(binding); // depends on control dependency: [for], data = [binding]
}
}
} }
|
public class class_name {
private static List<SegmentString> fixSegments(List<SegmentString> segments) {
MCIndexNoder mCIndexNoder = new MCIndexNoder();
RobustLineIntersector robustLineIntersector = new RobustLineIntersector();
mCIndexNoder.setSegmentIntersector(new IntersectionAdder(robustLineIntersector));
mCIndexNoder.computeNodes(segments);
Collection nodedSubstring = mCIndexNoder.getNodedSubstrings();
ArrayList<SegmentString> ret = new ArrayList<>(nodedSubstring.size());
for (Object aNodedSubstring : nodedSubstring) {
ret.add((SegmentString) aNodedSubstring);
}
return ret;
} }
|
public class class_name {
private static List<SegmentString> fixSegments(List<SegmentString> segments) {
MCIndexNoder mCIndexNoder = new MCIndexNoder();
RobustLineIntersector robustLineIntersector = new RobustLineIntersector();
mCIndexNoder.setSegmentIntersector(new IntersectionAdder(robustLineIntersector));
mCIndexNoder.computeNodes(segments);
Collection nodedSubstring = mCIndexNoder.getNodedSubstrings();
ArrayList<SegmentString> ret = new ArrayList<>(nodedSubstring.size());
for (Object aNodedSubstring : nodedSubstring) {
ret.add((SegmentString) aNodedSubstring); // depends on control dependency: [for], data = [aNodedSubstring]
}
return ret;
} }
|
public class class_name {
private PortletCategoryBean filterCategoryFavoritesOnly(PortletCategoryBean category) {
// Subcategories
final Set<PortletCategoryBean> subcategories = new HashSet<>();
category.getSubcategories()
.forEach(
sub -> {
final PortletCategoryBean filteredBean =
filterCategoryFavoritesOnly(sub);
if (filteredBean != null) {
subcategories.add(filteredBean);
}
});
// Portlets
final Set<PortletDefinitionBean> portlets = new HashSet<>();
category.getPortlets()
.forEach(
child -> {
if (child.getFavorite()) {
logger.debug(
"Including portlet '{}' because it is a favorite: {}",
child.getFname());
portlets.add(child);
} else {
logger.debug(
"Skipping portlet '{}' because it IS NOT a favorite: {}",
child.getFname());
}
});
return !subcategories.isEmpty() || !portlets.isEmpty()
? PortletCategoryBean.create(
category.getId(),
category.getName(),
category.getDescription(),
subcategories,
portlets)
: null;
} }
|
public class class_name {
private PortletCategoryBean filterCategoryFavoritesOnly(PortletCategoryBean category) {
// Subcategories
final Set<PortletCategoryBean> subcategories = new HashSet<>();
category.getSubcategories()
.forEach(
sub -> {
final PortletCategoryBean filteredBean =
filterCategoryFavoritesOnly(sub);
if (filteredBean != null) {
subcategories.add(filteredBean); // depends on control dependency: [if], data = [(filteredBean]
}
});
// Portlets
final Set<PortletDefinitionBean> portlets = new HashSet<>();
category.getPortlets()
.forEach(
child -> {
if (child.getFavorite()) {
logger.debug(
"Including portlet '{}' because it is a favorite: {}",
child.getFname());
portlets.add(child);
} else {
logger.debug(
"Skipping portlet '{}' because it IS NOT a favorite: {}",
child.getFname());
}
});
return !subcategories.isEmpty() || !portlets.isEmpty()
? PortletCategoryBean.create(
category.getId(),
category.getName(),
category.getDescription(),
subcategories,
portlets)
: null;
} }
|
public class class_name {
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "SF_SWITCH_FALLTHROUGH", justification = "This fall-through is deliberate and documented")
@Override
public void sawOpcode(int seen) {
Object userObject = null;
// saving and restoring the userobject of the top item, works around a
// bug in Findbugs proper
if (stack.getStackDepth() > 0) {
userObject = stack.getStackItem(0).getUserValue();
}
stack.precomputation(this);
if (stack.getStackDepth() > 0) {
stack.getStackItem(0).setUserValue(userObject);
userObject = null;
}
try {
switch (seen) {
case Const.INVOKESPECIAL:
userObject = sawInvokeSpecial(userObject);
break;
case Const.INVOKEINTERFACE:
case Const.INVOKEVIRTUAL:
sawInvokeInterfaceVirtual();
break;
case Const.INVOKESTATIC:
userObject = sawInvokeStatic(userObject);
//$FALL-THROUGH$
case Const.INVOKEDYNAMIC:
processMethodParms();
break;
case Const.ARETURN:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
clearUserValue(item);
} else {
// bad findbugs bug, which clears the stack after an ALOAD, in some cases
int prevOp = getPrevOpcode(1);
if (OpcodeUtils.isALoad(prevOp)) {
localSpecialObjects.clear();
}
}
break;
case Const.ASTORE_0:
case Const.ASTORE_1:
case Const.ASTORE_2:
case Const.ASTORE_3:
case Const.ASTORE:
sawAStore(seen);
break;
case Const.ALOAD_0:
case Const.ALOAD_1:
case Const.ALOAD_2:
case Const.ALOAD_3:
case Const.ALOAD:
userObject = sawLoad(seen, userObject);
break;
case Const.AASTORE:
if (stack.getStackDepth() >= 3) {
OpcodeStack.Item item = stack.getStackItem(0);
clearUserValue(item);
}
break;
case Const.PUTFIELD:
sawPutField();
break;
case Const.GETFIELD:
userObject = sawGetField(userObject);
break;
case Const.PUTSTATIC:
sawPutStatic();
break;
case Const.GETSTATIC:
userObject = sawGetStatic(userObject);
break;
case Const.GOTO:
case Const.IFNULL:
case Const.IFNONNULL:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
Object uo = item.getUserValue();
if ((uo != null) && !(uo instanceof Boolean)) {
clearUserValue(item);
}
sawTernary = true;
}
break;
default:
break;
}
} finally {
TernaryPatcher.pre(stack, seen);
stack.sawOpcode(this, seen);
TernaryPatcher.post(stack, seen);
if ((userObject != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(userObject);
}
if (sawTernary) {
handleTernary(seen);
}
}
} }
|
public class class_name {
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "SF_SWITCH_FALLTHROUGH", justification = "This fall-through is deliberate and documented")
@Override
public void sawOpcode(int seen) {
Object userObject = null;
// saving and restoring the userobject of the top item, works around a
// bug in Findbugs proper
if (stack.getStackDepth() > 0) {
userObject = stack.getStackItem(0).getUserValue(); // depends on control dependency: [if], data = [0)]
}
stack.precomputation(this);
if (stack.getStackDepth() > 0) {
stack.getStackItem(0).setUserValue(userObject); // depends on control dependency: [if], data = [0)]
userObject = null; // depends on control dependency: [if], data = [none]
}
try {
switch (seen) {
case Const.INVOKESPECIAL:
userObject = sawInvokeSpecial(userObject);
break;
case Const.INVOKEINTERFACE:
case Const.INVOKEVIRTUAL:
sawInvokeInterfaceVirtual();
break;
case Const.INVOKESTATIC:
userObject = sawInvokeStatic(userObject);
//$FALL-THROUGH$
case Const.INVOKEDYNAMIC:
processMethodParms();
break;
case Const.ARETURN:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
clearUserValue(item); // depends on control dependency: [if], data = [none]
} else {
// bad findbugs bug, which clears the stack after an ALOAD, in some cases
int prevOp = getPrevOpcode(1);
if (OpcodeUtils.isALoad(prevOp)) {
localSpecialObjects.clear(); // depends on control dependency: [if], data = [none]
}
}
break;
case Const.ASTORE_0:
case Const.ASTORE_1:
case Const.ASTORE_2:
case Const.ASTORE_3:
case Const.ASTORE:
sawAStore(seen);
break;
case Const.ALOAD_0:
case Const.ALOAD_1:
case Const.ALOAD_2:
case Const.ALOAD_3:
case Const.ALOAD:
userObject = sawLoad(seen, userObject);
break;
case Const.AASTORE:
if (stack.getStackDepth() >= 3) {
OpcodeStack.Item item = stack.getStackItem(0);
clearUserValue(item); // depends on control dependency: [if], data = [none]
}
break;
case Const.PUTFIELD:
sawPutField();
break;
case Const.GETFIELD:
userObject = sawGetField(userObject);
break;
case Const.PUTSTATIC:
sawPutStatic();
break;
case Const.GETSTATIC:
userObject = sawGetStatic(userObject);
break;
case Const.GOTO:
case Const.IFNULL:
case Const.IFNONNULL:
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
Object uo = item.getUserValue();
if ((uo != null) && !(uo instanceof Boolean)) {
clearUserValue(item); // depends on control dependency: [if], data = [none]
}
sawTernary = true; // depends on control dependency: [if], data = [none]
}
break;
default:
break;
}
} finally {
TernaryPatcher.pre(stack, seen);
stack.sawOpcode(this, seen);
TernaryPatcher.post(stack, seen);
if ((userObject != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(userObject); // depends on control dependency: [if], data = [none]
}
if (sawTernary) {
handleTernary(seen); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private static String translateSep(String sep, boolean isProperty) {
if (sep == null) {
return null;
}
int next = sep.indexOf(BACKSLASH_CHAR);
if (next != -1) {
int start = 0;
char[] sepArray = sep.toCharArray();
char ch = 0;
int len = sep.length();
StringBuffer sb = new StringBuffer(len);
do {
sb.append(sepArray, start, next - start);
start = ++next;
if (next >= len) {
sb.append(BACKSLASH_CHAR);
break;
}
if (!isProperty) {
ch = sepArray[next];
}
if (ch == 'n') {
sb.append(LF_CHAR);
start++;
} else if (ch == 'r') {
sb.append(CR_CHAR);
start++;
} else if (ch == 't') {
sb.append('\t');
start++;
} else if (ch == BACKSLASH_CHAR) {
sb.append(BACKSLASH_CHAR);
start++;
} else if (ch == 'u') {
start++;
sb.append(
(char) Integer.parseInt(
sep.substring(start, start + 4), 16));
start += 4;
} else if (sep.startsWith("semi", next)) {
sb.append(';');
start += 4;
} else if (sep.startsWith("space", next)) {
sb.append(' ');
start += 5;
} else if (sep.startsWith("quote", next)) {
sb.append(DOUBLE_QUOTE_CHAR);
start += 5;
} else if (sep.startsWith("apos", next)) {
sb.append('\'');
start += 4;
} else {
sb.append(BACKSLASH_CHAR);
sb.append(sepArray[next]);
start++;
}
} while ((next = sep.indexOf(BACKSLASH_CHAR, start)) != -1);
sb.append(sepArray, start, len - start);
sep = sb.toString();
}
return sep;
} }
|
public class class_name {
private static String translateSep(String sep, boolean isProperty) {
if (sep == null) {
return null; // depends on control dependency: [if], data = [none]
}
int next = sep.indexOf(BACKSLASH_CHAR);
if (next != -1) {
int start = 0;
char[] sepArray = sep.toCharArray();
char ch = 0;
int len = sep.length();
StringBuffer sb = new StringBuffer(len);
do {
sb.append(sepArray, start, next - start);
start = ++next;
if (next >= len) {
sb.append(BACKSLASH_CHAR); // depends on control dependency: [if], data = [none]
break;
}
if (!isProperty) {
ch = sepArray[next]; // depends on control dependency: [if], data = [none]
}
if (ch == 'n') {
sb.append(LF_CHAR); // depends on control dependency: [if], data = [none]
start++; // depends on control dependency: [if], data = [none]
} else if (ch == 'r') {
sb.append(CR_CHAR); // depends on control dependency: [if], data = [none]
start++; // depends on control dependency: [if], data = [none]
} else if (ch == 't') {
sb.append('\t'); // depends on control dependency: [if], data = [none]
start++; // depends on control dependency: [if], data = [none]
} else if (ch == BACKSLASH_CHAR) {
sb.append(BACKSLASH_CHAR); // depends on control dependency: [if], data = [BACKSLASH_CHAR)]
start++; // depends on control dependency: [if], data = [none]
} else if (ch == 'u') {
start++; // depends on control dependency: [if], data = [none]
sb.append(
(char) Integer.parseInt(
sep.substring(start, start + 4), 16)); // depends on control dependency: [if], data = [none]
start += 4; // depends on control dependency: [if], data = [none]
} else if (sep.startsWith("semi", next)) {
sb.append(';'); // depends on control dependency: [if], data = [none]
start += 4; // depends on control dependency: [if], data = [none]
} else if (sep.startsWith("space", next)) {
sb.append(' '); // depends on control dependency: [if], data = [none]
start += 5; // depends on control dependency: [if], data = [none]
} else if (sep.startsWith("quote", next)) {
sb.append(DOUBLE_QUOTE_CHAR); // depends on control dependency: [if], data = [none]
start += 5; // depends on control dependency: [if], data = [none]
} else if (sep.startsWith("apos", next)) {
sb.append('\''); // depends on control dependency: [if], data = [none]
start += 4; // depends on control dependency: [if], data = [none]
} else {
sb.append(BACKSLASH_CHAR); // depends on control dependency: [if], data = [none]
sb.append(sepArray[next]); // depends on control dependency: [if], data = [none]
start++; // depends on control dependency: [if], data = [none]
}
} while ((next = sep.indexOf(BACKSLASH_CHAR, start)) != -1);
sb.append(sepArray, start, len - start); // depends on control dependency: [if], data = [none]
sep = sb.toString(); // depends on control dependency: [if], data = [none]
}
return sep;
} }
|
public class class_name {
private void initFromSPIServiceLoader() {
String property = System.getProperty("druid.load.spifilter.skip");
if (property != null) {
return;
}
ServiceLoader<Filter> druidAutoFilterLoader = ServiceLoader.load(Filter.class);
for (Filter autoFilter : druidAutoFilterLoader) {
AutoLoad autoLoad = autoFilter.getClass().getAnnotation(AutoLoad.class);
if (autoLoad != null && autoLoad.value()) {
if (LOG.isInfoEnabled()) {
LOG.info("load filter from spi :" + autoFilter.getClass().getName());
}
addFilter(autoFilter);
}
}
} }
|
public class class_name {
private void initFromSPIServiceLoader() {
String property = System.getProperty("druid.load.spifilter.skip");
if (property != null) {
return; // depends on control dependency: [if], data = [none]
}
ServiceLoader<Filter> druidAutoFilterLoader = ServiceLoader.load(Filter.class);
for (Filter autoFilter : druidAutoFilterLoader) {
AutoLoad autoLoad = autoFilter.getClass().getAnnotation(AutoLoad.class);
if (autoLoad != null && autoLoad.value()) {
if (LOG.isInfoEnabled()) {
LOG.info("load filter from spi :" + autoFilter.getClass().getName()); // depends on control dependency: [if], data = [none]
}
addFilter(autoFilter); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
static AVIMMessage parseMessage(String conversationId, JSONObject jsonObject) {
if (null != jsonObject && jsonObject.containsKey(KEY_MESSAGE_ID)) {
try {
String from = jsonObject.getString(KEY_MESSAGE_FROM);
String data = jsonObject.getString(KEY_MESSAGE_CONTENT);
long timestamp = jsonObject.getLong(KEY_MESSAGE_TIMESTAMP);
String msgId = jsonObject.getString(KEY_MESSAGE_ID);
AVIMMessage message = new AVIMMessage(conversationId, from, timestamp, -1);
message.setMessageId(msgId);
message.setContent(data);
return AVIMMessageManagerHelper.parseTypedMessage(message);
} catch (Exception e) {}
}
return null;
} }
|
public class class_name {
static AVIMMessage parseMessage(String conversationId, JSONObject jsonObject) {
if (null != jsonObject && jsonObject.containsKey(KEY_MESSAGE_ID)) {
try {
String from = jsonObject.getString(KEY_MESSAGE_FROM);
String data = jsonObject.getString(KEY_MESSAGE_CONTENT);
long timestamp = jsonObject.getLong(KEY_MESSAGE_TIMESTAMP);
String msgId = jsonObject.getString(KEY_MESSAGE_ID);
AVIMMessage message = new AVIMMessage(conversationId, from, timestamp, -1);
message.setMessageId(msgId); // depends on control dependency: [try], data = [none]
message.setContent(data); // depends on control dependency: [try], data = [none]
return AVIMMessageManagerHelper.parseTypedMessage(message); // depends on control dependency: [try], data = [none]
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
private void obtainEntryValues(@NonNull final TypedArray typedArray) {
CharSequence[] obtainedEntryValues =
typedArray.getTextArray(R.styleable.AbstractListPreference_android_entryValues);
if (obtainedEntryValues != null) {
setEntryValues(obtainedEntryValues);
}
} }
|
public class class_name {
private void obtainEntryValues(@NonNull final TypedArray typedArray) {
CharSequence[] obtainedEntryValues =
typedArray.getTextArray(R.styleable.AbstractListPreference_android_entryValues);
if (obtainedEntryValues != null) {
setEntryValues(obtainedEntryValues); // depends on control dependency: [if], data = [(obtainedEntryValues]
}
} }
|
public class class_name {
@Override
public void received(ByteBuffer buffer) {
if (ended) {
throw new IllegalStateException();
}
if ((countRead + buffer.remaining()) > contentLength) {
ByteBuffer b = buffer.duplicate();
int l = (int) (contentLength - countRead);
b.limit(b.position() + l);
buffer.position(buffer.position() + l);
buffer = b;
}
countRead += buffer.remaining();
if (buffer.hasRemaining()) {
wrappee.received(buffer);
}
if (countRead == contentLength) {
ended = true;
wrappee.ended();
}
} }
|
public class class_name {
@Override
public void received(ByteBuffer buffer) {
if (ended) {
throw new IllegalStateException();
}
if ((countRead + buffer.remaining()) > contentLength) {
ByteBuffer b = buffer.duplicate();
int l = (int) (contentLength - countRead);
b.limit(b.position() + l); // depends on control dependency: [if], data = [none]
buffer.position(buffer.position() + l); // depends on control dependency: [if], data = [none]
buffer = b; // depends on control dependency: [if], data = [none]
}
countRead += buffer.remaining();
if (buffer.hasRemaining()) {
wrappee.received(buffer); // depends on control dependency: [if], data = [none]
}
if (countRead == contentLength) {
ended = true; // depends on control dependency: [if], data = [none]
wrappee.ended(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected String setSnapshotUserPermissions(final String spaceId) {
try {
Retrier retrier = new Retrier();
return retrier.execute(new Retriable() {
@Override
public String retry() throws Exception {
// The actual method being executed
Map<String, AclType> spaceACLs =
snapshotProvider.getSpaceACLs(spaceId);
spaceACLs.put(StorageProvider.PROPERTIES_SPACE_ACL +
dcSnapshotUser, AclType.READ);
snapshotProvider.setSpaceACLs(spaceId, spaceACLs);
return spaceId;
}
});
} catch (Exception e) {
throw new TaskException("Unable to create snapshot, failed" +
"setting space permissions due to: " +
e.getMessage(), e);
}
} }
|
public class class_name {
protected String setSnapshotUserPermissions(final String spaceId) {
try {
Retrier retrier = new Retrier();
return retrier.execute(new Retriable() {
@Override
public String retry() throws Exception {
// The actual method being executed
Map<String, AclType> spaceACLs =
snapshotProvider.getSpaceACLs(spaceId);
spaceACLs.put(StorageProvider.PROPERTIES_SPACE_ACL +
dcSnapshotUser, AclType.READ);
snapshotProvider.setSpaceACLs(spaceId, spaceACLs);
return spaceId;
}
}); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new TaskException("Unable to create snapshot, failed" +
"setting space permissions due to: " +
e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public synchronized ChainData[] getAllChains(String channelName) throws ChannelException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getAllChains: " + channelName);
}
if (null == channelName) {
throw new InvalidChannelNameException("Null channelName found");
}
ChainDataImpl chainData = null;
List<ChainData> chainDataList = new ArrayList<ChainData>();
// Collect all chains referring to the channel
Iterator<ChainDataImpl> chainDataIter = chainDataMap.values().iterator();
while (chainDataIter.hasNext()) {
chainData = chainDataIter.next();
if (chainData.containsChannel(channelName)) {
chainDataList.add(chainData);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getAllChains");
}
return chainDataList.toArray(new ChainData[chainDataList.size()]);
} }
|
public class class_name {
@Override
public synchronized ChainData[] getAllChains(String channelName) throws ChannelException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getAllChains: " + channelName); // depends on control dependency: [if], data = [none]
}
if (null == channelName) {
throw new InvalidChannelNameException("Null channelName found");
}
ChainDataImpl chainData = null;
List<ChainData> chainDataList = new ArrayList<ChainData>();
// Collect all chains referring to the channel
Iterator<ChainDataImpl> chainDataIter = chainDataMap.values().iterator();
while (chainDataIter.hasNext()) {
chainData = chainDataIter.next(); // depends on control dependency: [while], data = [none]
if (chainData.containsChannel(channelName)) {
chainDataList.add(chainData); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getAllChains"); // depends on control dependency: [if], data = [none]
}
return chainDataList.toArray(new ChainData[chainDataList.size()]);
} }
|
public class class_name {
private Node<K,V> leastValidNode(final Node<K,V> node, final int index, final String thread_id) {
Node<K,V> lval = node;
while (lval != null && !validNode(lval, thread_id)) {
lval = nextSmaller(lval, index);
}
return lval;
} }
|
public class class_name {
private Node<K,V> leastValidNode(final Node<K,V> node, final int index, final String thread_id) {
Node<K,V> lval = node;
while (lval != null && !validNode(lval, thread_id)) {
lval = nextSmaller(lval, index);
// depends on control dependency: [while], data = [(lval]
}
return lval;
} }
|
public class class_name {
private boolean interruptAndJoinThreads(List<Thread> threads) {
// interrupt and wait for all ongoing create threads
for(Thread t : threads) {
t.interrupt();
}
for(Thread t : threads) {
try {
t.join();
} catch (InterruptedException e) {
DataNode.LOG.warn("interruptOngoingCreates: t=" + t, e);
return false;
}
}
return true;
} }
|
public class class_name {
private boolean interruptAndJoinThreads(List<Thread> threads) {
// interrupt and wait for all ongoing create threads
for(Thread t : threads) {
t.interrupt(); // depends on control dependency: [for], data = [t]
}
for(Thread t : threads) {
try {
t.join(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
DataNode.LOG.warn("interruptOngoingCreates: t=" + t, e);
return false;
} // depends on control dependency: [catch], data = [none]
}
return true;
} }
|
public class class_name {
protected Parameter[] createDefaultParameters(Class[] parameters) {
Parameter[] componentParameters = new Parameter[parameters.length];
for (int i = 0; i < parameters.length; i++) {
componentParameters[i] = ComponentParameter.DEFAULT;
}
return componentParameters;
} }
|
public class class_name {
protected Parameter[] createDefaultParameters(Class[] parameters) {
Parameter[] componentParameters = new Parameter[parameters.length];
for (int i = 0; i < parameters.length; i++) {
componentParameters[i] = ComponentParameter.DEFAULT;
// depends on control dependency: [for], data = [i]
}
return componentParameters;
} }
|
public class class_name {
public Pattern compile(String regex)
{
try {
return Pattern.compile(regex);
} catch (PatternSyntaxException ex) {
return null;
}
} }
|
public class class_name {
public Pattern compile(String regex)
{
try {
return Pattern.compile(regex); // depends on control dependency: [try], data = [none]
} catch (PatternSyntaxException ex) {
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void createItem(BareJid jid, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final XMPPConnection connection = getAuthenticatedConnectionOrThrow();
// Create and send roster entry creation packet.
RosterPacket rosterPacket = new RosterPacket();
rosterPacket.setType(IQ.Type.set);
RosterPacket.Item item = new RosterPacket.Item(jid, name);
if (groups != null) {
for (String group : groups) {
if (group != null && group.trim().length() > 0) {
item.addGroupName(group);
}
}
}
rosterPacket.addRosterItem(item);
connection.createStanzaCollectorAndSend(rosterPacket).nextResultOrThrow();
} }
|
public class class_name {
public void createItem(BareJid jid, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final XMPPConnection connection = getAuthenticatedConnectionOrThrow();
// Create and send roster entry creation packet.
RosterPacket rosterPacket = new RosterPacket();
rosterPacket.setType(IQ.Type.set);
RosterPacket.Item item = new RosterPacket.Item(jid, name);
if (groups != null) {
for (String group : groups) {
if (group != null && group.trim().length() > 0) {
item.addGroupName(group); // depends on control dependency: [if], data = [(group]
}
}
}
rosterPacket.addRosterItem(item);
connection.createStanzaCollectorAndSend(rosterPacket).nextResultOrThrow();
} }
|
public class class_name {
void handleProcessFinish(InternalEvent event) throws ProcessException
{
try {
String ownerType = event.getOwnerType();
String secondaryOwnerType = event.getSecondaryOwnerType();
if (!OwnerType.ACTIVITY_INSTANCE.equals(secondaryOwnerType)) {
// top level processes (non-remote) or ABORT embedded processes
ProcessInstance pi = edao.getProcessInstance(event.getWorkInstanceId());
Process subProcVO = getProcessDefinition(pi);
if (pi.isEmbedded()) {
subProcVO.getSubProcessVO(event.getWorkId());
String embeddedProcType = subProcVO.getAttribute(WorkAttributeConstant.EMBEDDED_PROCESS_TYPE);
if (ProcessVisibilityConstant.EMBEDDED_ABORT_PROCESS.equals(embeddedProcType)) {
Long parentProcInstId = event.getOwnerId();
pi = edao.getProcessInstance(parentProcInstId);
this.cancelProcessInstanceTree(pi);
if (logger.isInfoEnabled()) {
logger.info(logtag(pi.getProcessId(), pi.getId(), pi.getMasterRequestId()),
"Process cancelled");
}
InternalEvent procFinishMsg = InternalEvent.createProcessFinishMessage(pi);
if (OwnerType.ACTIVITY_INSTANCE.equals(pi.getSecondaryOwner())) {
procFinishMsg.setSecondaryOwnerType(pi.getSecondaryOwner());
procFinishMsg.setSecondaryOwnerId(pi.getSecondaryOwnerId());
}
this.sendInternalEvent(procFinishMsg);
}
}
} else if (ownerType.equals(OwnerType.PROCESS_INSTANCE)
|| ownerType.equals(OwnerType.MAIN_PROCESS_INSTANCE)
|| ownerType.equals(OwnerType.ERROR)) {
// local process call or call to error/correction/delay handler
Long activityInstId = event.getSecondaryOwnerId();
ActivityInstance actInst = edao.getActivityInstance(activityInstId);
ProcessInstance procInst = edao.getProcessInstance(actInst.getProcessInstanceId());
BaseActivity cntrActivity = prepareActivityForResume(event,procInst, actInst);
if (cntrActivity!=null) {
resumeProcessInstanceForSecondaryOwner(event, cntrActivity);
} // else the process is completed/cancelled
}
} catch (Exception e) {
throw new ProcessException(-1, e.getMessage(), e);
}
} }
|
public class class_name {
void handleProcessFinish(InternalEvent event) throws ProcessException
{
try {
String ownerType = event.getOwnerType();
String secondaryOwnerType = event.getSecondaryOwnerType();
if (!OwnerType.ACTIVITY_INSTANCE.equals(secondaryOwnerType)) {
// top level processes (non-remote) or ABORT embedded processes
ProcessInstance pi = edao.getProcessInstance(event.getWorkInstanceId());
Process subProcVO = getProcessDefinition(pi);
if (pi.isEmbedded()) {
subProcVO.getSubProcessVO(event.getWorkId()); // depends on control dependency: [if], data = [none]
String embeddedProcType = subProcVO.getAttribute(WorkAttributeConstant.EMBEDDED_PROCESS_TYPE);
if (ProcessVisibilityConstant.EMBEDDED_ABORT_PROCESS.equals(embeddedProcType)) {
Long parentProcInstId = event.getOwnerId();
pi = edao.getProcessInstance(parentProcInstId); // depends on control dependency: [if], data = [none]
this.cancelProcessInstanceTree(pi); // depends on control dependency: [if], data = [none]
if (logger.isInfoEnabled()) {
logger.info(logtag(pi.getProcessId(), pi.getId(), pi.getMasterRequestId()),
"Process cancelled"); // depends on control dependency: [if], data = [none]
}
InternalEvent procFinishMsg = InternalEvent.createProcessFinishMessage(pi);
if (OwnerType.ACTIVITY_INSTANCE.equals(pi.getSecondaryOwner())) {
procFinishMsg.setSecondaryOwnerType(pi.getSecondaryOwner()); // depends on control dependency: [if], data = [none]
procFinishMsg.setSecondaryOwnerId(pi.getSecondaryOwnerId()); // depends on control dependency: [if], data = [none]
}
this.sendInternalEvent(procFinishMsg); // depends on control dependency: [if], data = [none]
}
}
} else if (ownerType.equals(OwnerType.PROCESS_INSTANCE)
|| ownerType.equals(OwnerType.MAIN_PROCESS_INSTANCE)
|| ownerType.equals(OwnerType.ERROR)) {
// local process call or call to error/correction/delay handler
Long activityInstId = event.getSecondaryOwnerId();
ActivityInstance actInst = edao.getActivityInstance(activityInstId);
ProcessInstance procInst = edao.getProcessInstance(actInst.getProcessInstanceId());
BaseActivity cntrActivity = prepareActivityForResume(event,procInst, actInst);
if (cntrActivity!=null) {
resumeProcessInstanceForSecondaryOwner(event, cntrActivity); // depends on control dependency: [if], data = [none]
} // else the process is completed/cancelled
}
} catch (Exception e) {
throw new ProcessException(-1, e.getMessage(), e);
}
} }
|
public class class_name {
public Set<Reference> getNonCopytoResult() {
final Set<Reference> nonCopytoSet = new LinkedHashSet<>(128);
nonCopytoSet.addAll(nonConrefCopytoTargets);
for (final URI f : conrefTargets) {
nonCopytoSet.add(new Reference(stripFragment(f), currentFileFormat()));
}
for (final URI f : copytoMap.values()) {
nonCopytoSet.add(new Reference(stripFragment(f)));
}
for (final URI f : ignoredCopytoSourceSet) {
nonCopytoSet.add(new Reference(stripFragment(f)));
}
for (final URI filename : coderefTargetSet) {
nonCopytoSet.add(new Reference(stripFragment(filename)));
}
return nonCopytoSet;
} }
|
public class class_name {
public Set<Reference> getNonCopytoResult() {
final Set<Reference> nonCopytoSet = new LinkedHashSet<>(128);
nonCopytoSet.addAll(nonConrefCopytoTargets);
for (final URI f : conrefTargets) {
nonCopytoSet.add(new Reference(stripFragment(f), currentFileFormat())); // depends on control dependency: [for], data = [f]
}
for (final URI f : copytoMap.values()) {
nonCopytoSet.add(new Reference(stripFragment(f))); // depends on control dependency: [for], data = [f]
}
for (final URI f : ignoredCopytoSourceSet) {
nonCopytoSet.add(new Reference(stripFragment(f))); // depends on control dependency: [for], data = [f]
}
for (final URI filename : coderefTargetSet) {
nonCopytoSet.add(new Reference(stripFragment(filename))); // depends on control dependency: [for], data = [filename]
}
return nonCopytoSet;
} }
|
public class class_name {
@Nullable
@Size(2)
static String optCountryCode(
@NonNull JSONObject jsonObject,
@NonNull @Size(min = 1) String fieldName) {
String value = nullIfNullOrEmpty(jsonObject.optString(fieldName));
if (value != null && value.length() == 2) {
return value;
}
return null;
} }
|
public class class_name {
@Nullable
@Size(2)
static String optCountryCode(
@NonNull JSONObject jsonObject,
@NonNull @Size(min = 1) String fieldName) {
String value = nullIfNullOrEmpty(jsonObject.optString(fieldName));
if (value != null && value.length() == 2) {
return value; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public String getType()
{
if (input == null)
{
return "allprop";
}
if (input.getChild(PropertyConstants.DAV_ALLPROP_INCLUDE) != null)
{
return "include";
}
QName name = input.getChild(0).getName();
if (name.getNamespaceURI().equals("DAV:"))
return name.getLocalPart();
else
return null;
} }
|
public class class_name {
public String getType()
{
if (input == null)
{
return "allprop";
// depends on control dependency: [if], data = [none]
}
if (input.getChild(PropertyConstants.DAV_ALLPROP_INCLUDE) != null)
{
return "include";
// depends on control dependency: [if], data = [none]
}
QName name = input.getChild(0).getName();
if (name.getNamespaceURI().equals("DAV:"))
return name.getLocalPart();
else
return null;
} }
|
public class class_name {
public VoltXMLElement findChild(String uniqueName)
{
for (VoltXMLElement vxe : children) {
if (uniqueName.equals(vxe.getUniqueName())) {
return vxe;
}
}
return null;
} }
|
public class class_name {
public VoltXMLElement findChild(String uniqueName)
{
for (VoltXMLElement vxe : children) {
if (uniqueName.equals(vxe.getUniqueName())) {
return vxe; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static MetricsLogger getMetricsLogger(final String dimensions) {
if (MetricsManager.instance != null) {
final Map<String, String> dimensionsMap = DimensionsUtils.parseDimensions(dimensions);
if (!dimensionsMap.isEmpty()) {
dimensionsMap.put("service", MetricsManager.instance.serviceName);
if (MetricsManager.instance.env.length() > 0) {
dimensionsMap.put("env", MetricsManager.instance.env);
}
return MetricsManager.instance.metricsLoggers.computeIfAbsent(
DimensionsUtils.serializeDimensionsToString(dimensionsMap), key -> new MetricsLogger(dimensionsMap));
} else {
throw new IllegalArgumentException("Dimensions must be valid and non-empty");
}
}
return dummyLogger;
} }
|
public class class_name {
public static MetricsLogger getMetricsLogger(final String dimensions) {
if (MetricsManager.instance != null) {
final Map<String, String> dimensionsMap = DimensionsUtils.parseDimensions(dimensions);
if (!dimensionsMap.isEmpty()) {
dimensionsMap.put("service", MetricsManager.instance.serviceName); // depends on control dependency: [if], data = [none]
if (MetricsManager.instance.env.length() > 0) {
dimensionsMap.put("env", MetricsManager.instance.env); // depends on control dependency: [if], data = [none]
}
return MetricsManager.instance.metricsLoggers.computeIfAbsent(
DimensionsUtils.serializeDimensionsToString(dimensionsMap), key -> new MetricsLogger(dimensionsMap)); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Dimensions must be valid and non-empty");
}
}
return dummyLogger;
} }
|
public class class_name {
@NonNull
public IconicsDrawable icon(@NonNull String icon) {
try {
ITypeface font = Iconics.findFont(mContext, icon.substring(0, 3));
icon = icon.replace("-", "_");
icon(font.getIcon(icon));
} catch (Exception ex) {
Log.e(Iconics.TAG, "Wrong icon name: " + icon);
}
return this;
} }
|
public class class_name {
@NonNull
public IconicsDrawable icon(@NonNull String icon) {
try {
ITypeface font = Iconics.findFont(mContext, icon.substring(0, 3));
icon = icon.replace("-", "_"); // depends on control dependency: [try], data = [none]
icon(font.getIcon(icon)); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
Log.e(Iconics.TAG, "Wrong icon name: " + icon);
} // depends on control dependency: [catch], data = [none]
return this;
} }
|
public class class_name {
@TargetApi(Build.VERSION_CODES.KITKAT)
// (http://stackoverflow.com/questions/19834842/android-gallery-on-kitkat-returns-different-uri-for-intent-action-get-content)
@SuppressLint("NewApi")
public static String getPath(final Context context, final Uri uri) {
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if(isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider
if(isExternalStorageDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
if("primary".equalsIgnoreCase(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
} else if(isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
if (!TextUtils.isEmpty(id)) {
return id.replace("raw:", "");
}
try {
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null);
} catch (NumberFormatException e) {
Log.i(TAG,e.getMessage());
return null;
}
}
} else if ("file".equalsIgnoreCase(uri.getScheme()) ||
"content".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
return null;
} }
|
public class class_name {
@TargetApi(Build.VERSION_CODES.KITKAT)
// (http://stackoverflow.com/questions/19834842/android-gallery-on-kitkat-returns-different-uri-for-intent-action-get-content)
@SuppressLint("NewApi")
public static String getPath(final Context context, final Uri uri) {
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if(isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider
if(isExternalStorageDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
if("primary".equalsIgnoreCase(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1]; // depends on control dependency: [if], data = [none]
}
} else if(isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
if (!TextUtils.isEmpty(id)) {
return id.replace("raw:", ""); // depends on control dependency: [if], data = [none]
}
try {
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null);
} catch (NumberFormatException e) {
Log.i(TAG,e.getMessage());
return null;
}
}
} else if ("file".equalsIgnoreCase(uri.getScheme()) ||
"content".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
return null;
} }
|
public class class_name {
@Override
public EClass getIfcQuantityTime() {
if (ifcQuantityTimeEClass == null) {
ifcQuantityTimeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(491);
}
return ifcQuantityTimeEClass;
} }
|
public class class_name {
@Override
public EClass getIfcQuantityTime() {
if (ifcQuantityTimeEClass == null) {
ifcQuantityTimeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(491);
// depends on control dependency: [if], data = [none]
}
return ifcQuantityTimeEClass;
} }
|
public class class_name {
@Override
public boolean applyAction(Model c) {
if (c.getMapping().isOffline(node)) {
c.getMapping().addOnlineNode(node);
return true;
}
return false;
} }
|
public class class_name {
@Override
public boolean applyAction(Model c) {
if (c.getMapping().isOffline(node)) {
c.getMapping().addOnlineNode(node); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
protected boolean validateCondition(String key,String value)
{
boolean valid=false;
FaxClientSpiConfigurationConstants condition=FaxClientSpiConfigurationConstants.getEnum(key);
String propertyValue=null;
switch(condition)
{
case PROPERTY_CONDITION:
//get value
propertyValue=this.getConfigurationValue(value);
if(propertyValue!=null)
{
valid=true;
}
break;
case OS_CONDITION:
//get OS name
String osName=System.getProperty("os.name");
//change values to lower case
osName=osName.toLowerCase();
String updatedValue=value.toLowerCase();
if(osName.contains(updatedValue))
{
valid=true;
}
break;
case JAVA_CLASS_CONDITION:
try
{
//load class
ReflectionHelper.getType(value);
valid=true;
}
catch(Throwable throwable)
{
//ignore
}
break;
case NATIVE_LIB_CONDITION:
try
{
//load library
System.loadLibrary(value);
valid=true;
}
catch(Throwable throwable)
{
//ignore
}
break;
case EXECUTABLE_CONDITION:
//get system path
String systemPath=System.getProperty("java.library.path");
String[] systemPathElements=systemPath.split(System.getProperty("path.separator"));
//get amount
int amount=systemPathElements.length;
String directoryPath=null;
File file=null;
for(int index=0;index<amount;index++)
{
//get next element
directoryPath=systemPathElements[index];
//get file
file=new File(directoryPath,value);
if((file.exists())&&(file.isFile()))
{
valid=true;
}
}
break;
case STABLE_CONDITION:
//get property key
String propertyKey=FaxClientSpiConfigurationConstants.SPI_STABLE_PROPERTY_KEY_PREFIX+value+FaxClientSpiConfigurationConstants.SPI_STABLE_PROPERTY_KEY_SUFFIX;
//get value
propertyValue=this.getConfigurationValue(propertyKey);
valid=Boolean.parseBoolean(propertyValue);
break;
default:
throw new FaxException("Invalid condition key provided: "+key);
}
return valid;
} }
|
public class class_name {
protected boolean validateCondition(String key,String value)
{
boolean valid=false;
FaxClientSpiConfigurationConstants condition=FaxClientSpiConfigurationConstants.getEnum(key);
String propertyValue=null;
switch(condition)
{
case PROPERTY_CONDITION:
//get value
propertyValue=this.getConfigurationValue(value);
if(propertyValue!=null)
{
valid=true; // depends on control dependency: [if], data = [none]
}
break;
case OS_CONDITION:
//get OS name
String osName=System.getProperty("os.name");
//change values to lower case
osName=osName.toLowerCase();
String updatedValue=value.toLowerCase();
if(osName.contains(updatedValue))
{
valid=true; // depends on control dependency: [if], data = [none]
}
break;
case JAVA_CLASS_CONDITION:
try
{
//load class
ReflectionHelper.getType(value); // depends on control dependency: [try], data = [none]
valid=true; // depends on control dependency: [try], data = [none]
}
catch(Throwable throwable)
{
//ignore
} // depends on control dependency: [catch], data = [none]
break;
case NATIVE_LIB_CONDITION:
try
{
//load library
System.loadLibrary(value); // depends on control dependency: [try], data = [none]
valid=true; // depends on control dependency: [try], data = [none]
}
catch(Throwable throwable)
{
//ignore
} // depends on control dependency: [catch], data = [none]
break;
case EXECUTABLE_CONDITION:
//get system path
String systemPath=System.getProperty("java.library.path");
String[] systemPathElements=systemPath.split(System.getProperty("path.separator"));
//get amount
int amount=systemPathElements.length;
String directoryPath=null;
File file=null;
for(int index=0;index<amount;index++)
{
//get next element
directoryPath=systemPathElements[index];
//get file
file=new File(directoryPath,value);
if((file.exists())&&(file.isFile()))
{
valid=true;
}
}
break;
case STABLE_CONDITION:
//get property key
String propertyKey=FaxClientSpiConfigurationConstants.SPI_STABLE_PROPERTY_KEY_PREFIX+value+FaxClientSpiConfigurationConstants.SPI_STABLE_PROPERTY_KEY_SUFFIX;
//get value
propertyValue=this.getConfigurationValue(propertyKey);
valid=Boolean.parseBoolean(propertyValue);
break;
default:
throw new FaxException("Invalid condition key provided: "+key);
}
return valid;
} }
|
public class class_name {
public boolean execute(Canvas target, Menu menu, MenuItem item) {
if (editController.getEditMode() == EditMode.DRAG_MODE) {
return false;
}
return true;
} }
|
public class class_name {
public boolean execute(Canvas target, Menu menu, MenuItem item) {
if (editController.getEditMode() == EditMode.DRAG_MODE) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
@Override
public int discriminate(VirtualConnection vc, Object discrimData) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "discriminate");
}
// Check for null discrimData
if (discrimData == null) {
// Can't handle this condition.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Received null discrim data. Returning NO from discriminator.");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "discriminate");
}
return Discriminator.NO;
}
// Get data read in on device side. Note, it will always be an array of one element.
WsByteBuffer netBuffer = ((WsByteBuffer[]) discrimData)[0];
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "netBuffer: " + SSLUtils.getBufferTraceInfo(netBuffer));
}
// Check for empty discrimData
if (0 == netBuffer.position()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Received empty discrim data. Returning MAYBE from discriminator.");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "discriminate");
}
// No data to discriminate on.
return Discriminator.MAYBE;
}
// Ensure initialize has taken place first.
if (!this.isInitialized) {
try {
init();
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception caught while getting SSL connection link: " + e);
}
FFDCFilter.processException(e, getClass().getName(), "148", this, new Object[] { vc });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "discriminate");
}
return Discriminator.NO;
}
}
// Initial position of networkBuffer.
int initialNetBufPosition = netBuffer.position();
// Initial limit of networkBuffer.
int initialNetBufLimit = netBuffer.limit();
// Unencrypted buffer from the ssl engine output to be handed up to the application.
WsByteBuffer decryptedNetBuffer = null;
// State map from the VC.
Map<Object, Object> stateMap = vc.getStateMap();
// The SSL engine.
SSLEngine sslEngine = null;
// The SSL context for this connection.
SSLContext vcSSLContext = null;
// Result output from the SSL engine.
SSLEngineResult sslResult = null;
// Result from discrimination.
int result = Discriminator.YES;
// State saved from potentially former call to discriminator for this connection.
SSLDiscriminatorState discState = null;
try {
// Prepare the networkBuffer for the call to unwrap. Align data between pos and lim.
netBuffer.flip();
// Determine if this connection has already been through discrimination once.
discState = (SSLDiscriminatorState) stateMap.get(SSL_DISCRIMINATOR_STATE);
if (discState == null) {
// Create the sslContext based on the virtual connection.
vcSSLContext = getSSLContextForInboundLink(null, vc);
// This is the first call to discriminate. Build a new SSL engine for this connection.
sslEngine = SSLUtils.getSSLEngine(vcSSLContext, FlowType.INBOUND,
(SSLLinkConfig) vc.getStateMap().get(SSLConnectionLink.LINKCONFIG),
(SSLConnectionLink) getConnectionLink(vc));
// Line up all the buffers needed for a call to unwrap.
decryptedNetBuffer = SSLUtils.allocateByteBuffer(sslEngine.getSession().getApplicationBufferSize(),
getConfig().getDecryptBuffersDirect());
} else {
// This is NOT the first call to discriminate. Extract the ssl engine and context.
sslEngine = discState.getEngine();
vcSSLContext = discState.getSSLContext();
// Extract output buffer used during discrimination.
decryptedNetBuffer = discState.getDecryptedNetBuffer();
}
// Note: Can't call handshake code because we can't write to the client. Unwrap discrim data.
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "before unwrap: \r\n\tnetBuf: " + SSLUtils.getBufferTraceInfo(netBuffer)
+ "\r\n\tdecNetBuf: " + SSLUtils.getBufferTraceInfo(decryptedNetBuffer));
}
// Note, net and decNet buffers will always be one buffer for discrimination.
// Protect JSSE from potential SSL packet sizes that are too big.
int savedLimit = SSLUtils.adjustBufferForJSSE(netBuffer,
sslEngine.getSession().getPacketBufferSize());
// Have the SSL engine inspect the first packet.
sslResult = sslEngine.unwrap(netBuffer.getWrappedByteBuffer(),
decryptedNetBuffer.getWrappedByteBuffer());
// we should be in a handshake stage so I don't expect bytes to be
// produced, but if there are, then the buffer needs to flip
if (0 < sslResult.bytesProduced()) {
decryptedNetBuffer.flip();
}
// If adjustments were made for the JSSE, restore them.
if (-1 != savedLimit) {
netBuffer.limit(savedLimit);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "after unwrap: \r\n\tnetBuf: " + SSLUtils.getBufferTraceInfo(netBuffer)
+ "\r\n\tdecNetBuf: " + SSLUtils.getBufferTraceInfo(decryptedNetBuffer)
+ "\r\n\tstatus=" + sslResult.getStatus()
+ " HSstatus=" + sslResult.getHandshakeStatus()
+ " consumed=" + sslResult.bytesConsumed()
+ " produced=" + sslResult.bytesProduced());
}
if (sslResult.getStatus() == Status.BUFFER_UNDERFLOW) {
// More data needed to make decision.
result = Discriminator.MAYBE;
} else {
result = Discriminator.YES;
if (netBuffer.remaining() == 0) {
netBuffer.clear();
}
}
} catch (Throwable t) {
// No FFDC needed. Some exceptions expected and handled elsewhere.
// Input was not SSL.
result = Discriminator.NO;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caught Exception during discriminate: " + t);
}
}
// Take appropriate action based on result to be returned to caller.
switch (result) {
case Discriminator.YES: {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Discriminator returning YES");
}
// Save discriminator state for the ready method.
// Note, if this isn't the first call to discriminator for this connection, the SSL engine and
// decrypted network buffer will already be there. For speed, use single method and all for
// redundant setting of engine and buffer.
// Save the position and limit of networkBuffer since we must return with an unmodified buffer.
// Note, the networkBuffer is reset at the bottom of this method.
if (discState == null) {
discState = new SSLDiscriminatorState();
}
discState.updateState(vcSSLContext, sslEngine, sslResult,
decryptedNetBuffer, netBuffer.position(), netBuffer.limit());
stateMap.put(SSL_DISCRIMINATOR_STATE, discState);
break;
}
case Discriminator.NO: {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Discriminator returning NO");
}
// If this wasn't the first time discriminate was called, clean up the state map.
if (discState != null) {
// Remove reference to discriminator state.
stateMap.remove(SSL_DISCRIMINATOR_STATE);
}
if (null != sslEngine) {
// PK13349 - close the discrimination engine
closeEngine(sslEngine);
}
if (null != decryptedNetBuffer) {
// Release the unwrap output buffer back to the pool.
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Releasing decryptedNetworkBuffer");
}
decryptedNetBuffer.release();
decryptedNetBuffer = null;
}
break;
}
default: { // Discriminator.MAYBE
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Discriminator returning MAYBE");
}
// If this is the first time discrimination has run, save the SSL Engine and output buffer in the VC
// Otherwise, the references are already there.
if (discState == null) {
// Note no need to update position and limit since they weren't modified by unwrap.
discState = new SSLDiscriminatorState();
discState.updateState(vcSSLContext, sslEngine, sslResult,
decryptedNetBuffer, netBuffer.position(), netBuffer.limit());
stateMap.put(SSL_DISCRIMINATOR_STATE, discState);
}
break;
}
}
// Reset the position and limit of networkBuffer, required by discrimination process.
netBuffer.limit(initialNetBufLimit);
netBuffer.position(initialNetBufPosition);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "discriminate");
}
return result;
} }
|
public class class_name {
@Override
public int discriminate(VirtualConnection vc, Object discrimData) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "discriminate"); // depends on control dependency: [if], data = [none]
}
// Check for null discrimData
if (discrimData == null) {
// Can't handle this condition.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Received null discrim data. Returning NO from discriminator."); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "discriminate"); // depends on control dependency: [if], data = [none]
}
return Discriminator.NO; // depends on control dependency: [if], data = [none]
}
// Get data read in on device side. Note, it will always be an array of one element.
WsByteBuffer netBuffer = ((WsByteBuffer[]) discrimData)[0];
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "netBuffer: " + SSLUtils.getBufferTraceInfo(netBuffer)); // depends on control dependency: [if], data = [none]
}
// Check for empty discrimData
if (0 == netBuffer.position()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Received empty discrim data. Returning MAYBE from discriminator."); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "discriminate"); // depends on control dependency: [if], data = [none]
}
// No data to discriminate on.
return Discriminator.MAYBE; // depends on control dependency: [if], data = [none]
}
// Ensure initialize has taken place first.
if (!this.isInitialized) {
try {
init(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception caught while getting SSL connection link: " + e); // depends on control dependency: [if], data = [none]
}
FFDCFilter.processException(e, getClass().getName(), "148", this, new Object[] { vc });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "discriminate"); // depends on control dependency: [if], data = [none]
}
return Discriminator.NO;
} // depends on control dependency: [catch], data = [none]
}
// Initial position of networkBuffer.
int initialNetBufPosition = netBuffer.position();
// Initial limit of networkBuffer.
int initialNetBufLimit = netBuffer.limit();
// Unencrypted buffer from the ssl engine output to be handed up to the application.
WsByteBuffer decryptedNetBuffer = null;
// State map from the VC.
Map<Object, Object> stateMap = vc.getStateMap();
// The SSL engine.
SSLEngine sslEngine = null;
// The SSL context for this connection.
SSLContext vcSSLContext = null;
// Result output from the SSL engine.
SSLEngineResult sslResult = null;
// Result from discrimination.
int result = Discriminator.YES;
// State saved from potentially former call to discriminator for this connection.
SSLDiscriminatorState discState = null;
try {
// Prepare the networkBuffer for the call to unwrap. Align data between pos and lim.
netBuffer.flip(); // depends on control dependency: [try], data = [none]
// Determine if this connection has already been through discrimination once.
discState = (SSLDiscriminatorState) stateMap.get(SSL_DISCRIMINATOR_STATE); // depends on control dependency: [try], data = [none]
if (discState == null) {
// Create the sslContext based on the virtual connection.
vcSSLContext = getSSLContextForInboundLink(null, vc); // depends on control dependency: [if], data = [none]
// This is the first call to discriminate. Build a new SSL engine for this connection.
sslEngine = SSLUtils.getSSLEngine(vcSSLContext, FlowType.INBOUND,
(SSLLinkConfig) vc.getStateMap().get(SSLConnectionLink.LINKCONFIG),
(SSLConnectionLink) getConnectionLink(vc)); // depends on control dependency: [if], data = [none]
// Line up all the buffers needed for a call to unwrap.
decryptedNetBuffer = SSLUtils.allocateByteBuffer(sslEngine.getSession().getApplicationBufferSize(),
getConfig().getDecryptBuffersDirect()); // depends on control dependency: [if], data = [none]
} else {
// This is NOT the first call to discriminate. Extract the ssl engine and context.
sslEngine = discState.getEngine(); // depends on control dependency: [if], data = [none]
vcSSLContext = discState.getSSLContext(); // depends on control dependency: [if], data = [none]
// Extract output buffer used during discrimination.
decryptedNetBuffer = discState.getDecryptedNetBuffer(); // depends on control dependency: [if], data = [none]
}
// Note: Can't call handshake code because we can't write to the client. Unwrap discrim data.
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "before unwrap: \r\n\tnetBuf: " + SSLUtils.getBufferTraceInfo(netBuffer)
+ "\r\n\tdecNetBuf: " + SSLUtils.getBufferTraceInfo(decryptedNetBuffer)); // depends on control dependency: [if], data = [none]
}
// Note, net and decNet buffers will always be one buffer for discrimination.
// Protect JSSE from potential SSL packet sizes that are too big.
int savedLimit = SSLUtils.adjustBufferForJSSE(netBuffer,
sslEngine.getSession().getPacketBufferSize());
// Have the SSL engine inspect the first packet.
sslResult = sslEngine.unwrap(netBuffer.getWrappedByteBuffer(),
decryptedNetBuffer.getWrappedByteBuffer()); // depends on control dependency: [try], data = [none]
// we should be in a handshake stage so I don't expect bytes to be
// produced, but if there are, then the buffer needs to flip
if (0 < sslResult.bytesProduced()) {
decryptedNetBuffer.flip(); // depends on control dependency: [if], data = [none]
}
// If adjustments were made for the JSSE, restore them.
if (-1 != savedLimit) {
netBuffer.limit(savedLimit); // depends on control dependency: [if], data = [savedLimit)]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "after unwrap: \r\n\tnetBuf: " + SSLUtils.getBufferTraceInfo(netBuffer)
+ "\r\n\tdecNetBuf: " + SSLUtils.getBufferTraceInfo(decryptedNetBuffer)
+ "\r\n\tstatus=" + sslResult.getStatus()
+ " HSstatus=" + sslResult.getHandshakeStatus()
+ " consumed=" + sslResult.bytesConsumed()
+ " produced=" + sslResult.bytesProduced()); // depends on control dependency: [if], data = [none]
}
if (sslResult.getStatus() == Status.BUFFER_UNDERFLOW) {
// More data needed to make decision.
result = Discriminator.MAYBE; // depends on control dependency: [if], data = [none]
} else {
result = Discriminator.YES; // depends on control dependency: [if], data = [none]
if (netBuffer.remaining() == 0) {
netBuffer.clear(); // depends on control dependency: [if], data = [none]
}
}
} catch (Throwable t) {
// No FFDC needed. Some exceptions expected and handled elsewhere.
// Input was not SSL.
result = Discriminator.NO;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caught Exception during discriminate: " + t); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
// Take appropriate action based on result to be returned to caller.
switch (result) {
case Discriminator.YES: {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Discriminator returning YES"); // depends on control dependency: [if], data = [none]
}
// Save discriminator state for the ready method.
// Note, if this isn't the first call to discriminator for this connection, the SSL engine and
// decrypted network buffer will already be there. For speed, use single method and all for
// redundant setting of engine and buffer.
// Save the position and limit of networkBuffer since we must return with an unmodified buffer.
// Note, the networkBuffer is reset at the bottom of this method.
if (discState == null) {
discState = new SSLDiscriminatorState(); // depends on control dependency: [if], data = [none]
}
discState.updateState(vcSSLContext, sslEngine, sslResult,
decryptedNetBuffer, netBuffer.position(), netBuffer.limit());
stateMap.put(SSL_DISCRIMINATOR_STATE, discState);
break;
}
case Discriminator.NO: {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Discriminator returning NO"); // depends on control dependency: [if], data = [none]
}
// If this wasn't the first time discriminate was called, clean up the state map.
if (discState != null) {
// Remove reference to discriminator state.
stateMap.remove(SSL_DISCRIMINATOR_STATE); // depends on control dependency: [if], data = [none]
}
if (null != sslEngine) {
// PK13349 - close the discrimination engine
closeEngine(sslEngine); // depends on control dependency: [if], data = [sslEngine)]
}
if (null != decryptedNetBuffer) {
// Release the unwrap output buffer back to the pool.
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Releasing decryptedNetworkBuffer"); // depends on control dependency: [if], data = [none]
}
decryptedNetBuffer.release(); // depends on control dependency: [if], data = [none]
decryptedNetBuffer = null; // depends on control dependency: [if], data = [none]
}
break;
}
default: { // Discriminator.MAYBE
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Discriminator returning MAYBE"); // depends on control dependency: [if], data = [none]
}
// If this is the first time discrimination has run, save the SSL Engine and output buffer in the VC
// Otherwise, the references are already there.
if (discState == null) {
// Note no need to update position and limit since they weren't modified by unwrap.
discState = new SSLDiscriminatorState(); // depends on control dependency: [if], data = [none]
discState.updateState(vcSSLContext, sslEngine, sslResult,
decryptedNetBuffer, netBuffer.position(), netBuffer.limit()); // depends on control dependency: [if], data = [none]
stateMap.put(SSL_DISCRIMINATOR_STATE, discState); // depends on control dependency: [if], data = [none]
}
break;
}
}
// Reset the position and limit of networkBuffer, required by discrimination process.
netBuffer.limit(initialNetBufLimit);
netBuffer.position(initialNetBufPosition);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "discriminate");
}
return result;
} }
|
public class class_name {
private void init(List<CmsRole> roles) {
CmsRole.applySystemRoleOrder(roles);
m_menu = new CmsContextMenu();
m_menu.setAsTableContextMenu(this);
m_container = new IndexedContainer();
for (TableProperty prop : TableProperty.values()) {
m_container.addContainerProperty(prop, prop.getType(), prop.getDefault());
setColumnHeader(prop, prop.getName());
}
setContainerDataSource(m_container);
setItemIconPropertyId(TableProperty.Icon);
setRowHeaderMode(RowHeaderMode.ICON_ONLY);
setColumnWidth(null, 40);
setSelectable(true);
setVisibleColumns(TableProperty.Name, TableProperty.OU);
for (CmsRole role : roles) {
Item item = m_container.addItem(role);
item.getItemProperty(TableProperty.Name).setValue(role.getName(A_CmsUI.get().getLocale()));
item.getItemProperty(TableProperty.Description).setValue(role.getDescription(A_CmsUI.get().getLocale()));
item.getItemProperty(TableProperty.OU).setValue(role.getOuFqn());
}
addItemClickListener(new ItemClickListener() {
private static final long serialVersionUID = 4807195510202231174L;
public void itemClick(ItemClickEvent event) {
setValue(null);
select(event.getItemId());
if (event.getButton().equals(MouseButton.RIGHT) || (event.getPropertyId() == null)) {
m_menu.setEntries(
getMenuEntries(),
Collections.singleton(((CmsRole)getValue()).getId().getStringValue()));
m_menu.openForTable(event, event.getItemId(), event.getPropertyId(), CmsRoleTable.this);
} else if (event.getButton().equals(MouseButton.LEFT)
&& event.getPropertyId().equals(TableProperty.Name)) {
updateApp((CmsRole)getValue());
}
}
});
setCellStyleGenerator(new CellStyleGenerator() {
private static final long serialVersionUID = 1L;
public String getStyle(Table source, Object itemId, Object propertyId) {
if (TableProperty.Name.equals(propertyId)) {
return " " + OpenCmsTheme.HOVER_COLUMN;
}
return "";
}
});
setVisibleColumns(TableProperty.Name, TableProperty.Description, TableProperty.OU);
} }
|
public class class_name {
private void init(List<CmsRole> roles) {
CmsRole.applySystemRoleOrder(roles);
m_menu = new CmsContextMenu();
m_menu.setAsTableContextMenu(this);
m_container = new IndexedContainer();
for (TableProperty prop : TableProperty.values()) {
m_container.addContainerProperty(prop, prop.getType(), prop.getDefault()); // depends on control dependency: [for], data = [prop]
setColumnHeader(prop, prop.getName()); // depends on control dependency: [for], data = [prop]
}
setContainerDataSource(m_container);
setItemIconPropertyId(TableProperty.Icon);
setRowHeaderMode(RowHeaderMode.ICON_ONLY);
setColumnWidth(null, 40);
setSelectable(true);
setVisibleColumns(TableProperty.Name, TableProperty.OU);
for (CmsRole role : roles) {
Item item = m_container.addItem(role);
item.getItemProperty(TableProperty.Name).setValue(role.getName(A_CmsUI.get().getLocale())); // depends on control dependency: [for], data = [role]
item.getItemProperty(TableProperty.Description).setValue(role.getDescription(A_CmsUI.get().getLocale())); // depends on control dependency: [for], data = [role]
item.getItemProperty(TableProperty.OU).setValue(role.getOuFqn()); // depends on control dependency: [for], data = [role]
}
addItemClickListener(new ItemClickListener() {
private static final long serialVersionUID = 4807195510202231174L;
public void itemClick(ItemClickEvent event) {
setValue(null);
select(event.getItemId());
if (event.getButton().equals(MouseButton.RIGHT) || (event.getPropertyId() == null)) {
m_menu.setEntries(
getMenuEntries(),
Collections.singleton(((CmsRole)getValue()).getId().getStringValue())); // depends on control dependency: [if], data = [none]
m_menu.openForTable(event, event.getItemId(), event.getPropertyId(), CmsRoleTable.this); // depends on control dependency: [if], data = [none]
} else if (event.getButton().equals(MouseButton.LEFT)
&& event.getPropertyId().equals(TableProperty.Name)) {
updateApp((CmsRole)getValue()); // depends on control dependency: [if], data = [none]
}
}
});
setCellStyleGenerator(new CellStyleGenerator() {
private static final long serialVersionUID = 1L;
public String getStyle(Table source, Object itemId, Object propertyId) {
if (TableProperty.Name.equals(propertyId)) {
return " " + OpenCmsTheme.HOVER_COLUMN; // depends on control dependency: [if], data = [none]
}
return "";
}
});
setVisibleColumns(TableProperty.Name, TableProperty.Description, TableProperty.OU);
} }
|
public class class_name {
public void setScaleOptions(CmsObject cms, String scaleOptions) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(scaleOptions)) {
m_scaleOptions = "";
if (m_element.element(NODE_SCALE) != null) {
m_element.remove(m_element.element(NODE_SCALE));
}
} else {
m_scaleOptions = scaleOptions;
}
setParameterValue(cms, CmsImageScaler.PARAM_SCALE, scaleOptions);
} }
|
public class class_name {
public void setScaleOptions(CmsObject cms, String scaleOptions) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(scaleOptions)) {
m_scaleOptions = ""; // depends on control dependency: [if], data = [none]
if (m_element.element(NODE_SCALE) != null) {
m_element.remove(m_element.element(NODE_SCALE)); // depends on control dependency: [if], data = [(m_element.element(NODE_SCALE)]
}
} else {
m_scaleOptions = scaleOptions; // depends on control dependency: [if], data = [none]
}
setParameterValue(cms, CmsImageScaler.PARAM_SCALE, scaleOptions);
} }
|
public class class_name {
public static void closeQuietly(Closeable closeable) {
if (closeable == null) return;
try {
closeable.close();
}
catch (IOException ex) {
assert true; // avoid an empty catch
}
} }
|
public class class_name {
public static void closeQuietly(Closeable closeable) {
if (closeable == null) return;
try {
closeable.close(); // depends on control dependency: [try], data = [none]
}
catch (IOException ex) {
assert true; // avoid an empty catch
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static Set<Currency> getAvailableCurrencies() {
Set<Currency> result = new LinkedHashSet<Currency>();
for (String currencyCode : availableCurrencyCodes) {
result.add(Currency.getInstance(currencyCode));
}
return result;
} }
|
public class class_name {
public static Set<Currency> getAvailableCurrencies() {
Set<Currency> result = new LinkedHashSet<Currency>();
for (String currencyCode : availableCurrencyCodes) {
result.add(Currency.getInstance(currencyCode)); // depends on control dependency: [for], data = [currencyCode]
}
return result;
} }
|
public class class_name {
private static void printHelp(final IPluginRepository pr, final String pluginName) {
try {
PluginProxy pp = (PluginProxy) pr.getPlugin(pluginName);
// CPluginProxy pp =
// CPluginFactory.getInstance().getPlugin(sPluginName);
if (pp == null) {
System.out.println("Plugin " + pluginName + " does not exists.");
} else {
pp.printHelp();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.exit(0);
} }
|
public class class_name {
private static void printHelp(final IPluginRepository pr, final String pluginName) {
try {
PluginProxy pp = (PluginProxy) pr.getPlugin(pluginName);
// CPluginProxy pp =
// CPluginFactory.getInstance().getPlugin(sPluginName);
if (pp == null) {
System.out.println("Plugin " + pluginName + " does not exists."); // depends on control dependency: [if], data = [none]
} else {
pp.printHelp(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
System.exit(0);
} }
|
public class class_name {
private static Method getCachedMethod(MethodDescriptor md) {
if (CACHE_METHODS) {
Reference<Method> methodRef = cache.get(md);
if (methodRef != null) {
return methodRef.get();
}
}
return null;
} }
|
public class class_name {
private static Method getCachedMethod(MethodDescriptor md) {
if (CACHE_METHODS) {
Reference<Method> methodRef = cache.get(md);
if (methodRef != null) {
return methodRef.get();
// depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
@Override
public KamInfo getKamInfo(String kamName) {
if (kamName == null) throw new InvalidArgument(DEFAULT_MSG);
if (!exists(kamName)) return null;
try {
return kamCatalogDao().getKamInfoByName(kamName);
} catch (SQLException e) {
final String msg = "error getting KAM info by name";
throw new KAMStoreException(msg, e);
}
} }
|
public class class_name {
@Override
public KamInfo getKamInfo(String kamName) {
if (kamName == null) throw new InvalidArgument(DEFAULT_MSG);
if (!exists(kamName)) return null;
try {
return kamCatalogDao().getKamInfoByName(kamName); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
final String msg = "error getting KAM info by name";
throw new KAMStoreException(msg, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void updateDecorationPainterUnclippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) {
Rectangle decorationBoundsInLayeredPane;
if (layeredPane == null) {
decorationBoundsInLayeredPane = new Rectangle();
} else {
// Calculate location of the decorated component in the layered pane containing the decoration painter
Point decoratedComponentLocationInLayeredPane = SwingUtilities.convertPoint(decoratedComponent.getParent
(), decoratedComponent.getLocation(), layeredPane);
// Deduces the location of the decoration painter in the layered pane
decorationBoundsInLayeredPane = new Rectangle(decoratedComponentLocationInLayeredPane.x +
relativeLocationToOwner.x, decoratedComponentLocationInLayeredPane.y + relativeLocationToOwner.y,
getWidth(), getHeight());
}
// Update decoration painter
decorationPainter.setBounds(decorationBoundsInLayeredPane);
} }
|
public class class_name {
private void updateDecorationPainterUnclippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) {
Rectangle decorationBoundsInLayeredPane;
if (layeredPane == null) {
decorationBoundsInLayeredPane = new Rectangle(); // depends on control dependency: [if], data = [none]
} else {
// Calculate location of the decorated component in the layered pane containing the decoration painter
Point decoratedComponentLocationInLayeredPane = SwingUtilities.convertPoint(decoratedComponent.getParent
(), decoratedComponent.getLocation(), layeredPane);
// Deduces the location of the decoration painter in the layered pane
decorationBoundsInLayeredPane = new Rectangle(decoratedComponentLocationInLayeredPane.x +
relativeLocationToOwner.x, decoratedComponentLocationInLayeredPane.y + relativeLocationToOwner.y,
getWidth(), getHeight()); // depends on control dependency: [if], data = [none]
}
// Update decoration painter
decorationPainter.setBounds(decorationBoundsInLayeredPane);
} }
|
public class class_name {
public String wrap(String content, String selector, String wrapHtml, int amount) {
Element body = parseContent(content);
List<Element> elements = body.select(selector);
if (amount >= 0) {
// limit to the indicated amount
elements = elements.subList(0, Math.min(amount, elements.size()));
}
if (elements.size() > 0) {
for (Element element : elements) {
element.wrap(wrapHtml);
}
return body.html();
} else {
// nothing to update
return content;
}
} }
|
public class class_name {
public String wrap(String content, String selector, String wrapHtml, int amount) {
Element body = parseContent(content);
List<Element> elements = body.select(selector);
if (amount >= 0) {
// limit to the indicated amount
elements = elements.subList(0, Math.min(amount, elements.size())); // depends on control dependency: [if], data = [(amount]
}
if (elements.size() > 0) {
for (Element element : elements) {
element.wrap(wrapHtml); // depends on control dependency: [for], data = [element]
}
return body.html(); // depends on control dependency: [if], data = [none]
} else {
// nothing to update
return content; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void jacobian_Control3( DMatrixRMaj L_full ,
double beta[] , DMatrixRMaj A)
{
int indexA = 0;
double b0 = beta[0]; double b1 = beta[1]; double b2 = beta[2];
final double ld[] = L_full.data;
for( int i = 0; i < 3; i++ ) {
int li = L_full.numCols*i;
A.data[indexA++] = 2*ld[li+0]*b0 + ld[li+1]*b1 + ld[li+2]*b2;
A.data[indexA++] = ld[li+1]*b0 + 2*ld[li+3]*b1 + ld[li+4]*b2;
A.data[indexA++] = ld[li+2]*b0 + ld[li+4]*b1 + 2*ld[li+5]*b2;
}
} }
|
public class class_name {
public static void jacobian_Control3( DMatrixRMaj L_full ,
double beta[] , DMatrixRMaj A)
{
int indexA = 0;
double b0 = beta[0]; double b1 = beta[1]; double b2 = beta[2];
final double ld[] = L_full.data;
for( int i = 0; i < 3; i++ ) {
int li = L_full.numCols*i;
A.data[indexA++] = 2*ld[li+0]*b0 + ld[li+1]*b1 + ld[li+2]*b2; // depends on control dependency: [for], data = [none]
A.data[indexA++] = ld[li+1]*b0 + 2*ld[li+3]*b1 + ld[li+4]*b2; // depends on control dependency: [for], data = [none]
A.data[indexA++] = ld[li+2]*b0 + ld[li+4]*b1 + 2*ld[li+5]*b2; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
private Map<String,String> getBasicSystemConfig() {
Map<String,String> map = new HashMap<String,String>();
// Job & Task
if (this.isLocalMode)
map.put(JOB_FACTORY_CLASS_KEY, LocalJobFactory.class.getName());
else {
map.put(JOB_FACTORY_CLASS_KEY, YarnJobFactory.class.getName());
// yarn
map.put(YARN_PACKAGE_KEY,jarPath);
map.put(CONTAINER_MEMORY_KEY, Integer.toString(this.containerMemory));
map.put(AM_MEMORY_KEY, Integer.toString(this.amMemory));
map.put(CONTAINER_COUNT_KEY, "1");
map.put(YARN_CONF_HOME_KEY, SystemsUtils.getHadoopConfigHome());
// Task opts (Heap size = 0.75 container memory)
int heapSize = (int)(0.75*this.containerMemory);
map.put("task.opts", "-Xmx"+Integer.toString(heapSize)+"M -XX:+PrintGCDateStamps");
}
map.put(JOB_NAME_KEY, "");
map.put(TASK_CLASS_KEY, "");
map.put(TASK_INPUTS_KEY, "");
// register serializer
map.put("serializers.registry.kryo.class",SamzaKryoSerdeFactory.class.getName());
// Serde registration
setKryoRegistration(map, this.kryoRegisterFile);
return map;
} }
|
public class class_name {
private Map<String,String> getBasicSystemConfig() {
Map<String,String> map = new HashMap<String,String>();
// Job & Task
if (this.isLocalMode)
map.put(JOB_FACTORY_CLASS_KEY, LocalJobFactory.class.getName());
else {
map.put(JOB_FACTORY_CLASS_KEY, YarnJobFactory.class.getName()); // depends on control dependency: [if], data = [none]
// yarn
map.put(YARN_PACKAGE_KEY,jarPath); // depends on control dependency: [if], data = [none]
map.put(CONTAINER_MEMORY_KEY, Integer.toString(this.containerMemory)); // depends on control dependency: [if], data = [none]
map.put(AM_MEMORY_KEY, Integer.toString(this.amMemory)); // depends on control dependency: [if], data = [none]
map.put(CONTAINER_COUNT_KEY, "1"); // depends on control dependency: [if], data = [none]
map.put(YARN_CONF_HOME_KEY, SystemsUtils.getHadoopConfigHome()); // depends on control dependency: [if], data = [none]
// Task opts (Heap size = 0.75 container memory)
int heapSize = (int)(0.75*this.containerMemory);
map.put("task.opts", "-Xmx"+Integer.toString(heapSize)+"M -XX:+PrintGCDateStamps"); // depends on control dependency: [if], data = [none]
}
map.put(JOB_NAME_KEY, "");
map.put(TASK_CLASS_KEY, "");
map.put(TASK_INPUTS_KEY, "");
// register serializer
map.put("serializers.registry.kryo.class",SamzaKryoSerdeFactory.class.getName());
// Serde registration
setKryoRegistration(map, this.kryoRegisterFile);
return map;
} }
|
public class class_name {
public void generateParseOnJacksonInternal(BindTypeContext context, Builder methodBuilder, String parserName, TypeName beanClass, String beanName, BindProperty property, boolean onString) {
// define key and value type
ParameterizedTypeName mapTypeName=(ParameterizedTypeName) property.getPropertyType().getTypeName();
TypeName keyTypeName = mapTypeName.typeArguments.get(0);
TypeName valueTypeName = mapTypeName.typeArguments.get(1);
//@formatter:off
methodBuilder.beginControlFlow("if ($L.currentToken()==$T.START_ARRAY)", parserName, JsonToken.class);
methodBuilder.addStatement("$T<$T, $T> collection=new $T<>()", defineMapClass(mapTypeName), keyTypeName, valueTypeName, defineMapClass(mapTypeName));
BindTransform transformKey=BindTransformer.lookup(keyTypeName);
BindProperty elementKeyProperty=BindProperty.builder(keyTypeName, property).inCollection(false).xmlType(property.xmlInfo.mapEntryType.toXmlType()).elementName(property.mapKeyName).nullable(false).build();
BindTransform transformValue=BindTransformer.lookup(valueTypeName);
BindProperty elementValueProperty=BindProperty.builder(valueTypeName, property).inCollection(false).xmlType(property.xmlInfo.mapEntryType.toXmlType()).elementName(property.mapValueName).nullable(true).build();
methodBuilder.addStatement("$T key=$L", elementKeyProperty.getPropertyType().getTypeName(), DEFAULT_VALUE);
methodBuilder.addStatement("$T value=$L", elementValueProperty.getPropertyType().getTypeName(), DEFAULT_VALUE);
if (onString) {
methodBuilder.addStatement("$T current", JsonToken.class);
methodBuilder.addStatement("String tempValue=null");
}
methodBuilder.beginControlFlow("while ($L.nextToken() != $T.END_ARRAY)", parserName, JsonToken.class);
if (onString) {
// on string
methodBuilder.addStatement("current=$L.currentToken()", parserName);
methodBuilder.beginControlFlow("for (int i=0; i<2 ;i++)");
methodBuilder.beginControlFlow("while (current != $T.FIELD_NAME)",JsonToken.class);
methodBuilder.addStatement("current=$L.nextToken()", parserName);
methodBuilder.endControlFlow();
methodBuilder.addStatement("$L.nextValue()", parserName);
//
methodBuilder.addCode("switch(jacksonParser.getCurrentName()) {\n");
methodBuilder.addCode("case $S:$>\n", property.mapKeyName);
transformKey.generateParseOnJacksonAsString(context, methodBuilder, parserName, null, "key", elementKeyProperty);
methodBuilder.addStatement("$<break");
methodBuilder.addCode("case $S:$>\n", property.mapValueName);
methodBuilder.addStatement("tempValue=$L.getValueAsString()", parserName);
methodBuilder.beginControlFlow("if ($L.currentToken()==$T.VALUE_STRING && \"null\".equals(tempValue))", parserName, JsonToken.class);
methodBuilder.addStatement("value=$L", DEFAULT_VALUE);
methodBuilder.nextControlFlow("else");
transformValue.generateParseOnJacksonAsString(context, methodBuilder, parserName, null, "value", elementValueProperty);
methodBuilder.endControlFlow();
methodBuilder.addStatement("$<break");
methodBuilder.addCode("}\n");
//
methodBuilder.endControlFlow();
} else {
// key
methodBuilder.addStatement("$L.nextValue()", parserName);
transformKey.generateParseOnJackson(context, methodBuilder, parserName, null, "key", elementKeyProperty);
// value
methodBuilder.addStatement("$L.nextValue()", parserName);
transformValue.generateParseOnJackson(context, methodBuilder, parserName, null, "value", elementValueProperty);
}
methodBuilder.addStatement("collection.put(key, value)");
methodBuilder.addStatement("key=$L", DEFAULT_VALUE);
methodBuilder.addStatement("value=$L" , DEFAULT_VALUE);
methodBuilder.addStatement("$L.nextToken()", parserName);
methodBuilder.endControlFlow();
methodBuilder.addStatement(setter(beanClass, beanName, property, "collection"));
methodBuilder.endControlFlow();
//@formatter:on
} }
|
public class class_name {
public void generateParseOnJacksonInternal(BindTypeContext context, Builder methodBuilder, String parserName, TypeName beanClass, String beanName, BindProperty property, boolean onString) {
// define key and value type
ParameterizedTypeName mapTypeName=(ParameterizedTypeName) property.getPropertyType().getTypeName();
TypeName keyTypeName = mapTypeName.typeArguments.get(0);
TypeName valueTypeName = mapTypeName.typeArguments.get(1);
//@formatter:off
methodBuilder.beginControlFlow("if ($L.currentToken()==$T.START_ARRAY)", parserName, JsonToken.class);
methodBuilder.addStatement("$T<$T, $T> collection=new $T<>()", defineMapClass(mapTypeName), keyTypeName, valueTypeName, defineMapClass(mapTypeName));
BindTransform transformKey=BindTransformer.lookup(keyTypeName);
BindProperty elementKeyProperty=BindProperty.builder(keyTypeName, property).inCollection(false).xmlType(property.xmlInfo.mapEntryType.toXmlType()).elementName(property.mapKeyName).nullable(false).build();
BindTransform transformValue=BindTransformer.lookup(valueTypeName);
BindProperty elementValueProperty=BindProperty.builder(valueTypeName, property).inCollection(false).xmlType(property.xmlInfo.mapEntryType.toXmlType()).elementName(property.mapValueName).nullable(true).build();
methodBuilder.addStatement("$T key=$L", elementKeyProperty.getPropertyType().getTypeName(), DEFAULT_VALUE);
methodBuilder.addStatement("$T value=$L", elementValueProperty.getPropertyType().getTypeName(), DEFAULT_VALUE);
if (onString) {
methodBuilder.addStatement("$T current", JsonToken.class); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("String tempValue=null"); // depends on control dependency: [if], data = [none]
}
methodBuilder.beginControlFlow("while ($L.nextToken() != $T.END_ARRAY)", parserName, JsonToken.class);
if (onString) {
// on string
methodBuilder.addStatement("current=$L.currentToken()", parserName); // depends on control dependency: [if], data = [none]
methodBuilder.beginControlFlow("for (int i=0; i<2 ;i++)"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
methodBuilder.beginControlFlow("while (current != $T.FIELD_NAME)",JsonToken.class); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("current=$L.nextToken()", parserName); // depends on control dependency: [if], data = [none]
methodBuilder.endControlFlow(); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("$L.nextValue()", parserName); // depends on control dependency: [if], data = [none]
//
methodBuilder.addCode("switch(jacksonParser.getCurrentName()) {\n"); // depends on control dependency: [if], data = [none]
methodBuilder.addCode("case $S:$>\n", property.mapKeyName); // depends on control dependency: [if], data = [none]
transformKey.generateParseOnJacksonAsString(context, methodBuilder, parserName, null, "key", elementKeyProperty); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("$<break");
methodBuilder.addCode("case $S:$>\n", property.mapValueName); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("tempValue=$L.getValueAsString()", parserName); // depends on control dependency: [if], data = [none]
methodBuilder.beginControlFlow("if ($L.currentToken()==$T.VALUE_STRING && \"null\".equals(tempValue))", parserName, JsonToken.class); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("value=$L", DEFAULT_VALUE); // depends on control dependency: [if], data = [none]
methodBuilder.nextControlFlow("else"); // depends on control dependency: [if], data = [none]
transformValue.generateParseOnJacksonAsString(context, methodBuilder, parserName, null, "value", elementValueProperty); // depends on control dependency: [if], data = [none]
methodBuilder.endControlFlow(); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("$<break");
methodBuilder.addCode("}\n"); // depends on control dependency: [if], data = [none]
//
methodBuilder.endControlFlow(); // depends on control dependency: [if], data = [none]
} else {
// key
methodBuilder.addStatement("$L.nextValue()", parserName); // depends on control dependency: [if], data = [none]
transformKey.generateParseOnJackson(context, methodBuilder, parserName, null, "key", elementKeyProperty); // depends on control dependency: [if], data = [none]
// value
methodBuilder.addStatement("$L.nextValue()", parserName); // depends on control dependency: [if], data = [none]
transformValue.generateParseOnJackson(context, methodBuilder, parserName, null, "value", elementValueProperty); // depends on control dependency: [if], data = [none]
}
methodBuilder.addStatement("collection.put(key, value)");
methodBuilder.addStatement("key=$L", DEFAULT_VALUE);
methodBuilder.addStatement("value=$L" , DEFAULT_VALUE);
methodBuilder.addStatement("$L.nextToken()", parserName);
methodBuilder.endControlFlow();
methodBuilder.addStatement(setter(beanClass, beanName, property, "collection"));
methodBuilder.endControlFlow();
//@formatter:on
} }
|
public class class_name {
public static List<ListNumber> dft(ListNumber x, ListNumber y) {
if (x.size() != y.size()) {
throw new IllegalArgumentException("Real and imaginary part must be of the same length");
}
double cosarg,sinarg;
double[] resX = new double[x.size()];
double[] resY = new double[x.size()];
int direction = 1; // -1 would be inverse
double size = x.size();
for (int i = 0; i < x.size(); i++) {
double arg = - direction * 2.0 * Math.PI * (double) i / size;
for (int k = 0; k < x.size(); k++) {
cosarg = Math.cos(k * arg);
sinarg = Math.sin(k * arg);
resX[i] += (x.getDouble(k) * cosarg - y.getDouble(k) * sinarg);
resY[i] += (x.getDouble(k) * sinarg + y.getDouble(k) * cosarg);
}
}
if (direction == 1) {
for (int i = 0; i < x.size(); i++) {
resX[i] = resX[i] / size;
resY[i] = resY[i] / size;
}
return Arrays.<ListNumber>asList(new ArrayDouble(resX), new ArrayDouble(resY));
} else {
return Arrays.<ListNumber>asList(new ArrayDouble(resY), new ArrayDouble(resX));
}
} }
|
public class class_name {
public static List<ListNumber> dft(ListNumber x, ListNumber y) {
if (x.size() != y.size()) {
throw new IllegalArgumentException("Real and imaginary part must be of the same length");
}
double cosarg,sinarg;
double[] resX = new double[x.size()];
double[] resY = new double[x.size()];
int direction = 1; // -1 would be inverse
double size = x.size();
for (int i = 0; i < x.size(); i++) {
double arg = - direction * 2.0 * Math.PI * (double) i / size;
for (int k = 0; k < x.size(); k++) {
cosarg = Math.cos(k * arg);
// depends on control dependency: [for], data = [k]
sinarg = Math.sin(k * arg);
// depends on control dependency: [for], data = [k]
resX[i] += (x.getDouble(k) * cosarg - y.getDouble(k) * sinarg);
// depends on control dependency: [for], data = [k]
resY[i] += (x.getDouble(k) * sinarg + y.getDouble(k) * cosarg);
// depends on control dependency: [for], data = [k]
}
}
if (direction == 1) {
for (int i = 0; i < x.size(); i++) {
resX[i] = resX[i] / size;
// depends on control dependency: [for], data = [i]
resY[i] = resY[i] / size;
// depends on control dependency: [for], data = [i]
}
return Arrays.<ListNumber>asList(new ArrayDouble(resX), new ArrayDouble(resY));
// depends on control dependency: [if], data = [none]
} else {
return Arrays.<ListNumber>asList(new ArrayDouble(resY), new ArrayDouble(resX));
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static final boolean isMultipartContent(HttpServletRequest request) {
if (!RestConst.POST_METHOD.equalsIgnoreCase(request.getMethod())) {
return false;
}
String contentType = request.getContentType();
if (contentType == null) {
return false;
}
contentType = contentType.toLowerCase(Locale.ENGLISH);
if (contentType.startsWith(RestConst.MULTIPART)
|| MediaType.APPLICATION_OCTET_STREAM.equals(contentType)) {
return true;
}
return false;
} }
|
public class class_name {
public static final boolean isMultipartContent(HttpServletRequest request) {
if (!RestConst.POST_METHOD.equalsIgnoreCase(request.getMethod())) {
return false; // depends on control dependency: [if], data = [none]
}
String contentType = request.getContentType();
if (contentType == null) {
return false; // depends on control dependency: [if], data = [none]
}
contentType = contentType.toLowerCase(Locale.ENGLISH);
if (contentType.startsWith(RestConst.MULTIPART)
|| MediaType.APPLICATION_OCTET_STREAM.equals(contentType)) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public static void copy(Message from, HttpMessage to) {
HttpMessage source;
if (from instanceof HttpMessage) {
source = (HttpMessage) from;
} else {
source = new HttpMessage(from);
}
copy(source, to);
} }
|
public class class_name {
public static void copy(Message from, HttpMessage to) {
HttpMessage source;
if (from instanceof HttpMessage) {
source = (HttpMessage) from; // depends on control dependency: [if], data = [none]
} else {
source = new HttpMessage(from); // depends on control dependency: [if], data = [none]
}
copy(source, to);
} }
|
public class class_name {
public static String getServerPort() {
String ret = getLatkeProperty("serverPort");
if (null == ret) {
final RequestContext requestContext = REQUEST_CONTEXT.get();
if (null != requestContext) {
ret = requestContext.getRequest().getServerPort() + "";
}
}
return ret;
} }
|
public class class_name {
public static String getServerPort() {
String ret = getLatkeProperty("serverPort");
if (null == ret) {
final RequestContext requestContext = REQUEST_CONTEXT.get();
if (null != requestContext) {
ret = requestContext.getRequest().getServerPort() + ""; // depends on control dependency: [if], data = [none]
}
}
return ret;
} }
|
public class class_name {
public T header(Resource resource, Charset charset) {
try {
getMessageContentBuilder().getHeaderData().add(FileUtils.readToString(resource, charset));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read header resource", e);
}
return self;
} }
|
public class class_name {
public T header(Resource resource, Charset charset) {
try {
getMessageContentBuilder().getHeaderData().add(FileUtils.readToString(resource, charset)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read header resource", e);
} // depends on control dependency: [catch], data = [none]
return self;
} }
|
public class class_name {
public void marshall(UserPhoneConfig userPhoneConfig, ProtocolMarshaller protocolMarshaller) {
if (userPhoneConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userPhoneConfig.getPhoneType(), PHONETYPE_BINDING);
protocolMarshaller.marshall(userPhoneConfig.getAutoAccept(), AUTOACCEPT_BINDING);
protocolMarshaller.marshall(userPhoneConfig.getAfterContactWorkTimeLimit(), AFTERCONTACTWORKTIMELIMIT_BINDING);
protocolMarshaller.marshall(userPhoneConfig.getDeskPhoneNumber(), DESKPHONENUMBER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UserPhoneConfig userPhoneConfig, ProtocolMarshaller protocolMarshaller) {
if (userPhoneConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userPhoneConfig.getPhoneType(), PHONETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPhoneConfig.getAutoAccept(), AUTOACCEPT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPhoneConfig.getAfterContactWorkTimeLimit(), AFTERCONTACTWORKTIMELIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPhoneConfig.getDeskPhoneNumber(), DESKPHONENUMBER_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 retryOperation(Operation op) {
if (retryQueueSize >= 0 && retryOps.size() >= retryQueueSize) {
if (!op.isCancelled()) {
op.cancel();
}
}
retryOps.add(op);
} }
|
public class class_name {
public void retryOperation(Operation op) {
if (retryQueueSize >= 0 && retryOps.size() >= retryQueueSize) {
if (!op.isCancelled()) {
op.cancel(); // depends on control dependency: [if], data = [none]
}
}
retryOps.add(op);
} }
|
public class class_name {
protected boolean translateCommand( StringBuilder buf, String pattern, int index, boolean oldInside ) {
char firstChar = pattern.charAt( index );
boolean newInside = oldInside;
//O and E are modifiers, they mean to present an alternative representation of the next char
//we just handle the next char as if the O or E wasn't there
if ( firstChar == 'O' || firstChar == 'E' ) {
if ( index + 1 < pattern.length() ) {
newInside = translateCommand( buf, pattern, index + 1, oldInside );
} else {
buf.append( quote("%" + firstChar, oldInside ) );
}
} else {
String command = translate.getProperty( String.valueOf( firstChar ) );
//If we don't find a format, treat it as a literal--That's what apache does
if ( command == null ) {
buf.append( quote( "%" + firstChar, oldInside ) );
} else {
//If we were inside quotes, close the quotes
if ( oldInside ) {
buf.append( '\'' );
}
buf.append( command );
newInside = false;
}
}
return newInside;
} }
|
public class class_name {
protected boolean translateCommand( StringBuilder buf, String pattern, int index, boolean oldInside ) {
char firstChar = pattern.charAt( index );
boolean newInside = oldInside;
//O and E are modifiers, they mean to present an alternative representation of the next char
//we just handle the next char as if the O or E wasn't there
if ( firstChar == 'O' || firstChar == 'E' ) {
if ( index + 1 < pattern.length() ) {
newInside = translateCommand( buf, pattern, index + 1, oldInside ); // depends on control dependency: [if], data = [none]
} else {
buf.append( quote("%" + firstChar, oldInside ) ); // depends on control dependency: [if], data = [none]
}
} else {
String command = translate.getProperty( String.valueOf( firstChar ) );
//If we don't find a format, treat it as a literal--That's what apache does
if ( command == null ) {
buf.append( quote( "%" + firstChar, oldInside ) ); // depends on control dependency: [if], data = [none]
} else {
//If we were inside quotes, close the quotes
if ( oldInside ) {
buf.append( '\'' ); // depends on control dependency: [if], data = [none]
}
buf.append( command ); // depends on control dependency: [if], data = [( command]
newInside = false; // depends on control dependency: [if], data = [none]
}
}
return newInside;
} }
|
public class class_name {
void localTransactionRolledBack(final SibRaConnection connection) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "localTransactionRolledBack", connection);
}
final ConnectionEvent event = new ConnectionEvent(this,
ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
event.setConnectionHandle(connection);
for (Iterator iterator = _eventListeners.iterator(); iterator.hasNext();) {
final ConnectionEventListener listener = (ConnectionEventListener) iterator
.next();
listener.localTransactionRolledback(event);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "localTransactionRolledBack");
}
} }
|
public class class_name {
void localTransactionRolledBack(final SibRaConnection connection) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "localTransactionRolledBack", connection); // depends on control dependency: [if], data = [none]
}
final ConnectionEvent event = new ConnectionEvent(this,
ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
event.setConnectionHandle(connection);
for (Iterator iterator = _eventListeners.iterator(); iterator.hasNext();) {
final ConnectionEventListener listener = (ConnectionEventListener) iterator
.next();
listener.localTransactionRolledback(event); // depends on control dependency: [for], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "localTransactionRolledBack"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(IotAnalyticsAction iotAnalyticsAction, ProtocolMarshaller protocolMarshaller) {
if (iotAnalyticsAction == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(iotAnalyticsAction.getChannelArn(), CHANNELARN_BINDING);
protocolMarshaller.marshall(iotAnalyticsAction.getChannelName(), CHANNELNAME_BINDING);
protocolMarshaller.marshall(iotAnalyticsAction.getRoleArn(), ROLEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(IotAnalyticsAction iotAnalyticsAction, ProtocolMarshaller protocolMarshaller) {
if (iotAnalyticsAction == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(iotAnalyticsAction.getChannelArn(), CHANNELARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(iotAnalyticsAction.getChannelName(), CHANNELNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(iotAnalyticsAction.getRoleArn(), ROLEARN_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 int[] selectBestPair( SceneStructureMetric structure ) {
Se3_F64 w_to_0 = structure.views[0].worldToView;
Se3_F64 w_to_1 = structure.views[1].worldToView;
Se3_F64 w_to_2 = structure.views[2].worldToView;
Se3_F64 view0_to_1 = w_to_0.invert(null).concat(w_to_1,null);
Se3_F64 view0_to_2 = w_to_0.invert(null).concat(w_to_2,null);
Se3_F64 view1_to_2 = w_to_1.invert(null).concat(w_to_2,null);
Se3_F64 candidates[] = new Se3_F64[]{view0_to_1,view0_to_2,view1_to_2};
int best = -1;
double bestScore = Double.MAX_VALUE;
for (int i = 0; i < candidates.length; i++) {
double s = score(candidates[i]);
System.out.println("stereo score["+i+"] = "+s);
if( s < bestScore ) {
bestScore = s;
best = i;
}
}
switch (best) {
case 0: return new int[]{0,1};
case 1: return new int[]{0,2};
case 2: return new int[]{1,2};
}
throw new RuntimeException("BUG!");
} }
|
public class class_name {
private int[] selectBestPair( SceneStructureMetric structure ) {
Se3_F64 w_to_0 = structure.views[0].worldToView;
Se3_F64 w_to_1 = structure.views[1].worldToView;
Se3_F64 w_to_2 = structure.views[2].worldToView;
Se3_F64 view0_to_1 = w_to_0.invert(null).concat(w_to_1,null);
Se3_F64 view0_to_2 = w_to_0.invert(null).concat(w_to_2,null);
Se3_F64 view1_to_2 = w_to_1.invert(null).concat(w_to_2,null);
Se3_F64 candidates[] = new Se3_F64[]{view0_to_1,view0_to_2,view1_to_2};
int best = -1;
double bestScore = Double.MAX_VALUE;
for (int i = 0; i < candidates.length; i++) {
double s = score(candidates[i]);
System.out.println("stereo score["+i+"] = "+s); // depends on control dependency: [for], data = [i]
if( s < bestScore ) {
bestScore = s; // depends on control dependency: [if], data = [none]
best = i; // depends on control dependency: [if], data = [none]
}
}
switch (best) {
case 0: return new int[]{0,1};
case 1: return new int[]{0,2};
case 2: return new int[]{1,2};
}
throw new RuntimeException("BUG!");
} }
|
public class class_name {
@Override
public void reset(final long mNodeKey) {
super.reset(mNodeKey);
if (mSourceExpr != null) {
mSourceExpr.reset(mNodeKey);
}
} }
|
public class class_name {
@Override
public void reset(final long mNodeKey) {
super.reset(mNodeKey);
if (mSourceExpr != null) {
mSourceExpr.reset(mNodeKey); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getText() {
String text = getElement().getText();
if (text.isEmpty()) {
text = getValue();
}
return text;
} }
|
public class class_name {
public String getText() {
String text = getElement().getText();
if (text.isEmpty()) {
text = getValue(); // depends on control dependency: [if], data = [none]
}
return text;
} }
|
public class class_name {
protected Response createResponse(WebApplicationException exception) {
Response response = exception.getResponse();
int statusCode = response.getStatus();
Status status = Status.fromStatusCode(statusCode);
NlsRuntimeException error;
if (exception instanceof ServerErrorException) {
error = new TechnicalErrorUserException(exception);
LOG.error("Service failed on server", error);
return createResponse(status, error, null);
} else {
UUID uuid = UUID.randomUUID();
if (exception instanceof ClientErrorException) {
LOG.warn("Service failed due to unexpected request. UUDI: {}, reason: {} ", uuid, exception.getMessage());
} else {
LOG.warn("Service caused redirect or other error. UUID: {}, reason: {}", uuid, exception.getMessage());
}
return createResponse(status, exception.getMessage(), String.valueOf(statusCode), uuid, null);
}
} }
|
public class class_name {
protected Response createResponse(WebApplicationException exception) {
Response response = exception.getResponse();
int statusCode = response.getStatus();
Status status = Status.fromStatusCode(statusCode);
NlsRuntimeException error;
if (exception instanceof ServerErrorException) {
error = new TechnicalErrorUserException(exception); // depends on control dependency: [if], data = [none]
LOG.error("Service failed on server", error); // depends on control dependency: [if], data = [none]
return createResponse(status, error, null); // depends on control dependency: [if], data = [none]
} else {
UUID uuid = UUID.randomUUID();
if (exception instanceof ClientErrorException) {
LOG.warn("Service failed due to unexpected request. UUDI: {}, reason: {} ", uuid, exception.getMessage()); // depends on control dependency: [if], data = [none]
} else {
LOG.warn("Service caused redirect or other error. UUID: {}, reason: {}", uuid, exception.getMessage()); // depends on control dependency: [if], data = [none]
}
return createResponse(status, exception.getMessage(), String.valueOf(statusCode), uuid, null); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void set (final float values[])
{
this.m_nRows = values.length;
this.m_nCols = 1;
this.m_aValues = new float [m_nRows] [1];
for (int r = 0; r < m_nRows; ++r)
{
this.m_aValues[r][0] = values[r];
}
} }
|
public class class_name {
protected void set (final float values[])
{
this.m_nRows = values.length;
this.m_nCols = 1;
this.m_aValues = new float [m_nRows] [1];
for (int r = 0; r < m_nRows; ++r)
{
this.m_aValues[r][0] = values[r]; // depends on control dependency: [for], data = [r]
}
} }
|
public class class_name {
public UriTemplateBuilder template(String... template) {
UriTemplateParser parser = new UriTemplateParser();
for(String t : template) {
addComponents(parser.scan(t));
}
return this;
} }
|
public class class_name {
public UriTemplateBuilder template(String... template) {
UriTemplateParser parser = new UriTemplateParser();
for(String t : template) {
addComponents(parser.scan(t)); // depends on control dependency: [for], data = [t]
}
return this;
} }
|
public class class_name {
public static String getConstantName(Object value, Class c) {
for (Field f : c.getDeclaredFields()) {
int mod = f.getModifiers();
if (Modifier.isStatic(mod) && Modifier.isPublic(mod) && Modifier.isFinal(mod)) {
try {
if (f.get(null).equals(value)) {
return f.getName();
}
} catch (IllegalAccessException e) {
return String.valueOf(value);
}
}
}
return String.valueOf(value);
} }
|
public class class_name {
public static String getConstantName(Object value, Class c) {
for (Field f : c.getDeclaredFields()) {
int mod = f.getModifiers();
if (Modifier.isStatic(mod) && Modifier.isPublic(mod) && Modifier.isFinal(mod)) {
try {
if (f.get(null).equals(value)) {
return f.getName(); // depends on control dependency: [if], data = [none]
}
} catch (IllegalAccessException e) {
return String.valueOf(value);
} // depends on control dependency: [catch], data = [none]
}
}
return String.valueOf(value);
} }
|
public class class_name {
public AwsSecurityFindingFilters withWorkflowState(StringFilter... workflowState) {
if (this.workflowState == null) {
setWorkflowState(new java.util.ArrayList<StringFilter>(workflowState.length));
}
for (StringFilter ele : workflowState) {
this.workflowState.add(ele);
}
return this;
} }
|
public class class_name {
public AwsSecurityFindingFilters withWorkflowState(StringFilter... workflowState) {
if (this.workflowState == null) {
setWorkflowState(new java.util.ArrayList<StringFilter>(workflowState.length)); // depends on control dependency: [if], data = [none]
}
for (StringFilter ele : workflowState) {
this.workflowState.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
static void getAllVarsDeclaredInFunction(
final Map<String, Var> nameVarMap,
final List<Var> orderedVars,
AbstractCompiler compiler,
ScopeCreator scopeCreator,
final Scope scope) {
checkState(nameVarMap.isEmpty());
checkState(orderedVars.isEmpty());
checkState(scope.isFunctionScope(), scope);
ScopedCallback finder =
new ScopedCallback() {
@Override
public void enterScope(NodeTraversal t) {
Scope currentScope = t.getScope();
for (Var v : currentScope.getVarIterable()) {
nameVarMap.put(v.getName(), v);
orderedVars.add(v);
}
}
@Override
public void exitScope(NodeTraversal t) {}
@Override
public final boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
// Don't enter any new functions
return !n.isFunction() || n == scope.getRootNode();
}
@Override
public void visit(NodeTraversal t, Node n, Node parent) {}
};
NodeTraversal t = new NodeTraversal(compiler, finder, scopeCreator);
t.traverseAtScope(scope);
} }
|
public class class_name {
static void getAllVarsDeclaredInFunction(
final Map<String, Var> nameVarMap,
final List<Var> orderedVars,
AbstractCompiler compiler,
ScopeCreator scopeCreator,
final Scope scope) {
checkState(nameVarMap.isEmpty());
checkState(orderedVars.isEmpty());
checkState(scope.isFunctionScope(), scope);
ScopedCallback finder =
new ScopedCallback() {
@Override
public void enterScope(NodeTraversal t) {
Scope currentScope = t.getScope();
for (Var v : currentScope.getVarIterable()) {
nameVarMap.put(v.getName(), v); // depends on control dependency: [for], data = [v]
orderedVars.add(v); // depends on control dependency: [for], data = [v]
}
}
@Override
public void exitScope(NodeTraversal t) {}
@Override
public final boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
// Don't enter any new functions
return !n.isFunction() || n == scope.getRootNode();
}
@Override
public void visit(NodeTraversal t, Node n, Node parent) {}
};
NodeTraversal t = new NodeTraversal(compiler, finder, scopeCreator);
t.traverseAtScope(scope);
} }
|
public class class_name {
public void set(Object key, Object value) {
for (Scope cur=this; true; cur=cur.parent) {
// HashMap 允许有 null 值 value,必须要做 containsKey 判断
if (cur.data != null && cur.data.containsKey(key)) {
cur.data.put(key, value);
return ;
}
if (cur.parent == null) {
if (cur.data == null) { // 支持顶层 data 为 null 值
cur.data = new HashMap();
}
cur.data.put(key, value);
return ;
}
}
} }
|
public class class_name {
public void set(Object key, Object value) {
for (Scope cur=this; true; cur=cur.parent) {
// HashMap 允许有 null 值 value,必须要做 containsKey 判断
if (cur.data != null && cur.data.containsKey(key)) {
cur.data.put(key, value);
// depends on control dependency: [if], data = [none]
return ;
// depends on control dependency: [if], data = [none]
}
if (cur.parent == null) {
if (cur.data == null) { // 支持顶层 data 为 null 值
cur.data = new HashMap();
// depends on control dependency: [if], data = [none]
}
cur.data.put(key, value);
// depends on control dependency: [if], data = [none]
return ;
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void marshall(RedshiftMetadata redshiftMetadata, ProtocolMarshaller protocolMarshaller) {
if (redshiftMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(redshiftMetadata.getRedshiftDatabase(), REDSHIFTDATABASE_BINDING);
protocolMarshaller.marshall(redshiftMetadata.getDatabaseUserName(), DATABASEUSERNAME_BINDING);
protocolMarshaller.marshall(redshiftMetadata.getSelectSqlQuery(), SELECTSQLQUERY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(RedshiftMetadata redshiftMetadata, ProtocolMarshaller protocolMarshaller) {
if (redshiftMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(redshiftMetadata.getRedshiftDatabase(), REDSHIFTDATABASE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftMetadata.getDatabaseUserName(), DATABASEUSERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(redshiftMetadata.getSelectSqlQuery(), SELECTSQLQUERY_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void fireOnChange(Saveable o, XmlFile file) {
for (SaveableListener l : all()) {
try {
l.onChange(o,file);
} catch (ThreadDeath t) {
throw t;
} catch (Throwable t) {
Logger.getLogger(SaveableListener.class.getName()).log(Level.WARNING, null, t);
}
}
} }
|
public class class_name {
public static void fireOnChange(Saveable o, XmlFile file) {
for (SaveableListener l : all()) {
try {
l.onChange(o,file); // depends on control dependency: [try], data = [none]
} catch (ThreadDeath t) {
throw t;
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
Logger.getLogger(SaveableListener.class.getName()).log(Level.WARNING, null, t);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static Database inMemory(
String name, Map<String, String> urlOptions, Map<String, ? extends Object> config) {
StringBuilder urlExtra = new StringBuilder();
for (Map.Entry<String, String> option : urlOptions.entrySet()) {
urlExtra.append(';').append(option.getKey()).append('=').append(option.getValue());
}
String url = "jdbc:h2:mem:" + name + urlExtra;
return inMemory(name, url, config);
} }
|
public class class_name {
public static Database inMemory(
String name, Map<String, String> urlOptions, Map<String, ? extends Object> config) {
StringBuilder urlExtra = new StringBuilder();
for (Map.Entry<String, String> option : urlOptions.entrySet()) {
urlExtra.append(';').append(option.getKey()).append('=').append(option.getValue()); // depends on control dependency: [for], data = [option]
}
String url = "jdbc:h2:mem:" + name + urlExtra;
return inMemory(name, url, config);
} }
|
public class class_name {
public static void setFieldValue(Object object, String fieldName, Object value)
{
Params.notNull(object, "Object instance or class");
Params.notNull(fieldName, "Field name");
if(object instanceof Class<?>) {
setFieldValue(null, (Class<?>)object, fieldName, value);
}
else {
setFieldValue(object, object.getClass(), fieldName, value);
}
} }
|
public class class_name {
public static void setFieldValue(Object object, String fieldName, Object value)
{
Params.notNull(object, "Object instance or class");
Params.notNull(fieldName, "Field name");
if(object instanceof Class<?>) {
setFieldValue(null, (Class<?>)object, fieldName, value);
// depends on control dependency: [if], data = [)]
}
else {
setFieldValue(object, object.getClass(), fieldName, value);
// depends on control dependency: [if], data = [)]
}
} }
|
public class class_name {
public void addFactor(Factor factor) {
int id = factor.getId();
boolean alreadyAdded = (0 <= id && id < factors.size());
if (alreadyAdded) {
if (factors.get(id) != factor) {
throw new IllegalStateException("Factor id already set, but factor not yet added.");
}
} else {
// Factor was not yet in the factor graph.
//
// Check and set the id.
if (id != -1 && id != factors.size()) {
throw new IllegalStateException("Factor id already set, but incorrect: " + id);
}
factor.setId(factors.size());
// Add the factor.
factors.add(factor);
// Add each variable...
for (Var var : factor.getVars()) {
// Add the variable.
addVar(var);
numUndirEdges++;
}
if (bg != null) { log.warn("Discarding BipartiteGraph. This may indicate inefficiency."); }
bg = null;
}
} }
|
public class class_name {
public void addFactor(Factor factor) {
int id = factor.getId();
boolean alreadyAdded = (0 <= id && id < factors.size());
if (alreadyAdded) {
if (factors.get(id) != factor) {
throw new IllegalStateException("Factor id already set, but factor not yet added.");
}
} else {
// Factor was not yet in the factor graph.
//
// Check and set the id.
if (id != -1 && id != factors.size()) {
throw new IllegalStateException("Factor id already set, but incorrect: " + id);
}
factor.setId(factors.size()); // depends on control dependency: [if], data = [none]
// Add the factor.
factors.add(factor); // depends on control dependency: [if], data = [none]
// Add each variable...
for (Var var : factor.getVars()) {
// Add the variable.
addVar(var); // depends on control dependency: [for], data = [var]
numUndirEdges++; // depends on control dependency: [for], data = [none]
}
if (bg != null) { log.warn("Discarding BipartiteGraph. This may indicate inefficiency."); } // depends on control dependency: [if], data = [none]
bg = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public @CheckForNull Future<FormValidation> updateDirectly(final boolean signatureCheck) {
if (! getDataFile().exists() || isDue()) {
return Jenkins.getInstance().getUpdateCenter().updateService.submit(new Callable<FormValidation>() {
@Override public FormValidation call() throws Exception {
return updateDirectlyNow(signatureCheck);
}
});
} else {
return null;
}
} }
|
public class class_name {
public @CheckForNull Future<FormValidation> updateDirectly(final boolean signatureCheck) {
if (! getDataFile().exists() || isDue()) {
return Jenkins.getInstance().getUpdateCenter().updateService.submit(new Callable<FormValidation>() {
@Override public FormValidation call() throws Exception {
return updateDirectlyNow(signatureCheck);
}
}); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setRoutes(java.util.Collection<RouteRef> routes) {
if (routes == null) {
this.routes = null;
return;
}
this.routes = new java.util.ArrayList<RouteRef>(routes);
} }
|
public class class_name {
public void setRoutes(java.util.Collection<RouteRef> routes) {
if (routes == null) {
this.routes = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.routes = new java.util.ArrayList<RouteRef>(routes);
} }
|
public class class_name {
public com.google.privacy.dlp.v2.RedactConfigOrBuilder getRedactConfigOrBuilder() {
if (transformationCase_ == 2) {
return (com.google.privacy.dlp.v2.RedactConfig) transformation_;
}
return com.google.privacy.dlp.v2.RedactConfig.getDefaultInstance();
} }
|
public class class_name {
public com.google.privacy.dlp.v2.RedactConfigOrBuilder getRedactConfigOrBuilder() {
if (transformationCase_ == 2) {
return (com.google.privacy.dlp.v2.RedactConfig) transformation_; // depends on control dependency: [if], data = [none]
}
return com.google.privacy.dlp.v2.RedactConfig.getDefaultInstance();
} }
|
public class class_name {
long reset(boolean executeViaDistributed) throws ODatabaseException {
long retVal;
if (executeViaDistributed) {
try {
retVal = sendSequenceActionOverCluster(OSequenceAction.RESET, null);
} catch (InterruptedException | ExecutionException exc) {
OLogManager.instance().error(this, exc.getMessage(), exc, (Object[]) null);
throw new ODatabaseException(exc.getMessage());
}
} else {
retVal = resetWork();
}
return retVal;
} }
|
public class class_name {
long reset(boolean executeViaDistributed) throws ODatabaseException {
long retVal;
if (executeViaDistributed) {
try {
retVal = sendSequenceActionOverCluster(OSequenceAction.RESET, null); // depends on control dependency: [try], data = [none]
} catch (InterruptedException | ExecutionException exc) {
OLogManager.instance().error(this, exc.getMessage(), exc, (Object[]) null);
throw new ODatabaseException(exc.getMessage());
} // depends on control dependency: [catch], data = [none]
} else {
retVal = resetWork();
}
return retVal;
} }
|
public class class_name {
public void processSpace(final Properties props) {
WorkQueue workQueue = WorkQueue.getWorkQueue();
Object key = workQueue.registerTaskGroup(dataVectors.size());
// Process each word's context set in a worker thread.
for (Map.Entry<String, List<SparseDoubleVector>> entry :
dataVectors.entrySet()) {
// Get the root word being discriminated and list of observed
// contexts.
final String senseName = entry.getKey();
List<SparseDoubleVector> contextsWithNoLength = entry.getValue();
final List<SparseDoubleVector> contextSet =
new ArrayList<SparseDoubleVector>(contextsWithNoLength.size());
for (SparseDoubleVector v : contextsWithNoLength)
contextSet.add(Vectors.subview(v, 0, getVectorLength()));
workQueue.add(key, new Runnable() {
public void run() {
clusterTerm(senseName, contextSet, props);
}
});
}
workQueue.await(key);
LOG.info("Finished processing all terms");
} }
|
public class class_name {
public void processSpace(final Properties props) {
WorkQueue workQueue = WorkQueue.getWorkQueue();
Object key = workQueue.registerTaskGroup(dataVectors.size());
// Process each word's context set in a worker thread.
for (Map.Entry<String, List<SparseDoubleVector>> entry :
dataVectors.entrySet()) {
// Get the root word being discriminated and list of observed
// contexts.
final String senseName = entry.getKey();
List<SparseDoubleVector> contextsWithNoLength = entry.getValue();
final List<SparseDoubleVector> contextSet =
new ArrayList<SparseDoubleVector>(contextsWithNoLength.size());
for (SparseDoubleVector v : contextsWithNoLength)
contextSet.add(Vectors.subview(v, 0, getVectorLength()));
workQueue.add(key, new Runnable() {
public void run() {
clusterTerm(senseName, contextSet, props);
}
}); // depends on control dependency: [for], data = [none]
}
workQueue.await(key);
LOG.info("Finished processing all terms");
} }
|
public class class_name {
public void enableAllDetectors(boolean enable) {
detectorEnablementMap.clear();
Collection<Plugin> allPlugins = Plugin.getAllPlugins();
for (Plugin plugin : allPlugins) {
for (DetectorFactory factory : plugin.getDetectorFactories()) {
detectorEnablementMap.put(factory.getShortName(), enable);
}
}
} }
|
public class class_name {
public void enableAllDetectors(boolean enable) {
detectorEnablementMap.clear();
Collection<Plugin> allPlugins = Plugin.getAllPlugins();
for (Plugin plugin : allPlugins) {
for (DetectorFactory factory : plugin.getDetectorFactories()) {
detectorEnablementMap.put(factory.getShortName(), enable); // depends on control dependency: [for], data = [factory]
}
}
} }
|
public class class_name {
@Override
public List<IScan> getScansByRtClosest(double rt) {
List<IScan> result = null;
Map.Entry<Double, List<IScan>> lower = getMapRt2scan().lowerEntry(rt);
Map.Entry<Double, List<IScan>> upper = getMapRt2scan().ceilingEntry(rt);
if (upper != null && lower != null) {
if (Math.abs(rt - lower.getKey()) <= Math.abs(rt - upper.getKey())) {
result = lower.getValue();
} else {
result = upper.getValue();
}
// result = Double.compare(lower.getKey(), upper.getKey()) > 0 ? lower.getValue() : upper.getValue();
} else if (upper != null) {
result = upper.getValue();
} else if (lower != null) {
result = lower.getValue();
}
return result;
} }
|
public class class_name {
@Override
public List<IScan> getScansByRtClosest(double rt) {
List<IScan> result = null;
Map.Entry<Double, List<IScan>> lower = getMapRt2scan().lowerEntry(rt);
Map.Entry<Double, List<IScan>> upper = getMapRt2scan().ceilingEntry(rt);
if (upper != null && lower != null) {
if (Math.abs(rt - lower.getKey()) <= Math.abs(rt - upper.getKey())) {
result = lower.getValue(); // depends on control dependency: [if], data = [none]
} else {
result = upper.getValue(); // depends on control dependency: [if], data = [none]
}
// result = Double.compare(lower.getKey(), upper.getKey()) > 0 ? lower.getValue() : upper.getValue();
} else if (upper != null) {
result = upper.getValue(); // depends on control dependency: [if], data = [none]
} else if (lower != null) {
result = lower.getValue(); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public java.util.List<NetworkInterfacePermission> getNetworkInterfacePermissions() {
if (networkInterfacePermissions == null) {
networkInterfacePermissions = new com.amazonaws.internal.SdkInternalList<NetworkInterfacePermission>();
}
return networkInterfacePermissions;
} }
|
public class class_name {
public java.util.List<NetworkInterfacePermission> getNetworkInterfacePermissions() {
if (networkInterfacePermissions == null) {
networkInterfacePermissions = new com.amazonaws.internal.SdkInternalList<NetworkInterfacePermission>(); // depends on control dependency: [if], data = [none]
}
return networkInterfacePermissions;
} }
|
public class class_name {
public static <K, V> Map<K, V> map(Object... keysAndValues) {
if (keysAndValues.length % 2 != 0) { throw new IllegalArgumentException("number of arguments must be even"); }
Map<K, V> map = new HashMap<K, V>(Math.max(keysAndValues.length, 16));
for (int i = 0; i < keysAndValues.length;) {
map.put((K) keysAndValues[i++], (V) keysAndValues[i++]);
}
return map;
} }
|
public class class_name {
public static <K, V> Map<K, V> map(Object... keysAndValues) {
if (keysAndValues.length % 2 != 0) { throw new IllegalArgumentException("number of arguments must be even"); }
Map<K, V> map = new HashMap<K, V>(Math.max(keysAndValues.length, 16));
for (int i = 0; i < keysAndValues.length;) {
map.put((K) keysAndValues[i++], (V) keysAndValues[i++]); // depends on control dependency: [for], data = [i]
}
return map;
} }
|
public class class_name {
public static com.google.appengine.api.datastore.Key raw( Key<?> typed ) {
if ( typed == null ) {
return null;
} else {
return typed.getRaw();
}
} }
|
public class class_name {
public static com.google.appengine.api.datastore.Key raw( Key<?> typed ) {
if ( typed == null ) {
return null; // depends on control dependency: [if], data = [none]
} else {
return typed.getRaw(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static InetAddress getLoopbackAddress() {
try {
final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
if (interfaces != null) {
NetworkInterface inter;
InetAddress adr;
Enumeration<InetAddress> addrs;
while (interfaces.hasMoreElements()) {
inter = interfaces.nextElement();
addrs = inter.getInetAddresses();
if (addrs != null) {
while (addrs.hasMoreElements()) {
adr = addrs.nextElement();
if (adr != null && adr.isLoopbackAddress() && (adr instanceof Inet4Address)) {
return adr;
}
}
}
}
}
} catch (SocketException e) {
//
}
return null;
} }
|
public class class_name {
public static InetAddress getLoopbackAddress() {
try {
final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
if (interfaces != null) {
NetworkInterface inter;
InetAddress adr;
Enumeration<InetAddress> addrs;
while (interfaces.hasMoreElements()) {
inter = interfaces.nextElement(); // depends on control dependency: [while], data = [none]
addrs = inter.getInetAddresses(); // depends on control dependency: [while], data = [none]
if (addrs != null) {
while (addrs.hasMoreElements()) {
adr = addrs.nextElement(); // depends on control dependency: [while], data = [none]
if (adr != null && adr.isLoopbackAddress() && (adr instanceof Inet4Address)) {
return adr; // depends on control dependency: [if], data = [none]
}
}
}
}
}
} catch (SocketException e) {
//
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
private Throwable extractThrowable(ILoggingEvent event) {
IThrowableProxy throwableProxy = event.getThrowableProxy();
if (throwableProxy instanceof ThrowableProxy) {
return ((ThrowableProxy) throwableProxy).getThrowable();
}
return null;
} }
|
public class class_name {
private Throwable extractThrowable(ILoggingEvent event) {
IThrowableProxy throwableProxy = event.getThrowableProxy();
if (throwableProxy instanceof ThrowableProxy) {
return ((ThrowableProxy) throwableProxy).getThrowable(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
private void ensureParams() {
if (this.isDirty) {
// note, it would only be dirty if we actually have inserted a value
// so therefore no need to check that the parammap is null
final Buffer restOfParams = this.params;
this.params = allcoateNewParamBuffer();
for (final Map.Entry<Buffer, Buffer> entry : this.paramMap.entrySet()) {
this.params.write(SipParser.SEMI);
final Buffer key = entry.getKey();
final Buffer value = entry.getValue();
key.getBytes(0, this.params);
if (value != null && !value.isEmpty()) {
this.params.write(SipParser.EQ);
value.getBytes(0, this.params);
}
}
this.paramMap.clear();
restOfParams.getBytes(this.params);
this.originalParams = this.params.slice();
this.isDirty = false;
}
} }
|
public class class_name {
private void ensureParams() {
if (this.isDirty) {
// note, it would only be dirty if we actually have inserted a value
// so therefore no need to check that the parammap is null
final Buffer restOfParams = this.params;
this.params = allcoateNewParamBuffer(); // depends on control dependency: [if], data = [none]
for (final Map.Entry<Buffer, Buffer> entry : this.paramMap.entrySet()) {
this.params.write(SipParser.SEMI); // depends on control dependency: [for], data = [none]
final Buffer key = entry.getKey();
final Buffer value = entry.getValue();
key.getBytes(0, this.params); // depends on control dependency: [for], data = [none]
if (value != null && !value.isEmpty()) {
this.params.write(SipParser.EQ); // depends on control dependency: [if], data = [none]
value.getBytes(0, this.params); // depends on control dependency: [if], data = [none]
}
}
this.paramMap.clear(); // depends on control dependency: [if], data = [none]
restOfParams.getBytes(this.params); // depends on control dependency: [if], data = [none]
this.originalParams = this.params.slice(); // depends on control dependency: [if], data = [none]
this.isDirty = false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void initSession(final DbSession session) {
if (session != null) {
this.session = session;
return;
}
final DbSessionProvider dbSessionProvider = dbOom.sessionProvider();
this.session = dbSessionProvider.getDbSession();
} }
|
public class class_name {
protected void initSession(final DbSession session) {
if (session != null) {
this.session = session; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final DbSessionProvider dbSessionProvider = dbOom.sessionProvider();
this.session = dbSessionProvider.getDbSession();
} }
|
public class class_name {
public void forEachTarget(final Consumer<Target> targetConsumer) {
for (final Target target : targets) {
targetConsumer.accept(target);
}
} }
|
public class class_name {
public void forEachTarget(final Consumer<Target> targetConsumer) {
for (final Target target : targets) {
targetConsumer.accept(target); // depends on control dependency: [for], data = [target]
}
} }
|
public class class_name {
public static void scale_row(final int blockLength,
DSubmatrixD1 A, int rowA,
double alpha, DSubmatrixD1 B, int rowB,
int offset, int end)
{
final double dataA[] = A.original.data;
final double dataB[] = B.original.data;
// handle the case where offset is more than a block
int startI = offset - offset % blockLength;
offset = offset % blockLength;
// handle rows in any block
int rowBlockA = A.row0 + rowA - rowA % blockLength;
rowA = rowA % blockLength;
int rowBlockB = B.row0 + rowB - rowB % blockLength;
rowB = rowB % blockLength;
final int heightA = Math.min(blockLength,A.row1-rowBlockA);
final int heightB = Math.min(blockLength,B.row1-rowBlockB);
for( int i = startI; i < end; i += blockLength ) {
int segment = Math.min(blockLength,end-i);
int widthA = Math.min(blockLength,A.col1-A.col0-i);
int widthB = Math.min(blockLength,B.col1-B.col0-i);
int indexA = rowBlockA*A.original.numCols + (A.col0+i)*heightA + rowA*widthA;
int indexB = rowBlockB*B.original.numCols + (B.col0+i)*heightB + rowB*widthB;
if( i == startI ) {
indexA += offset;
indexB += offset;
for( int j = offset; j < segment; j++ ) {
dataB[indexB++] = alpha*dataA[indexA++];
}
} else {
for( int j = 0; j < segment; j++ ) {
dataB[indexB++] = alpha*dataA[indexA++];
}
}
}
} }
|
public class class_name {
public static void scale_row(final int blockLength,
DSubmatrixD1 A, int rowA,
double alpha, DSubmatrixD1 B, int rowB,
int offset, int end)
{
final double dataA[] = A.original.data;
final double dataB[] = B.original.data;
// handle the case where offset is more than a block
int startI = offset - offset % blockLength;
offset = offset % blockLength;
// handle rows in any block
int rowBlockA = A.row0 + rowA - rowA % blockLength;
rowA = rowA % blockLength;
int rowBlockB = B.row0 + rowB - rowB % blockLength;
rowB = rowB % blockLength;
final int heightA = Math.min(blockLength,A.row1-rowBlockA);
final int heightB = Math.min(blockLength,B.row1-rowBlockB);
for( int i = startI; i < end; i += blockLength ) {
int segment = Math.min(blockLength,end-i);
int widthA = Math.min(blockLength,A.col1-A.col0-i);
int widthB = Math.min(blockLength,B.col1-B.col0-i);
int indexA = rowBlockA*A.original.numCols + (A.col0+i)*heightA + rowA*widthA;
int indexB = rowBlockB*B.original.numCols + (B.col0+i)*heightB + rowB*widthB;
if( i == startI ) {
indexA += offset; // depends on control dependency: [if], data = [none]
indexB += offset; // depends on control dependency: [if], data = [none]
for( int j = offset; j < segment; j++ ) {
dataB[indexB++] = alpha*dataA[indexA++]; // depends on control dependency: [for], data = [none]
}
} else {
for( int j = 0; j < segment; j++ ) {
dataB[indexB++] = alpha*dataA[indexA++]; // depends on control dependency: [for], data = [none]
}
}
}
} }
|
public class class_name {
@Override
public void keep(String key)
{
_checkFlashScopeDisabled();
FacesContext facesContext = FacesContext.getCurrentInstance();
Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
Object value = requestMap.get(key);
// if the key does not exist in the requestMap,
// try to get it from the execute FlashMap
if (value == null)
{
Map<String, Object> executeMap = _getExecuteFlashMap(facesContext);
// Null-check, because in the GET request of a POST-REDIRECT-GET
// pattern there is no execute map
if (executeMap != null)
{
value = executeMap.get(key);
// Store it on request map so we can get it later. For example,
// this is used by org.apache.myfaces.el.FlashELResolver to return
// the value that has been promoted.
requestMap.put(key, value);
}
}
// put it in the render FlashMap
_getRenderFlashMap(facesContext).put(key, value);
facesContext.getApplication().publishEvent(facesContext,
PostKeepFlashValueEvent.class, key);
} }
|
public class class_name {
@Override
public void keep(String key)
{
_checkFlashScopeDisabled();
FacesContext facesContext = FacesContext.getCurrentInstance();
Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
Object value = requestMap.get(key);
// if the key does not exist in the requestMap,
// try to get it from the execute FlashMap
if (value == null)
{
Map<String, Object> executeMap = _getExecuteFlashMap(facesContext);
// Null-check, because in the GET request of a POST-REDIRECT-GET
// pattern there is no execute map
if (executeMap != null)
{
value = executeMap.get(key); // depends on control dependency: [if], data = [none]
// Store it on request map so we can get it later. For example,
// this is used by org.apache.myfaces.el.FlashELResolver to return
// the value that has been promoted.
requestMap.put(key, value); // depends on control dependency: [if], data = [none]
}
}
// put it in the render FlashMap
_getRenderFlashMap(facesContext).put(key, value);
facesContext.getApplication().publishEvent(facesContext,
PostKeepFlashValueEvent.class, key);
} }
|
public class class_name {
public static boolean isExpressionContainsFunction(String expression) {
// Si la chaine est vide : false
if(expression == null || expression.trim().length() == 0) {
// On retourne false
return false;
}
// On split
return isExpressionContainPattern(expression, FUNC_CHAIN_PATTERN);
} }
|
public class class_name {
public static boolean isExpressionContainsFunction(String expression) {
// Si la chaine est vide : false
if(expression == null || expression.trim().length() == 0) {
// On retourne false
return false;
// depends on control dependency: [if], data = [none]
}
// On split
return isExpressionContainPattern(expression, FUNC_CHAIN_PATTERN);
} }
|
public class class_name {
@Override
public void setupHadoopJobProperties() {
if (getJobProps().containsKey(HADOOP_GLOBAL_OPTS)) {
String hadoopGlobalOps = getJobProps().getString(HADOOP_GLOBAL_OPTS);
if (getJobProps().containsKey(HADOOP_OPTS)) {
String hadoopOps = getJobProps().getString(HADOOP_OPTS);
getJobProps().put(HADOOP_OPTS, String.format("%s %s", hadoopOps, hadoopGlobalOps));
} else {
getJobProps().put(HADOOP_OPTS, hadoopGlobalOps);
}
}
} }
|
public class class_name {
@Override
public void setupHadoopJobProperties() {
if (getJobProps().containsKey(HADOOP_GLOBAL_OPTS)) {
String hadoopGlobalOps = getJobProps().getString(HADOOP_GLOBAL_OPTS);
if (getJobProps().containsKey(HADOOP_OPTS)) {
String hadoopOps = getJobProps().getString(HADOOP_OPTS);
getJobProps().put(HADOOP_OPTS, String.format("%s %s", hadoopOps, hadoopGlobalOps)); // depends on control dependency: [if], data = [none]
} else {
getJobProps().put(HADOOP_OPTS, hadoopGlobalOps); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected static HeadElement getHead() {
if (head == null) {
final Element element = Document.get().getElementsByTagName("head").getItem(0);
assert element != null : "HTML Head element required";
final HeadElement head = HeadElement.as(element);
AbstractInjector.head = head;
}
return AbstractInjector.head;
} }
|
public class class_name {
protected static HeadElement getHead() {
if (head == null) {
final Element element = Document.get().getElementsByTagName("head").getItem(0);
assert element != null : "HTML Head element required";
final HeadElement head = HeadElement.as(element);
AbstractInjector.head = head; // depends on control dependency: [if], data = [none]
}
return AbstractInjector.head;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.