code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private String getHelp(I_CmsXmlSchemaType value) { StringBuffer result = new StringBuffer(64); I_CmsXmlContentHandler handler = value.getContentDefinition().getContentHandler(); if (handler instanceof CmsDefaultXmlContentHandler) { CmsDefaultXmlContentHandler defaultHandler = (CmsDefaultXmlContentHandler)handler; String help = defaultHandler.getFieldHelp().get(value.getName()); if (help != null) { CmsMacroResolver resolver = new CmsMacroResolver(); resolver.setKeepEmptyMacros(true); resolver.setMessages(m_messages); return resolver.resolveMacros(help); } } result.append(A_CmsWidget.LABEL_PREFIX); result.append(getTypeKey(value)); result.append(A_CmsWidget.HELP_POSTFIX); return m_messages.keyDefault(result.toString(), null); } }
public class class_name { private String getHelp(I_CmsXmlSchemaType value) { StringBuffer result = new StringBuffer(64); I_CmsXmlContentHandler handler = value.getContentDefinition().getContentHandler(); if (handler instanceof CmsDefaultXmlContentHandler) { CmsDefaultXmlContentHandler defaultHandler = (CmsDefaultXmlContentHandler)handler; String help = defaultHandler.getFieldHelp().get(value.getName()); if (help != null) { CmsMacroResolver resolver = new CmsMacroResolver(); resolver.setKeepEmptyMacros(true); // depends on control dependency: [if], data = [none] resolver.setMessages(m_messages); // depends on control dependency: [if], data = [none] return resolver.resolveMacros(help); // depends on control dependency: [if], data = [(help] } } result.append(A_CmsWidget.LABEL_PREFIX); result.append(getTypeKey(value)); result.append(A_CmsWidget.HELP_POSTFIX); return m_messages.keyDefault(result.toString(), null); } }
public class class_name { private void pushBasicProfile(JSONObject baseProfile) { try { String guid = getCleverTapID(); JSONObject profileEvent = new JSONObject(); if (baseProfile != null && baseProfile.length() > 0) { Iterator i = baseProfile.keys(); while (i.hasNext()) { String next = i.next().toString(); // need to handle command-based JSONObject props here now Object value = null; try { value = baseProfile.getJSONObject(next); } catch (Throwable t) { try { value = baseProfile.get(next); } catch (JSONException e) { //no-op } } if (value != null) { profileEvent.put(next, value); // cache the valid identifier: guid pairs if (Constants.PROFILE_IDENTIFIER_KEYS.contains(next)) { try { cacheGUIDForIdentifier(guid, next, value.toString()); } catch (Throwable t) { // no-op } } } } } try { String carrier = this.deviceInfo.getCarrier(); if (carrier != null && !carrier.equals("")) { profileEvent.put("Carrier", carrier); } String cc = this.deviceInfo.getCountryCode(); if (cc != null && !cc.equals("")) { profileEvent.put("cc", cc); } profileEvent.put("tz", TimeZone.getDefault().getID()); JSONObject event = new JSONObject(); event.put("profile", profileEvent); queueEvent(context, event, Constants.PROFILE_EVENT); } catch (JSONException e) { getConfigLogger().verbose(getAccountId(), "FATAL: Creating basic profile update event failed!"); } } catch (Throwable t) { getConfigLogger().verbose(getAccountId(), "Basic profile sync", t); } } }
public class class_name { private void pushBasicProfile(JSONObject baseProfile) { try { String guid = getCleverTapID(); JSONObject profileEvent = new JSONObject(); if (baseProfile != null && baseProfile.length() > 0) { Iterator i = baseProfile.keys(); while (i.hasNext()) { String next = i.next().toString(); // need to handle command-based JSONObject props here now Object value = null; try { value = baseProfile.getJSONObject(next); // depends on control dependency: [try], data = [none] } catch (Throwable t) { try { value = baseProfile.get(next); // depends on control dependency: [try], data = [none] } catch (JSONException e) { //no-op } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] if (value != null) { profileEvent.put(next, value); // depends on control dependency: [if], data = [none] // cache the valid identifier: guid pairs if (Constants.PROFILE_IDENTIFIER_KEYS.contains(next)) { try { cacheGUIDForIdentifier(guid, next, value.toString()); // depends on control dependency: [try], data = [none] } catch (Throwable t) { // no-op } // depends on control dependency: [catch], data = [none] } } } } try { String carrier = this.deviceInfo.getCarrier(); if (carrier != null && !carrier.equals("")) { profileEvent.put("Carrier", carrier); // depends on control dependency: [if], data = [none] } String cc = this.deviceInfo.getCountryCode(); if (cc != null && !cc.equals("")) { profileEvent.put("cc", cc); // depends on control dependency: [if], data = [none] } profileEvent.put("tz", TimeZone.getDefault().getID()); // depends on control dependency: [try], data = [none] JSONObject event = new JSONObject(); event.put("profile", profileEvent); // depends on control dependency: [try], data = [none] queueEvent(context, event, Constants.PROFILE_EVENT); // depends on control dependency: [try], data = [none] } catch (JSONException e) { getConfigLogger().verbose(getAccountId(), "FATAL: Creating basic profile update event failed!"); } // depends on control dependency: [catch], data = [none] } catch (Throwable t) { getConfigLogger().verbose(getAccountId(), "Basic profile sync", t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void applyViewOptions() { setMainToolbarVisible(options.getViewParam().isShowMainToolbar()); setWorkbenchLayout(WorkbenchPanel.Layout.getLayout(options.getViewParam().getDisplayOption())); WorkbenchPanel.ResponsePanelPosition position = WorkbenchPanel.ResponsePanelPosition.TABS_SIDE_BY_SIDE; try { position = WorkbenchPanel.ResponsePanelPosition.valueOf(options.getViewParam().getResponsePanelPosition()); } catch (IllegalArgumentException e) { LOGGER.warn("Failed to restore the position of response panel: ", e); } setResponsePanelPosition(position); setShowTabNames(options.getViewParam().getShowTabNames()); } }
public class class_name { public void applyViewOptions() { setMainToolbarVisible(options.getViewParam().isShowMainToolbar()); setWorkbenchLayout(WorkbenchPanel.Layout.getLayout(options.getViewParam().getDisplayOption())); WorkbenchPanel.ResponsePanelPosition position = WorkbenchPanel.ResponsePanelPosition.TABS_SIDE_BY_SIDE; try { position = WorkbenchPanel.ResponsePanelPosition.valueOf(options.getViewParam().getResponsePanelPosition()); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { LOGGER.warn("Failed to restore the position of response panel: ", e); } // depends on control dependency: [catch], data = [none] setResponsePanelPosition(position); setShowTabNames(options.getViewParam().getShowTabNames()); } }
public class class_name { public static boolean sameResource(URI uri, String otherResource) { try { return createUri(otherResource).equals(uri); } catch(DataSourceException e) { return false; } } }
public class class_name { public static boolean sameResource(URI uri, String otherResource) { try { return createUri(otherResource).equals(uri); // depends on control dependency: [try], data = [none] } catch(DataSourceException e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean hideOverflowMenu() { if (mPostedOpenRunnable != null && mMenuView != null) { ((View) mMenuView).removeCallbacks(mPostedOpenRunnable); mPostedOpenRunnable = null; return true; } MenuPopupHelper popup = mOverflowPopup; if (popup != null) { popup.dismiss(); return true; } return false; } }
public class class_name { public boolean hideOverflowMenu() { if (mPostedOpenRunnable != null && mMenuView != null) { ((View) mMenuView).removeCallbacks(mPostedOpenRunnable); // depends on control dependency: [if], data = [(mPostedOpenRunnable] mPostedOpenRunnable = null; // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } MenuPopupHelper popup = mOverflowPopup; if (popup != null) { popup.dismiss(); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private void addFieldsToBuilder(String[] fieldsToSelect, Class clazz, MetamodelImpl metaModel, SearchRequestBuilder builder) { if (fieldsToSelect != null && fieldsToSelect.length > 1 && !(fieldsToSelect[1] == null)) { logger.debug("Fields added in query are: "); for (int i = 1; i < fieldsToSelect.length; i++) { logger.debug(i + " : " + fieldsToSelect[i]); builder = builder.addField(((AbstractAttribute) metaModel.entity(clazz).getAttribute(fieldsToSelect[i])) .getJPAColumnName()); } } } }
public class class_name { private void addFieldsToBuilder(String[] fieldsToSelect, Class clazz, MetamodelImpl metaModel, SearchRequestBuilder builder) { if (fieldsToSelect != null && fieldsToSelect.length > 1 && !(fieldsToSelect[1] == null)) { logger.debug("Fields added in query are: "); // depends on control dependency: [if], data = [none] for (int i = 1; i < fieldsToSelect.length; i++) { logger.debug(i + " : " + fieldsToSelect[i]); // depends on control dependency: [for], data = [i] builder = builder.addField(((AbstractAttribute) metaModel.entity(clazz).getAttribute(fieldsToSelect[i])) .getJPAColumnName()); // depends on control dependency: [for], data = [none] } } } }
public class class_name { static String escape(final String text, final XmlEscapeSymbols symbols, final XmlEscapeType escapeType, final XmlEscapeLevel escapeLevel) { if (text == null) { return null; } final int level = escapeLevel.getEscapeLevel(); final boolean useCERs = escapeType.getUseCERs(); final boolean useHexa = escapeType.getUseHexa(); StringBuilder strBuilder = null; final int offset = 0; final int max = text.length(); int readOffset = offset; for (int i = offset; i < max; i++) { final int codepoint = Character.codePointAt(text, i); boolean codepointValid = symbols.CODEPOINT_VALIDATOR.isValid(codepoint); /* * Shortcut: most characters will be ASCII/Alphanumeric, and we won't need to do anything at * all for them */ if (codepoint <= (XmlEscapeSymbols.LEVELS_LEN - 2) && level < symbols.ESCAPE_LEVELS[codepoint] && codepointValid) { continue; } /* * Shortcut: we might not want to escape non-ASCII chars at all either. */ if (codepoint > (XmlEscapeSymbols.LEVELS_LEN - 2) && level < symbols.ESCAPE_LEVELS[XmlEscapeSymbols.LEVELS_LEN - 1] && codepointValid) { if (Character.charCount(codepoint) > 1) { // This is to compensate that we are actually escaping two char[] positions with a single codepoint. i++; } continue; } /* * At this point we know for sure we will need some kind of escape, so we * can increase the offset and initialize the string builder if needed, along with * copying to it all the contents pending up to this point. */ if (strBuilder == null) { strBuilder = new StringBuilder(max + 20); } if (i - readOffset > 0) { strBuilder.append(text, readOffset, i); } if (Character.charCount(codepoint) > 1) { // This is to compensate that we are actually reading two char[] positions with a single codepoint. i++; } readOffset = i + 1; /* * If the char is invalid, there is nothing to write, simply skip it (which we already did by * incrementing the readOffset. */ if (!codepointValid) { continue; } /* * ----------------------------------------------------------------------------------------- * * Perform the real escape, attending the different combinations of NCR, DCR and HCR needs. * * ----------------------------------------------------------------------------------------- */ if (useCERs) { // We will try to use a CER final int codepointIndex = Arrays.binarySearch(symbols.SORTED_CODEPOINTS, codepoint); if (codepointIndex >= 0) { // CER found! just write it and go for the next char strBuilder.append(symbols.SORTED_CERS_BY_CODEPOINT[codepointIndex]); continue; } } /* * No NCR-escape was possible (or allowed), so we need decimal/hexa escape. */ if (useHexa) { strBuilder.append(REFERENCE_HEXA_PREFIX); strBuilder.append(Integer.toHexString(codepoint)); } else { strBuilder.append(REFERENCE_DECIMAL_PREFIX); strBuilder.append(String.valueOf(codepoint)); } strBuilder.append(REFERENCE_SUFFIX); } /* * ----------------------------------------------------------------------------------------------- * Final cleaning: return the original String object if no escape was actually needed. Otherwise * append the remaining unescaped text to the string builder and return. * ----------------------------------------------------------------------------------------------- */ if (strBuilder == null) { return text; } if (max - readOffset > 0) { strBuilder.append(text, readOffset, max); } return strBuilder.toString(); } }
public class class_name { static String escape(final String text, final XmlEscapeSymbols symbols, final XmlEscapeType escapeType, final XmlEscapeLevel escapeLevel) { if (text == null) { return null; // depends on control dependency: [if], data = [none] } final int level = escapeLevel.getEscapeLevel(); final boolean useCERs = escapeType.getUseCERs(); final boolean useHexa = escapeType.getUseHexa(); StringBuilder strBuilder = null; final int offset = 0; final int max = text.length(); int readOffset = offset; for (int i = offset; i < max; i++) { final int codepoint = Character.codePointAt(text, i); boolean codepointValid = symbols.CODEPOINT_VALIDATOR.isValid(codepoint); /* * Shortcut: most characters will be ASCII/Alphanumeric, and we won't need to do anything at * all for them */ if (codepoint <= (XmlEscapeSymbols.LEVELS_LEN - 2) && level < symbols.ESCAPE_LEVELS[codepoint] && codepointValid) { continue; } /* * Shortcut: we might not want to escape non-ASCII chars at all either. */ if (codepoint > (XmlEscapeSymbols.LEVELS_LEN - 2) && level < symbols.ESCAPE_LEVELS[XmlEscapeSymbols.LEVELS_LEN - 1] && codepointValid) { if (Character.charCount(codepoint) > 1) { // This is to compensate that we are actually escaping two char[] positions with a single codepoint. i++; // depends on control dependency: [if], data = [none] } continue; } /* * At this point we know for sure we will need some kind of escape, so we * can increase the offset and initialize the string builder if needed, along with * copying to it all the contents pending up to this point. */ if (strBuilder == null) { strBuilder = new StringBuilder(max + 20); // depends on control dependency: [if], data = [none] } if (i - readOffset > 0) { strBuilder.append(text, readOffset, i); // depends on control dependency: [if], data = [none] } if (Character.charCount(codepoint) > 1) { // This is to compensate that we are actually reading two char[] positions with a single codepoint. i++; // depends on control dependency: [if], data = [none] } readOffset = i + 1; // depends on control dependency: [for], data = [i] /* * If the char is invalid, there is nothing to write, simply skip it (which we already did by * incrementing the readOffset. */ if (!codepointValid) { continue; } /* * ----------------------------------------------------------------------------------------- * * Perform the real escape, attending the different combinations of NCR, DCR and HCR needs. * * ----------------------------------------------------------------------------------------- */ if (useCERs) { // We will try to use a CER final int codepointIndex = Arrays.binarySearch(symbols.SORTED_CODEPOINTS, codepoint); if (codepointIndex >= 0) { // CER found! just write it and go for the next char strBuilder.append(symbols.SORTED_CERS_BY_CODEPOINT[codepointIndex]); // depends on control dependency: [if], data = [none] continue; } } /* * No NCR-escape was possible (or allowed), so we need decimal/hexa escape. */ if (useHexa) { strBuilder.append(REFERENCE_HEXA_PREFIX); // depends on control dependency: [if], data = [none] strBuilder.append(Integer.toHexString(codepoint)); // depends on control dependency: [if], data = [none] } else { strBuilder.append(REFERENCE_DECIMAL_PREFIX); // depends on control dependency: [if], data = [none] strBuilder.append(String.valueOf(codepoint)); // depends on control dependency: [if], data = [none] } strBuilder.append(REFERENCE_SUFFIX); // depends on control dependency: [for], data = [none] } /* * ----------------------------------------------------------------------------------------------- * Final cleaning: return the original String object if no escape was actually needed. Otherwise * append the remaining unescaped text to the string builder and return. * ----------------------------------------------------------------------------------------------- */ if (strBuilder == null) { return text; // depends on control dependency: [if], data = [none] } if (max - readOffset > 0) { strBuilder.append(text, readOffset, max); // depends on control dependency: [if], data = [none] } return strBuilder.toString(); } }
public class class_name { private void updateTypeOfArguments(Node n, FunctionType fnType) { checkState(NodeUtil.isInvocation(n), n); Iterator<Node> parameters = fnType.getParameters().iterator(); if (n.isTaggedTemplateLit()) { // Skip the first parameter because it corresponds to a constructed array of the template lit // subs, not an actual AST node, so there's nothing to update. if (!parameters.hasNext()) { // TypeCheck will warn if there is no first parameter. Just bail out here. return; } parameters.next(); } Iterator<Node> arguments = NodeUtil.getInvocationArgsAsIterable(n).iterator(); Node iParameter; Node iArgument; // Note: if there are too many or too few arguments, TypeCheck will warn. while (parameters.hasNext() && arguments.hasNext()) { iArgument = arguments.next(); JSType iArgumentType = getJSType(iArgument); iParameter = parameters.next(); JSType iParameterType = getJSType(iParameter); inferPropertyTypesToMatchConstraint(iArgumentType, iParameterType); // If the parameter to the call is a function expression, propagate the // function signature from the call site to the function node. // Filter out non-function types (such as null and undefined) as // we only care about FUNCTION subtypes here. FunctionType restrictedParameter = null; if (iParameterType.isUnionType()) { UnionType union = iParameterType.toMaybeUnionType(); for (JSType alternative : union.getAlternates()) { if (alternative.isFunctionType()) { // There is only one function type per union. restrictedParameter = alternative.toMaybeFunctionType(); break; } } } else { restrictedParameter = iParameterType.toMaybeFunctionType(); } if (restrictedParameter != null && iArgument.isFunction() && iArgumentType.isFunctionType()) { FunctionType argFnType = iArgumentType.toMaybeFunctionType(); JSDocInfo argJsdoc = iArgument.getJSDocInfo(); // Treat the parameter & return types of the function as 'declared' if the function has // JSDoc with type annotations, or a parameter has inline JSDoc. // Note that this does not distinguish between cases where all parameters have JSDoc vs // only one parameter has JSDoc. boolean declared = (argJsdoc != null && argJsdoc.containsDeclaration()) || NodeUtil.functionHasInlineJsdocs(iArgument); iArgument.setJSType(matchFunction(restrictedParameter, argFnType, declared)); } } } }
public class class_name { private void updateTypeOfArguments(Node n, FunctionType fnType) { checkState(NodeUtil.isInvocation(n), n); Iterator<Node> parameters = fnType.getParameters().iterator(); if (n.isTaggedTemplateLit()) { // Skip the first parameter because it corresponds to a constructed array of the template lit // subs, not an actual AST node, so there's nothing to update. if (!parameters.hasNext()) { // TypeCheck will warn if there is no first parameter. Just bail out here. return; // depends on control dependency: [if], data = [none] } parameters.next(); // depends on control dependency: [if], data = [none] } Iterator<Node> arguments = NodeUtil.getInvocationArgsAsIterable(n).iterator(); Node iParameter; Node iArgument; // Note: if there are too many or too few arguments, TypeCheck will warn. while (parameters.hasNext() && arguments.hasNext()) { iArgument = arguments.next(); // depends on control dependency: [while], data = [none] JSType iArgumentType = getJSType(iArgument); iParameter = parameters.next(); // depends on control dependency: [while], data = [none] JSType iParameterType = getJSType(iParameter); inferPropertyTypesToMatchConstraint(iArgumentType, iParameterType); // depends on control dependency: [while], data = [none] // If the parameter to the call is a function expression, propagate the // function signature from the call site to the function node. // Filter out non-function types (such as null and undefined) as // we only care about FUNCTION subtypes here. FunctionType restrictedParameter = null; if (iParameterType.isUnionType()) { UnionType union = iParameterType.toMaybeUnionType(); for (JSType alternative : union.getAlternates()) { if (alternative.isFunctionType()) { // There is only one function type per union. restrictedParameter = alternative.toMaybeFunctionType(); // depends on control dependency: [if], data = [none] break; } } } else { restrictedParameter = iParameterType.toMaybeFunctionType(); // depends on control dependency: [if], data = [none] } if (restrictedParameter != null && iArgument.isFunction() && iArgumentType.isFunctionType()) { FunctionType argFnType = iArgumentType.toMaybeFunctionType(); JSDocInfo argJsdoc = iArgument.getJSDocInfo(); // Treat the parameter & return types of the function as 'declared' if the function has // JSDoc with type annotations, or a parameter has inline JSDoc. // Note that this does not distinguish between cases where all parameters have JSDoc vs // only one parameter has JSDoc. boolean declared = (argJsdoc != null && argJsdoc.containsDeclaration()) || NodeUtil.functionHasInlineJsdocs(iArgument); iArgument.setJSType(matchFunction(restrictedParameter, argFnType, declared)); // depends on control dependency: [if], data = [(restrictedParameter] } } } }
public class class_name { public static final String getType(CmsObject cms, String rootPath) { String type = null; CmsSolrIndex index = CmsSearchManager.getIndexSolr(cms, null); if (index != null) { I_CmsSearchDocument doc = index.getDocument(CmsSearchField.FIELD_PATH, rootPath); if (doc != null) { type = doc.getFieldValueAsString(CmsSearchField.FIELD_TYPE); } } return type; } }
public class class_name { public static final String getType(CmsObject cms, String rootPath) { String type = null; CmsSolrIndex index = CmsSearchManager.getIndexSolr(cms, null); if (index != null) { I_CmsSearchDocument doc = index.getDocument(CmsSearchField.FIELD_PATH, rootPath); if (doc != null) { type = doc.getFieldValueAsString(CmsSearchField.FIELD_TYPE); // depends on control dependency: [if], data = [none] } } return type; } }
public class class_name { private void updateUnknownStatus(Map<String, Map<String, String>> statusMap, List<String> unreportedNn) { if (unreportedNn == null || unreportedNn.isEmpty()) { // no unreported namenodes return; } for (Map.Entry<String, Map<String,String>> entry : statusMap.entrySet()) { String dn = entry.getKey(); Map<String, String> nnStatus = entry.getValue(); for (String nn : unreportedNn) { nnStatus.put(nn, DecommissionStates.UNKNOWN.toString()); } statusMap.put(dn, nnStatus); } } }
public class class_name { private void updateUnknownStatus(Map<String, Map<String, String>> statusMap, List<String> unreportedNn) { if (unreportedNn == null || unreportedNn.isEmpty()) { // no unreported namenodes return; // depends on control dependency: [if], data = [none] } for (Map.Entry<String, Map<String,String>> entry : statusMap.entrySet()) { String dn = entry.getKey(); Map<String, String> nnStatus = entry.getValue(); for (String nn : unreportedNn) { nnStatus.put(nn, DecommissionStates.UNKNOWN.toString()); // depends on control dependency: [for], data = [nn] } statusMap.put(dn, nnStatus); // depends on control dependency: [for], data = [none] } } }
public class class_name { @GET @Produces(MediaType.APPLICATION_JSON) public Response findInstallations(@PathParam("variantID") String variantId, @QueryParam("page") Integer page, @QueryParam("per_page") Integer pageSize, @QueryParam("search") String search, @Context UriInfo uri) { if (pageSize != null) { pageSize = Math.min(MAX_PAGE_SIZE, pageSize); } else { pageSize = DEFAULT_PAGE_SIZE; } if (page == null) { page = 0; } if (search == null || search.isEmpty()) { search = null; } //Find the variant using the variantID if (!searchManager.getSearchService().existsVariantIDForDeveloper(variantId)) { return Response.status(Response.Status.NOT_FOUND).entity("Could not find requested Variant").build(); } //Find the installations using the variantID PageResult<Installation, Count> pageResult = searchManager.getSearchService().findAllInstallationsByVariantForDeveloper(variantId, page, pageSize, search); final long totalPages = pageResult.getAggregate().getCount() / pageSize; LinkHeader header = getLinkHeader(page, totalPages, uri); return Response.ok(pageResult.getResultList()) .header("Link", header.toString()) .header("total", pageResult.getAggregate().getCount()) .build(); } }
public class class_name { @GET @Produces(MediaType.APPLICATION_JSON) public Response findInstallations(@PathParam("variantID") String variantId, @QueryParam("page") Integer page, @QueryParam("per_page") Integer pageSize, @QueryParam("search") String search, @Context UriInfo uri) { if (pageSize != null) { pageSize = Math.min(MAX_PAGE_SIZE, pageSize); // depends on control dependency: [if], data = [none] } else { pageSize = DEFAULT_PAGE_SIZE; // depends on control dependency: [if], data = [none] } if (page == null) { page = 0; // depends on control dependency: [if], data = [none] } if (search == null || search.isEmpty()) { search = null; // depends on control dependency: [if], data = [none] } //Find the variant using the variantID if (!searchManager.getSearchService().existsVariantIDForDeveloper(variantId)) { return Response.status(Response.Status.NOT_FOUND).entity("Could not find requested Variant").build(); // depends on control dependency: [if], data = [none] } //Find the installations using the variantID PageResult<Installation, Count> pageResult = searchManager.getSearchService().findAllInstallationsByVariantForDeveloper(variantId, page, pageSize, search); final long totalPages = pageResult.getAggregate().getCount() / pageSize; LinkHeader header = getLinkHeader(page, totalPages, uri); return Response.ok(pageResult.getResultList()) .header("Link", header.toString()) .header("total", pageResult.getAggregate().getCount()) .build(); } }
public class class_name { @Override public CommerceVirtualOrderItem fetchByPrimaryKey(Serializable primaryKey) { Serializable serializable = entityCache.getResult(CommerceVirtualOrderItemModelImpl.ENTITY_CACHE_ENABLED, CommerceVirtualOrderItemImpl.class, primaryKey); if (serializable == nullModel) { return null; } CommerceVirtualOrderItem commerceVirtualOrderItem = (CommerceVirtualOrderItem)serializable; if (commerceVirtualOrderItem == null) { Session session = null; try { session = openSession(); commerceVirtualOrderItem = (CommerceVirtualOrderItem)session.get(CommerceVirtualOrderItemImpl.class, primaryKey); if (commerceVirtualOrderItem != null) { cacheResult(commerceVirtualOrderItem); } else { entityCache.putResult(CommerceVirtualOrderItemModelImpl.ENTITY_CACHE_ENABLED, CommerceVirtualOrderItemImpl.class, primaryKey, nullModel); } } catch (Exception e) { entityCache.removeResult(CommerceVirtualOrderItemModelImpl.ENTITY_CACHE_ENABLED, CommerceVirtualOrderItemImpl.class, primaryKey); throw processException(e); } finally { closeSession(session); } } return commerceVirtualOrderItem; } }
public class class_name { @Override public CommerceVirtualOrderItem fetchByPrimaryKey(Serializable primaryKey) { Serializable serializable = entityCache.getResult(CommerceVirtualOrderItemModelImpl.ENTITY_CACHE_ENABLED, CommerceVirtualOrderItemImpl.class, primaryKey); if (serializable == nullModel) { return null; // depends on control dependency: [if], data = [none] } CommerceVirtualOrderItem commerceVirtualOrderItem = (CommerceVirtualOrderItem)serializable; if (commerceVirtualOrderItem == null) { Session session = null; try { session = openSession(); // depends on control dependency: [try], data = [none] commerceVirtualOrderItem = (CommerceVirtualOrderItem)session.get(CommerceVirtualOrderItemImpl.class, primaryKey); // depends on control dependency: [try], data = [none] if (commerceVirtualOrderItem != null) { cacheResult(commerceVirtualOrderItem); // depends on control dependency: [if], data = [(commerceVirtualOrderItem] } else { entityCache.putResult(CommerceVirtualOrderItemModelImpl.ENTITY_CACHE_ENABLED, CommerceVirtualOrderItemImpl.class, primaryKey, nullModel); // depends on control dependency: [if], data = [none] } } catch (Exception e) { entityCache.removeResult(CommerceVirtualOrderItemModelImpl.ENTITY_CACHE_ENABLED, CommerceVirtualOrderItemImpl.class, primaryKey); throw processException(e); } // depends on control dependency: [catch], data = [none] finally { closeSession(session); } } return commerceVirtualOrderItem; } }
public class class_name { private EDBException runPreCommitHooks(EDBCommit commit) { EDBException exception = null; for (EDBPreCommitHook hook : preCommitHooks) { try { hook.onPreCommit(commit); } catch (ServiceUnavailableException e) { // Ignore } catch (EDBException e) { exception = e; break; } catch (Exception e) { logger.error("Error while performing EDBPreCommitHook", e); } } return exception; } }
public class class_name { private EDBException runPreCommitHooks(EDBCommit commit) { EDBException exception = null; for (EDBPreCommitHook hook : preCommitHooks) { try { hook.onPreCommit(commit); // depends on control dependency: [try], data = [none] } catch (ServiceUnavailableException e) { // Ignore } catch (EDBException e) { // depends on control dependency: [catch], data = [none] exception = e; break; } catch (Exception e) { // depends on control dependency: [catch], data = [none] logger.error("Error while performing EDBPreCommitHook", e); } // depends on control dependency: [catch], data = [none] } return exception; } }
public class class_name { @Override protected IIOMetadataNode getStandardTransparencyNode() { IIOMetadataNode transparency = new IIOMetadataNode("Transparency"); IIOMetadataNode alpha = new IIOMetadataNode("Alpha"); transparency.appendChild(alpha); if (extensions != null) { if (extensions.hasAlpha()) { alpha.setAttribute("value", extensions.isAlphaPremultiplied() ? "premultiplied" : "nonpremultiplied"); } else { alpha.setAttribute("value", "none"); } } else if (header.getAttributeBits() == 8) { alpha.setAttribute("value", "nonpremultiplied"); } else { alpha.setAttribute("value", "none"); } return transparency; } }
public class class_name { @Override protected IIOMetadataNode getStandardTransparencyNode() { IIOMetadataNode transparency = new IIOMetadataNode("Transparency"); IIOMetadataNode alpha = new IIOMetadataNode("Alpha"); transparency.appendChild(alpha); if (extensions != null) { if (extensions.hasAlpha()) { alpha.setAttribute("value", extensions.isAlphaPremultiplied() ? "premultiplied" : "nonpremultiplied"); // depends on control dependency: [if], data = [none] } else { alpha.setAttribute("value", "none"); // depends on control dependency: [if], data = [none] } } else if (header.getAttributeBits() == 8) { alpha.setAttribute("value", "nonpremultiplied"); // depends on control dependency: [if], data = [none] } else { alpha.setAttribute("value", "none"); // depends on control dependency: [if], data = [none] } return transparency; } }
public class class_name { private static boolean hasNumberMacro(String pattern, String macroStart, String macroEnd) { String macro = I_CmsFileNameGenerator.MACRO_NUMBER; String macroPart = macroStart + macro + MACRO_NUMBER_DIGIT_SEPARATOR; int prefixIndex = pattern.indexOf(macroPart); if (prefixIndex >= 0) { // this macro contains an individual digit setting char n = pattern.charAt(prefixIndex + macroPart.length()); macro = macro + MACRO_NUMBER_DIGIT_SEPARATOR + n; } return pattern.contains(macroStart + macro + macroEnd); } }
public class class_name { private static boolean hasNumberMacro(String pattern, String macroStart, String macroEnd) { String macro = I_CmsFileNameGenerator.MACRO_NUMBER; String macroPart = macroStart + macro + MACRO_NUMBER_DIGIT_SEPARATOR; int prefixIndex = pattern.indexOf(macroPart); if (prefixIndex >= 0) { // this macro contains an individual digit setting char n = pattern.charAt(prefixIndex + macroPart.length()); macro = macro + MACRO_NUMBER_DIGIT_SEPARATOR + n; // depends on control dependency: [if], data = [none] } return pattern.contains(macroStart + macro + macroEnd); } }
public class class_name { public void setNeq(java.util.Collection<String> neq) { if (neq == null) { this.neq = null; return; } this.neq = new java.util.ArrayList<String>(neq); } }
public class class_name { public void setNeq(java.util.Collection<String> neq) { if (neq == null) { this.neq = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.neq = new java.util.ArrayList<String>(neq); } }
public class class_name { void findEntries(ListIterator<PathElement> iterator, Collection<NotificationHandler> handlers, Notification notification) { if (!iterator.hasNext()) { for (ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry : entries) { if (entry.getFilter().isNotificationEnabled(notification)) { handlers.add(entry.getHandler()); } } return; } PathElement next = iterator.next(); try { final NotificationHandlerNodeSubregistry subregistry = children.get(next.getKey()); if (subregistry == null) { return; } subregistry.findHandlers(iterator, next.getValue(), notification, handlers); } finally { iterator.previous(); } } }
public class class_name { void findEntries(ListIterator<PathElement> iterator, Collection<NotificationHandler> handlers, Notification notification) { if (!iterator.hasNext()) { for (ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry : entries) { if (entry.getFilter().isNotificationEnabled(notification)) { handlers.add(entry.getHandler()); // depends on control dependency: [if], data = [none] } } return; // depends on control dependency: [if], data = [none] } PathElement next = iterator.next(); try { final NotificationHandlerNodeSubregistry subregistry = children.get(next.getKey()); if (subregistry == null) { return; // depends on control dependency: [if], data = [none] } subregistry.findHandlers(iterator, next.getValue(), notification, handlers); // depends on control dependency: [try], data = [none] } finally { iterator.previous(); } } }
public class class_name { private Bucket getBucket(String bucketName) throws IOException { logger.atFine().log("getBucket(%s)", bucketName); checkArgument(!Strings.isNullOrEmpty(bucketName), "bucketName must not be null or empty"); Storage.Buckets.Get getBucket = configureRequest(gcs.buckets().get(bucketName), bucketName); try { return getBucket.execute(); } catch (IOException e) { if (errorExtractor.itemNotFound(e)) { logger.atFine().withCause(e).log("getBucket(%s): not found", bucketName); return null; } throw new IOException("Error accessing Bucket " + bucketName, e); } } }
public class class_name { private Bucket getBucket(String bucketName) throws IOException { logger.atFine().log("getBucket(%s)", bucketName); checkArgument(!Strings.isNullOrEmpty(bucketName), "bucketName must not be null or empty"); Storage.Buckets.Get getBucket = configureRequest(gcs.buckets().get(bucketName), bucketName); try { return getBucket.execute(); } catch (IOException e) { if (errorExtractor.itemNotFound(e)) { logger.atFine().withCause(e).log("getBucket(%s): not found", bucketName); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } throw new IOException("Error accessing Bucket " + bucketName, e); } } }
public class class_name { private EGLConfig getConfig(int flags, int version) { int renderableType = EGL14.EGL_OPENGL_ES2_BIT; if (version >= 3) { renderableType |= EGLExt.EGL_OPENGL_ES3_BIT_KHR; } // The actual surface is generally RGBA or RGBX, so situationally omitting alpha // doesn't really help. It can also lead to a huge performance hit on glReadPixels() // when reading into a GL_RGBA buffer. int[] attribList = { EGL14.EGL_RED_SIZE, 8, EGL14.EGL_GREEN_SIZE, 8, EGL14.EGL_BLUE_SIZE, 8, EGL14.EGL_ALPHA_SIZE, 8, //EGL14.EGL_DEPTH_SIZE, 16, //EGL14.EGL_STENCIL_SIZE, 8, EGL14.EGL_RENDERABLE_TYPE, renderableType, EGL14.EGL_NONE, 0, // placeholder for recordable [@-3] EGL14.EGL_NONE }; if ((flags & FLAG_RECORDABLE) != 0) { attribList[attribList.length - 3] = EGL_RECORDABLE_ANDROID; attribList[attribList.length - 2] = 1; } EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) { Log.w(TAG, "unable to find RGB8888 / " + version + " EGLConfig"); return null; } return configs[0]; } }
public class class_name { private EGLConfig getConfig(int flags, int version) { int renderableType = EGL14.EGL_OPENGL_ES2_BIT; if (version >= 3) { renderableType |= EGLExt.EGL_OPENGL_ES3_BIT_KHR; // depends on control dependency: [if], data = [none] } // The actual surface is generally RGBA or RGBX, so situationally omitting alpha // doesn't really help. It can also lead to a huge performance hit on glReadPixels() // when reading into a GL_RGBA buffer. int[] attribList = { EGL14.EGL_RED_SIZE, 8, EGL14.EGL_GREEN_SIZE, 8, EGL14.EGL_BLUE_SIZE, 8, EGL14.EGL_ALPHA_SIZE, 8, //EGL14.EGL_DEPTH_SIZE, 16, //EGL14.EGL_STENCIL_SIZE, 8, EGL14.EGL_RENDERABLE_TYPE, renderableType, EGL14.EGL_NONE, 0, // placeholder for recordable [@-3] EGL14.EGL_NONE }; if ((flags & FLAG_RECORDABLE) != 0) { attribList[attribList.length - 3] = EGL_RECORDABLE_ANDROID; // depends on control dependency: [if], data = [none] attribList[attribList.length - 2] = 1; // depends on control dependency: [if], data = [none] } EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; if (!EGL14.eglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.length, numConfigs, 0)) { Log.w(TAG, "unable to find RGB8888 / " + version + " EGLConfig"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } return configs[0]; } }
public class class_name { public static String toUnicodeLiteral(String s) { StringBuffer result = new StringBuffer(); char[] carr = s.toCharArray(); String unicode; for (int i = 0; i < carr.length; i++) { result.append("\\u"); // append leading zeros unicode = Integer.toHexString(carr[i]).toUpperCase(); for (int j = 4 - unicode.length(); j > 0; j--) { result.append("0"); } result.append(unicode); } return result.toString(); } }
public class class_name { public static String toUnicodeLiteral(String s) { StringBuffer result = new StringBuffer(); char[] carr = s.toCharArray(); String unicode; for (int i = 0; i < carr.length; i++) { result.append("\\u"); // depends on control dependency: [for], data = [none] // append leading zeros unicode = Integer.toHexString(carr[i]).toUpperCase(); // depends on control dependency: [for], data = [i] for (int j = 4 - unicode.length(); j > 0; j--) { result.append("0"); // depends on control dependency: [for], data = [none] } result.append(unicode); // depends on control dependency: [for], data = [none] } return result.toString(); } }
public class class_name { public static Method getValueOfMethod(Class<?> type) { try { return type.getMethod(CoreConstants.VALUE_OF, STING_CLASS_PARAMETER); } catch (NoSuchMethodException e) { return null; } catch (SecurityException e) { return null; } } }
public class class_name { public static Method getValueOfMethod(Class<?> type) { try { return type.getMethod(CoreConstants.VALUE_OF, STING_CLASS_PARAMETER); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { return null; } catch (SecurityException e) { // depends on control dependency: [catch], data = [none] return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<JAXBElement<? extends IntuitEntity>> getIntuitObject() { if (intuitObject == null) { intuitObject = new ArrayList<JAXBElement<? extends IntuitEntity>>(); } return this.intuitObject; } }
public class class_name { public List<JAXBElement<? extends IntuitEntity>> getIntuitObject() { if (intuitObject == null) { intuitObject = new ArrayList<JAXBElement<? extends IntuitEntity>>(); // depends on control dependency: [if], data = [none] } return this.intuitObject; } }
public class class_name { private void processPages() { PageIterator pageIter = new PageIterator(getWiki(), true, pageBuffer); int pageCounter = 0; while (pageIter.hasNext()) { pageCounter++; if (pageCounter % VERBOSITY == 0) { logger.info("{} pages processed ...", pageCounter); } Page curPage = pageIter.next(); int curPageId = curPage.getPageId(); fillMapWithTemplateData(curPage.getText(), pageFilter, curPageId, TPLNAME_TO_PAGEIDS); } } }
public class class_name { private void processPages() { PageIterator pageIter = new PageIterator(getWiki(), true, pageBuffer); int pageCounter = 0; while (pageIter.hasNext()) { pageCounter++; // depends on control dependency: [while], data = [none] if (pageCounter % VERBOSITY == 0) { logger.info("{} pages processed ...", pageCounter); // depends on control dependency: [if], data = [none] } Page curPage = pageIter.next(); int curPageId = curPage.getPageId(); fillMapWithTemplateData(curPage.getText(), pageFilter, curPageId, TPLNAME_TO_PAGEIDS); // depends on control dependency: [while], data = [none] } } }
public class class_name { protected final void initApplicationMenuBar(final MenuBar menuBar) { menuBar.removeItems(); menuBar.setWidth(MENU_BAR_WIDTH); menuBar.setStyleName(HEADER_STYLE_NAME); final MenuItem mainViewItem = menuBar.addItem(APPLICATION, VaadinIcons.SERVER, null); mainViewItem.addItem(START_TEXT, VaadinIcons.STAR, COMMAND_MAINVIEW_OVERVIEW); final MenuItem mainItem = mainViewItem.addItem(MAIN, VaadinIcons.STAR, null); mainItem.addItem(PAGE_VISIT_HISTORY_TEXT, VaadinIcons.LINE_CHART, COMMAND_MAINVIEW_PAGEVISITHISTORY); if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) { mainViewItem.addItem(USERHOME, VaadinIcons.USER,COMMAND_USERHOME); createAdminMenu(mainViewItem); mainViewItem.addItem(LOGOUT, VaadinIcons.SIGN_OUT, COMMAND_LOGOUT); } else { mainViewItem.addItem(LOGIN, VaadinIcons.SIGN_IN, COMMAND_LOGIN); mainViewItem.addItem(REGISTER, VaadinIcons.FILE_ADD, COMMAND_REGISTER); } } }
public class class_name { protected final void initApplicationMenuBar(final MenuBar menuBar) { menuBar.removeItems(); menuBar.setWidth(MENU_BAR_WIDTH); menuBar.setStyleName(HEADER_STYLE_NAME); final MenuItem mainViewItem = menuBar.addItem(APPLICATION, VaadinIcons.SERVER, null); mainViewItem.addItem(START_TEXT, VaadinIcons.STAR, COMMAND_MAINVIEW_OVERVIEW); final MenuItem mainItem = mainViewItem.addItem(MAIN, VaadinIcons.STAR, null); mainItem.addItem(PAGE_VISIT_HISTORY_TEXT, VaadinIcons.LINE_CHART, COMMAND_MAINVIEW_PAGEVISITHISTORY); if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) { mainViewItem.addItem(USERHOME, VaadinIcons.USER,COMMAND_USERHOME); // depends on control dependency: [if], data = [none] createAdminMenu(mainViewItem); // depends on control dependency: [if], data = [none] mainViewItem.addItem(LOGOUT, VaadinIcons.SIGN_OUT, COMMAND_LOGOUT); // depends on control dependency: [if], data = [none] } else { mainViewItem.addItem(LOGIN, VaadinIcons.SIGN_IN, COMMAND_LOGIN); // depends on control dependency: [if], data = [none] mainViewItem.addItem(REGISTER, VaadinIcons.FILE_ADD, COMMAND_REGISTER); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings({"PMD.ExcessiveMethodLength", "PMD.NPathComplexity", "PMD.CyclomaticComplexity", "PMD.StdCyclomaticComplexity", "PMD.ModifiedCyclomaticComplexity"}) // CHECKSTYLE:ON public static CommonProperties build(final Map<String, ?> properties) { Validate.notNull(properties, "The validated object 'properties' is null"); final CommonProperties commonProps = new CommonProperties(); String tmp = getOption(KEY_AUDIT_CLASS_NAME, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setAuditClassName(tmp); logValue(KEY_AUDIT_CLASS_NAME, tmp); } else { commonProps.setAuditClassName(DEFAULT_AUDIT_CLASS_NAME); logDefault(KEY_AUDIT_CLASS_NAME, DEFAULT_AUDIT_CLASS_NAME); } tmp = getOption(KEY_AUDIT_IS_ENABLED, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setAuditEnabled(Boolean.parseBoolean(tmp)); logValue(KEY_AUDIT_IS_ENABLED, tmp); } else { commonProps.setAuditEnabled(DEFAULT_AUDIT_IS_ENABLED); logDefault(KEY_AUDIT_IS_ENABLED, String.valueOf(DEFAULT_AUDIT_IS_ENABLED)); } tmp = getOption(KEY_AUDIT_IS_SINGLETON, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setAuditSingleton(Boolean.parseBoolean(tmp)); logValue(KEY_AUDIT_IS_SINGLETON, tmp); } else { commonProps.setAuditSingleton(DEFAULT_AUDIT_IS_SINGLETON); logDefault(KEY_AUDIT_IS_SINGLETON, String.valueOf(DEFAULT_AUDIT_IS_SINGLETON)); } tmp = getOption(KEY_MESSAGEQ_CLASS_NAME, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setMessageQueueClassName(tmp); logValue(KEY_MESSAGEQ_CLASS_NAME, tmp); } else { commonProps.setMessageQueueClassName(DEFAULT_MESSAGEQ_CLASS_NAME); logDefault(KEY_MESSAGEQ_CLASS_NAME, DEFAULT_MESSAGEQ_CLASS_NAME); } tmp = getOption(KEY_MESSAGEQ_IS_ENABLED, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setMessageQueueEnabled(Boolean.parseBoolean(tmp)); logValue(KEY_MESSAGEQ_IS_ENABLED, tmp); } else { commonProps.setMessageQueueEnabled(DEFAULT_MESSAGEQ_IS_ENABLED); logDefault(KEY_MESSAGEQ_IS_ENABLED, String.valueOf(DEFAULT_MESSAGEQ_IS_ENABLED)); } tmp = getOption(KEY_MESSAGEQ_IS_SINGLETON, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setMessageQueueSingleton(Boolean.parseBoolean(tmp)); logValue(KEY_MESSAGEQ_IS_SINGLETON, tmp); } else { commonProps.setMessageQueueSingleton(DEFAULT_MESSAGEQ_IS_SINGLETON); logDefault(KEY_MESSAGEQ_IS_SINGLETON, String.valueOf(DEFAULT_MESSAGEQ_IS_SINGLETON)); } tmp = getOption(KEY_PASSWORD_AUTHENTICATOR_CLASS_NAME, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setPasswordAuthenticatorClassName(tmp); logValue(KEY_PASSWORD_AUTHENTICATOR_CLASS_NAME, tmp); } else { commonProps.setPasswordAuthenticatorClassName(DEFAULT_PASSWORD_AUTHENTICATOR_CLASS_NAME); logDefault(KEY_PASSWORD_AUTHENTICATOR_CLASS_NAME, DEFAULT_PASSWORD_AUTHENTICATOR_CLASS_NAME); } tmp = getOption(KEY_PASSWORD_AUTHENTICATOR_IS_SINGLETON, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setPasswordAuthenticatorSingleton(Boolean.parseBoolean(tmp)); logValue(KEY_PASSWORD_AUTHENTICATOR_IS_SINGLETON, tmp); } else { commonProps.setPasswordAuthenticatorSingleton(DEFAULT_PASSWORD_AUTHENTICATOR_IS_SINGLETON); logDefault(KEY_PASSWORD_AUTHENTICATOR_IS_SINGLETON, String.valueOf(DEFAULT_PASSWORD_AUTHENTICATOR_IS_SINGLETON)); } tmp = getOption(KEY_PASSWORD_VALIDATOR_CLASS_NAME, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setPasswordValidatorClassName(tmp); logValue(KEY_PASSWORD_VALIDATOR_CLASS_NAME, tmp); } else { commonProps.setPasswordValidatorClassName(DEFAULT_PASSWORD_VALIDATOR_CLASS_NAME); logDefault(KEY_PASSWORD_VALIDATOR_CLASS_NAME, DEFAULT_PASSWORD_VALIDATOR_CLASS_NAME); } tmp = getOption(KEY_PASSWORD_VALIDATOR_IS_SINGLETON, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setPasswordValidatorSingleton(Boolean.parseBoolean(tmp)); logValue(KEY_PASSWORD_VALIDATOR_IS_SINGLETON, tmp); } else { commonProps.setPasswordValidatorSingleton(DEFAULT_PASSWORD_VALIDATOR_IS_SINGLETON); logDefault(KEY_PASSWORD_VALIDATOR_IS_SINGLETON, String.valueOf(DEFAULT_PASSWORD_VALIDATOR_IS_SINGLETON)); } // set the additional properties, preserving the originally provided properties // create a defensive copy of the map and all its properties // the code looks a little more complicated than a simple "putAll()", but it catches situations // where a Map is provided that supports null values (e.g. a HashMap) vs Map implementations // that do not (e.g. ConcurrentHashMap). final Map<String, String> tempMap = new ConcurrentHashMap<>(); try { for (final Map.Entry<String, ?> entry : properties.entrySet()) { final String key = entry.getKey(); final String value = (String) entry.getValue(); if (value != null) { tempMap.put(key, value); } } } catch (ClassCastException e) { final String error = "The values of the configured JAAS properties must be Strings. " + "Sorry, but we do not support anything else here!"; throw new IllegalArgumentException(error, e); } commonProps.setAdditionalProperties(tempMap); return commonProps; } }
public class class_name { @SuppressWarnings({"PMD.ExcessiveMethodLength", "PMD.NPathComplexity", "PMD.CyclomaticComplexity", "PMD.StdCyclomaticComplexity", "PMD.ModifiedCyclomaticComplexity"}) // CHECKSTYLE:ON public static CommonProperties build(final Map<String, ?> properties) { Validate.notNull(properties, "The validated object 'properties' is null"); final CommonProperties commonProps = new CommonProperties(); String tmp = getOption(KEY_AUDIT_CLASS_NAME, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setAuditClassName(tmp); // depends on control dependency: [if], data = [none] logValue(KEY_AUDIT_CLASS_NAME, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setAuditClassName(DEFAULT_AUDIT_CLASS_NAME); // depends on control dependency: [if], data = [none] logDefault(KEY_AUDIT_CLASS_NAME, DEFAULT_AUDIT_CLASS_NAME); // depends on control dependency: [if], data = [none] } tmp = getOption(KEY_AUDIT_IS_ENABLED, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setAuditEnabled(Boolean.parseBoolean(tmp)); // depends on control dependency: [if], data = [none] logValue(KEY_AUDIT_IS_ENABLED, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setAuditEnabled(DEFAULT_AUDIT_IS_ENABLED); // depends on control dependency: [if], data = [none] logDefault(KEY_AUDIT_IS_ENABLED, String.valueOf(DEFAULT_AUDIT_IS_ENABLED)); // depends on control dependency: [if], data = [none] } tmp = getOption(KEY_AUDIT_IS_SINGLETON, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setAuditSingleton(Boolean.parseBoolean(tmp)); // depends on control dependency: [if], data = [none] logValue(KEY_AUDIT_IS_SINGLETON, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setAuditSingleton(DEFAULT_AUDIT_IS_SINGLETON); // depends on control dependency: [if], data = [none] logDefault(KEY_AUDIT_IS_SINGLETON, String.valueOf(DEFAULT_AUDIT_IS_SINGLETON)); // depends on control dependency: [if], data = [none] } tmp = getOption(KEY_MESSAGEQ_CLASS_NAME, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setMessageQueueClassName(tmp); // depends on control dependency: [if], data = [none] logValue(KEY_MESSAGEQ_CLASS_NAME, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setMessageQueueClassName(DEFAULT_MESSAGEQ_CLASS_NAME); // depends on control dependency: [if], data = [none] logDefault(KEY_MESSAGEQ_CLASS_NAME, DEFAULT_MESSAGEQ_CLASS_NAME); // depends on control dependency: [if], data = [none] } tmp = getOption(KEY_MESSAGEQ_IS_ENABLED, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setMessageQueueEnabled(Boolean.parseBoolean(tmp)); // depends on control dependency: [if], data = [none] logValue(KEY_MESSAGEQ_IS_ENABLED, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setMessageQueueEnabled(DEFAULT_MESSAGEQ_IS_ENABLED); // depends on control dependency: [if], data = [none] logDefault(KEY_MESSAGEQ_IS_ENABLED, String.valueOf(DEFAULT_MESSAGEQ_IS_ENABLED)); // depends on control dependency: [if], data = [none] } tmp = getOption(KEY_MESSAGEQ_IS_SINGLETON, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setMessageQueueSingleton(Boolean.parseBoolean(tmp)); // depends on control dependency: [if], data = [none] logValue(KEY_MESSAGEQ_IS_SINGLETON, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setMessageQueueSingleton(DEFAULT_MESSAGEQ_IS_SINGLETON); // depends on control dependency: [if], data = [none] logDefault(KEY_MESSAGEQ_IS_SINGLETON, String.valueOf(DEFAULT_MESSAGEQ_IS_SINGLETON)); // depends on control dependency: [if], data = [none] } tmp = getOption(KEY_PASSWORD_AUTHENTICATOR_CLASS_NAME, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setPasswordAuthenticatorClassName(tmp); // depends on control dependency: [if], data = [none] logValue(KEY_PASSWORD_AUTHENTICATOR_CLASS_NAME, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setPasswordAuthenticatorClassName(DEFAULT_PASSWORD_AUTHENTICATOR_CLASS_NAME); // depends on control dependency: [if], data = [none] logDefault(KEY_PASSWORD_AUTHENTICATOR_CLASS_NAME, DEFAULT_PASSWORD_AUTHENTICATOR_CLASS_NAME); // depends on control dependency: [if], data = [none] } tmp = getOption(KEY_PASSWORD_AUTHENTICATOR_IS_SINGLETON, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setPasswordAuthenticatorSingleton(Boolean.parseBoolean(tmp)); // depends on control dependency: [if], data = [none] logValue(KEY_PASSWORD_AUTHENTICATOR_IS_SINGLETON, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setPasswordAuthenticatorSingleton(DEFAULT_PASSWORD_AUTHENTICATOR_IS_SINGLETON); // depends on control dependency: [if], data = [none] logDefault(KEY_PASSWORD_AUTHENTICATOR_IS_SINGLETON, String.valueOf(DEFAULT_PASSWORD_AUTHENTICATOR_IS_SINGLETON)); // depends on control dependency: [if], data = [none] } tmp = getOption(KEY_PASSWORD_VALIDATOR_CLASS_NAME, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setPasswordValidatorClassName(tmp); // depends on control dependency: [if], data = [none] logValue(KEY_PASSWORD_VALIDATOR_CLASS_NAME, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setPasswordValidatorClassName(DEFAULT_PASSWORD_VALIDATOR_CLASS_NAME); // depends on control dependency: [if], data = [none] logDefault(KEY_PASSWORD_VALIDATOR_CLASS_NAME, DEFAULT_PASSWORD_VALIDATOR_CLASS_NAME); // depends on control dependency: [if], data = [none] } tmp = getOption(KEY_PASSWORD_VALIDATOR_IS_SINGLETON, properties); if (StringUtils.isNotEmpty(tmp)) { commonProps.setPasswordValidatorSingleton(Boolean.parseBoolean(tmp)); // depends on control dependency: [if], data = [none] logValue(KEY_PASSWORD_VALIDATOR_IS_SINGLETON, tmp); // depends on control dependency: [if], data = [none] } else { commonProps.setPasswordValidatorSingleton(DEFAULT_PASSWORD_VALIDATOR_IS_SINGLETON); // depends on control dependency: [if], data = [none] logDefault(KEY_PASSWORD_VALIDATOR_IS_SINGLETON, String.valueOf(DEFAULT_PASSWORD_VALIDATOR_IS_SINGLETON)); // depends on control dependency: [if], data = [none] } // set the additional properties, preserving the originally provided properties // create a defensive copy of the map and all its properties // the code looks a little more complicated than a simple "putAll()", but it catches situations // where a Map is provided that supports null values (e.g. a HashMap) vs Map implementations // that do not (e.g. ConcurrentHashMap). final Map<String, String> tempMap = new ConcurrentHashMap<>(); try { for (final Map.Entry<String, ?> entry : properties.entrySet()) { final String key = entry.getKey(); final String value = (String) entry.getValue(); if (value != null) { tempMap.put(key, value); // depends on control dependency: [if], data = [none] } } } catch (ClassCastException e) { final String error = "The values of the configured JAAS properties must be Strings. " + "Sorry, but we do not support anything else here!"; throw new IllegalArgumentException(error, e); } // depends on control dependency: [catch], data = [none] commonProps.setAdditionalProperties(tempMap); return commonProps; } }
public class class_name { public Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>> listWithServiceResponseAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions) { return listSinglePageAsync(poolId, computeNodeListOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>, Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>> call(ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } ComputeNodeListNextOptions computeNodeListNextOptions = null; if (computeNodeListOptions != null) { computeNodeListNextOptions = new ComputeNodeListNextOptions(); computeNodeListNextOptions.withClientRequestId(computeNodeListOptions.clientRequestId()); computeNodeListNextOptions.withReturnClientRequestId(computeNodeListOptions.returnClientRequestId()); computeNodeListNextOptions.withOcpDate(computeNodeListOptions.ocpDate()); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, computeNodeListNextOptions)); } }); } }
public class class_name { public Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>> listWithServiceResponseAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions) { return listSinglePageAsync(poolId, computeNodeListOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>, Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>> call(ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } ComputeNodeListNextOptions computeNodeListNextOptions = null; if (computeNodeListOptions != null) { computeNodeListNextOptions = new ComputeNodeListNextOptions(); // depends on control dependency: [if], data = [none] computeNodeListNextOptions.withClientRequestId(computeNodeListOptions.clientRequestId()); // depends on control dependency: [if], data = [(computeNodeListOptions] computeNodeListNextOptions.withReturnClientRequestId(computeNodeListOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(computeNodeListOptions] computeNodeListNextOptions.withOcpDate(computeNodeListOptions.ocpDate()); // depends on control dependency: [if], data = [(computeNodeListOptions] } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, computeNodeListNextOptions)); } }); } }
public class class_name { public void marshall(JobCommand jobCommand, ProtocolMarshaller protocolMarshaller) { if (jobCommand == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(jobCommand.getName(), NAME_BINDING); protocolMarshaller.marshall(jobCommand.getScriptLocation(), SCRIPTLOCATION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(JobCommand jobCommand, ProtocolMarshaller protocolMarshaller) { if (jobCommand == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(jobCommand.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(jobCommand.getScriptLocation(), SCRIPTLOCATION_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // get the method parameters and "type" ManagementMethodInvocation managementMethod = new ManagementMethodInvocation(method, args); // if it's not a method that requires policy cache modifications, quit if (managementMethod.action.equals(ManagementMethodInvocation.Action.NA)) return invokeTarget(target, method, args); Object returnValue = null; // holds the state of the Fedora policy object before and after the API method is invoked PolicyObject policyBefore = null; PolicyObject policyAfter = null; // validation note: // validation is carried out as part of the API methods // policy index update occurs after the management method has been invoked // therefore if a validation error occurs the object will not have changed, // and the resulting exception means the policy index won't be updated (and therefore remain in sync) switch (managementMethod.target) { case DIGITALOBJECT: // API methods operating on the object switch (managementMethod.component) { case STATE: // object state change // if the requested object state is null, then there's no state change - no change to policy index if (managementMethod.parameters.objectState != null && managementMethod.parameters.objectState.length() > 0) { // get the "before" object and determine if it was indexed in the cache policyBefore = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, null, null); boolean indexedBefore = policyBefore.isPolicyActive(); returnValue = invokeTarget(target, method, args); // get the object after the state change and determine if it should be indexed policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, managementMethod.parameters.objectState, null, null); // if the indexing status has changed, make appropriate changes to the policy cache/index if (indexedBefore != policyAfter.isPolicyActive()) { if (policyAfter.isPolicyActive() ) { addPolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); } else { deletePolicy(managementMethod.parameters.pid); } } } break; case CONTENT: // object ingest or purge switch (managementMethod.action){ case CREATE: // ingest // do the API call returnValue = invokeTarget(target, method, args); // get the ingested policy - note ingested object PID is the return value policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, (String)returnValue, null, null, null); // add to the cache if required if (policyAfter.isPolicyActive()) { addPolicy((String)returnValue, policyAfter.getDsContent()); } break; case DELETE: // purge // get the policy object that existed prior to ingest and see if it was indexed policyBefore = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, null, null); boolean wasIndexed = policyBefore.isPolicyActive(); // do the API call returnValue = invokeTarget(target, method, args); // if the policy was indexed, delete it from the cache/index if (wasIndexed) deletePolicy(managementMethod.parameters.pid); break; default: } break; default: } break; case DATASTREAM: // operations on datastreams // note, DS ID can be null - server-assigned ID if (managementMethod.parameters.dsID != null && managementMethod.parameters.dsID.equals(FedoraPolicyStore.FESL_POLICY_DATASTREAM)) { switch (managementMethod.component) { case STATE: // datastream state change // get the object prior to the API call and see if it was indexed/cached policyBefore = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, null); boolean wasIndexed = policyBefore.isPolicyActive(); // do the API call returnValue = invokeTarget(target, method, args); // the object after the call policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, managementMethod.parameters.dsState); // if indexing status has changed, update the cache/index if (wasIndexed != policyAfter.isPolicyActive()) { if (policyAfter.isPolicyActive()) { addPolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); } else { deletePolicy(managementMethod.parameters.pid); } } break; case CONTENT: // datastream add, modify, purge switch (managementMethod.action){ case CREATE: // do the API call returnValue = invokeTarget(target, method, args); // get the policy object after the method call policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, managementMethod.parameters.dsState); if (policyAfter.isPolicyActive()) addPolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); break; case DELETE: // get the policy object before the call and see if it was indexed policyBefore = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, managementMethod.parameters.dsState); wasIndexed = policyBefore.isPolicyActive(); // invoke the method returnValue = invokeTarget(target, method, args); policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, null); if (wasIndexed) { //if policy is still active after, only a version was purged and the policy has changed. Update if (policyAfter.isPolicyActive()) { updatePolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); //policy is not active after, then it was deleted and needs to be removed from index. } else { deletePolicy(managementMethod.parameters.pid); } } break; case UPDATE: // do the API call, get the policy object after the call returnValue = invokeTarget(target, method, args); policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, null); if (policyAfter.isPolicyActive()) updatePolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); break; default: } break; default: } } break; default: } // if API call not made as part of the above (ie no action was required on policy cache), do it now if (returnValue == null) returnValue = invokeTarget(target,method, args); return returnValue; } }
public class class_name { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // get the method parameters and "type" ManagementMethodInvocation managementMethod = new ManagementMethodInvocation(method, args); // if it's not a method that requires policy cache modifications, quit if (managementMethod.action.equals(ManagementMethodInvocation.Action.NA)) return invokeTarget(target, method, args); Object returnValue = null; // holds the state of the Fedora policy object before and after the API method is invoked PolicyObject policyBefore = null; PolicyObject policyAfter = null; // validation note: // validation is carried out as part of the API methods // policy index update occurs after the management method has been invoked // therefore if a validation error occurs the object will not have changed, // and the resulting exception means the policy index won't be updated (and therefore remain in sync) switch (managementMethod.target) { case DIGITALOBJECT: // API methods operating on the object switch (managementMethod.component) { case STATE: // object state change // if the requested object state is null, then there's no state change - no change to policy index if (managementMethod.parameters.objectState != null && managementMethod.parameters.objectState.length() > 0) { // get the "before" object and determine if it was indexed in the cache policyBefore = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, null, null); // depends on control dependency: [if], data = [none] boolean indexedBefore = policyBefore.isPolicyActive(); returnValue = invokeTarget(target, method, args); // depends on control dependency: [if], data = [none] // get the object after the state change and determine if it should be indexed policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, managementMethod.parameters.objectState, null, null); // depends on control dependency: [if], data = [none] // if the indexing status has changed, make appropriate changes to the policy cache/index if (indexedBefore != policyAfter.isPolicyActive()) { if (policyAfter.isPolicyActive() ) { addPolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); // depends on control dependency: [if], data = [none] } else { deletePolicy(managementMethod.parameters.pid); // depends on control dependency: [if], data = [none] } } } break; case CONTENT: // object ingest or purge switch (managementMethod.action){ case CREATE: // ingest // do the API call returnValue = invokeTarget(target, method, args); // get the ingested policy - note ingested object PID is the return value policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, (String)returnValue, null, null, null); // add to the cache if required if (policyAfter.isPolicyActive()) { addPolicy((String)returnValue, policyAfter.getDsContent()); // depends on control dependency: [if], data = [none] } break; case DELETE: // purge // get the policy object that existed prior to ingest and see if it was indexed policyBefore = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, null, null); boolean wasIndexed = policyBefore.isPolicyActive(); // do the API call returnValue = invokeTarget(target, method, args); // if the policy was indexed, delete it from the cache/index if (wasIndexed) deletePolicy(managementMethod.parameters.pid); break; default: } break; default: } break; case DATASTREAM: // operations on datastreams // note, DS ID can be null - server-assigned ID if (managementMethod.parameters.dsID != null && managementMethod.parameters.dsID.equals(FedoraPolicyStore.FESL_POLICY_DATASTREAM)) { switch (managementMethod.component) { case STATE: // datastream state change // get the object prior to the API call and see if it was indexed/cached policyBefore = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, null); boolean wasIndexed = policyBefore.isPolicyActive(); // do the API call returnValue = invokeTarget(target, method, args); // the object after the call policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, managementMethod.parameters.dsState); // if indexing status has changed, update the cache/index if (wasIndexed != policyAfter.isPolicyActive()) { if (policyAfter.isPolicyActive()) { addPolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); // depends on control dependency: [if], data = [none] } else { deletePolicy(managementMethod.parameters.pid); // depends on control dependency: [if], data = [none] } } break; case CONTENT: // datastream add, modify, purge switch (managementMethod.action){ case CREATE: // do the API call returnValue = invokeTarget(target, method, args); // get the policy object after the method call policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, managementMethod.parameters.dsState); if (policyAfter.isPolicyActive()) addPolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); break; case DELETE: // get the policy object before the call and see if it was indexed policyBefore = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, managementMethod.parameters.dsState); wasIndexed = policyBefore.isPolicyActive(); // invoke the method returnValue = invokeTarget(target, method, args); policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, null); if (wasIndexed) { //if policy is still active after, only a version was purged and the policy has changed. Update if (policyAfter.isPolicyActive()) { updatePolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); // depends on control dependency: [if], data = [none] //policy is not active after, then it was deleted and needs to be removed from index. } else { deletePolicy(managementMethod.parameters.pid); // depends on control dependency: [if], data = [none] } } break; case UPDATE: // do the API call, get the policy object after the call returnValue = invokeTarget(target, method, args); policyAfter = new PolicyObject(m_DOManager, managementMethod.parameters.context, managementMethod.parameters.pid, null, managementMethod.parameters.dsID, null); if (policyAfter.isPolicyActive()) updatePolicy(managementMethod.parameters.pid, policyAfter.getDsContent()); break; default: } break; default: } } break; default: } // if API call not made as part of the above (ie no action was required on policy cache), do it now if (returnValue == null) returnValue = invokeTarget(target,method, args); return returnValue; } }
public class class_name { @Override public String handle(final Object value) { if (value instanceof NominatimRequest) { return ((NominatimRequest) value).getQueryString(); } else { return value.toString(); } } }
public class class_name { @Override public String handle(final Object value) { if (value instanceof NominatimRequest) { return ((NominatimRequest) value).getQueryString(); // depends on control dependency: [if], data = [none] } else { return value.toString(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void writeExcelFile() throws IOException, WriteException { WritableWorkbook excelWrkBook = null; int curDsPointer = 0; try { final String[] columnNames = ds.getColumns(); final List<String> exportOnlyColumnsList = getExportOnlyColumns() != null ? Arrays.asList(exportOnlyColumns) : null; final List<String> excludeFromExportColumnsList = getExcludeFromExportColumns() != null ? Arrays.asList(excludeFromExportColumns) : null; final List<String> numericColumnList = getNumericColumns() != null ? Arrays.asList(getNumericColumns()) : new ArrayList<>(); // get the current position of the DataSet. We have to go to the top // to do this write, // and we will put the pionter back where it was after we are done curDsPointer = ds.getIndex(); ds.goTop(); excelWrkBook = Workbook.createWorkbook(xlsFile); final WritableSheet wrkSheet = excelWrkBook.createSheet("results", 0); final WritableFont times10ptBold = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD); final WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10, WritableFont.NO_BOLD); // write the column headings in the spreadsheet WritableCellFormat cellFormat = new WritableCellFormat(times10ptBold); int colOffset = 0; for (int i = 0; i < columnNames.length; i++) { if (exportOnlyColumnsList != null && !exportOnlyColumnsList.contains(columnNames[i]) || excludeFromExportColumnsList != null && excludeFromExportColumnsList.contains(columnNames[i])) { colOffset++; continue; } final Label xlsTextLbl = new Label(i - colOffset, 0, columnNames[i], cellFormat); wrkSheet.addCell(xlsTextLbl); } cellFormat = new WritableCellFormat(times10pt); int row = 1; while (ds.next()) { if (!ds.isRecordID(FPConstants.DETAIL_ID)) { continue; } colOffset = 0; for (int i = 0; i < columnNames.length; i++) { if (exportOnlyColumnsList != null && !exportOnlyColumnsList.contains(columnNames[i]) || excludeFromExportColumnsList != null && excludeFromExportColumnsList.contains(columnNames[i])) { colOffset++; continue; } WritableCell wc = null; if (numericColumnList.contains(columnNames[i])) { wc = new Number(i - colOffset, row, ds.getDouble(columnNames[i]), cellFormat); } else { wc = new Label(i - colOffset, row, ds.getString(columnNames[i]), cellFormat); } wrkSheet.addCell(wc); } row++; } excelWrkBook.write(); } finally { if (curDsPointer > -1) { ds.absolute(curDsPointer); } if (excelWrkBook != null) { excelWrkBook.close(); } } } }
public class class_name { public void writeExcelFile() throws IOException, WriteException { WritableWorkbook excelWrkBook = null; int curDsPointer = 0; try { final String[] columnNames = ds.getColumns(); final List<String> exportOnlyColumnsList = getExportOnlyColumns() != null ? Arrays.asList(exportOnlyColumns) : null; final List<String> excludeFromExportColumnsList = getExcludeFromExportColumns() != null ? Arrays.asList(excludeFromExportColumns) : null; final List<String> numericColumnList = getNumericColumns() != null ? Arrays.asList(getNumericColumns()) : new ArrayList<>(); // get the current position of the DataSet. We have to go to the top // to do this write, // and we will put the pionter back where it was after we are done curDsPointer = ds.getIndex(); ds.goTop(); excelWrkBook = Workbook.createWorkbook(xlsFile); final WritableSheet wrkSheet = excelWrkBook.createSheet("results", 0); final WritableFont times10ptBold = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD); final WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10, WritableFont.NO_BOLD); // write the column headings in the spreadsheet WritableCellFormat cellFormat = new WritableCellFormat(times10ptBold); int colOffset = 0; for (int i = 0; i < columnNames.length; i++) { if (exportOnlyColumnsList != null && !exportOnlyColumnsList.contains(columnNames[i]) || excludeFromExportColumnsList != null && excludeFromExportColumnsList.contains(columnNames[i])) { colOffset++; // depends on control dependency: [if], data = [none] continue; } final Label xlsTextLbl = new Label(i - colOffset, 0, columnNames[i], cellFormat); wrkSheet.addCell(xlsTextLbl); // depends on control dependency: [for], data = [none] } cellFormat = new WritableCellFormat(times10pt); int row = 1; while (ds.next()) { if (!ds.isRecordID(FPConstants.DETAIL_ID)) { continue; } colOffset = 0; // depends on control dependency: [while], data = [none] for (int i = 0; i < columnNames.length; i++) { if (exportOnlyColumnsList != null && !exportOnlyColumnsList.contains(columnNames[i]) || excludeFromExportColumnsList != null && excludeFromExportColumnsList.contains(columnNames[i])) { colOffset++; // depends on control dependency: [if], data = [none] continue; } WritableCell wc = null; if (numericColumnList.contains(columnNames[i])) { wc = new Number(i - colOffset, row, ds.getDouble(columnNames[i]), cellFormat); // depends on control dependency: [if], data = [none] } else { wc = new Label(i - colOffset, row, ds.getString(columnNames[i]), cellFormat); // depends on control dependency: [if], data = [none] } wrkSheet.addCell(wc); // depends on control dependency: [for], data = [none] } row++; // depends on control dependency: [while], data = [none] } excelWrkBook.write(); } finally { if (curDsPointer > -1) { ds.absolute(curDsPointer); // depends on control dependency: [if], data = [(curDsPointer] } if (excelWrkBook != null) { excelWrkBook.close(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Q setBean(final String beanName, final Object bean) { if (bean == null) { return _this(); } init(); final String beanNamePrefix = beanName + '.'; query.forEachNamedParameter(p -> { final String paramName = p.name; if (paramName.startsWith(beanNamePrefix)) { final String propertyName = paramName.substring(beanNamePrefix.length()); if (BeanUtil.declared.hasRootProperty(bean, propertyName)) { final Object value = BeanUtil.declared.getProperty(bean, propertyName); setObject(paramName, value); } } }); return _this(); } }
public class class_name { public Q setBean(final String beanName, final Object bean) { if (bean == null) { return _this(); // depends on control dependency: [if], data = [none] } init(); final String beanNamePrefix = beanName + '.'; query.forEachNamedParameter(p -> { final String paramName = p.name; if (paramName.startsWith(beanNamePrefix)) { final String propertyName = paramName.substring(beanNamePrefix.length()); if (BeanUtil.declared.hasRootProperty(bean, propertyName)) { final Object value = BeanUtil.declared.getProperty(bean, propertyName); setObject(paramName, value); // depends on control dependency: [if], data = [none] } } }); return _this(); } }
public class class_name { @Nullable public DirectoryEntry get(Name name) { int index = bucketIndex(name, table.length); DirectoryEntry entry = table[index]; while (entry != null) { if (name.equals(entry.name())) { return entry; } entry = entry.next; } return null; } }
public class class_name { @Nullable public DirectoryEntry get(Name name) { int index = bucketIndex(name, table.length); DirectoryEntry entry = table[index]; while (entry != null) { if (name.equals(entry.name())) { return entry; // depends on control dependency: [if], data = [none] } entry = entry.next; // depends on control dependency: [while], data = [none] } return null; } }
public class class_name { @Override public void addComments(VariableElement field, Content fieldTree) { if (!utils.getFullBody(field).isEmpty()) { writer.addInlineComment(field, fieldTree); } } }
public class class_name { @Override public void addComments(VariableElement field, Content fieldTree) { if (!utils.getFullBody(field).isEmpty()) { writer.addInlineComment(field, fieldTree); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Metadata<Extension> loadExtension(String extensionClass, ClassLoader classloader) { Class<? extends Extension> serviceClass = loadClass(Extension.class, extensionClass, classloader); if (serviceClass == null) { return null; } Extension serviceInstance = prepareInstance(serviceClass); if (serviceInstance == null) { return null; } return new MetadataImpl<Extension>(serviceInstance, extensionClass); } }
public class class_name { public static Metadata<Extension> loadExtension(String extensionClass, ClassLoader classloader) { Class<? extends Extension> serviceClass = loadClass(Extension.class, extensionClass, classloader); if (serviceClass == null) { return null; // depends on control dependency: [if], data = [none] } Extension serviceInstance = prepareInstance(serviceClass); if (serviceInstance == null) { return null; // depends on control dependency: [if], data = [none] } return new MetadataImpl<Extension>(serviceInstance, extensionClass); } }
public class class_name { @Override public void setReadStateToDone() { synchronized (this) { currentState = currentState & READ_DONE_CLEAR_OUT; if (closeWaiting) { this.notify(); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setReadStateToDone"); } } } }
public class class_name { @Override public void setReadStateToDone() { synchronized (this) { currentState = currentState & READ_DONE_CLEAR_OUT; if (closeWaiting) { this.notify(); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setReadStateToDone"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public EClass getIfcFaceOuterBound() { if (ifcFaceOuterBoundEClass == null) { ifcFaceOuterBoundEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(223); } return ifcFaceOuterBoundEClass; } }
public class class_name { public EClass getIfcFaceOuterBound() { if (ifcFaceOuterBoundEClass == null) { ifcFaceOuterBoundEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(223); // depends on control dependency: [if], data = [none] } return ifcFaceOuterBoundEClass; } }
public class class_name { protected void setSummaryObjectEndText(String summaryObjectEndText) { if (summaryObjectEndText == null) { summaryObjectEndText = StringUtils.EMPTY; } this.summaryObjectEndText = summaryObjectEndText; } }
public class class_name { protected void setSummaryObjectEndText(String summaryObjectEndText) { if (summaryObjectEndText == null) { summaryObjectEndText = StringUtils.EMPTY; // depends on control dependency: [if], data = [none] } this.summaryObjectEndText = summaryObjectEndText; } }
public class class_name { @Override public void recordTaskClaim(TaskEntity task) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getHistoricTaskInstanceEntityManager().findById(task.getId()); if (historicTaskInstance != null) { historicTaskInstance.setClaimTime(task.getClaimTime()); } } } }
public class class_name { @Override public void recordTaskClaim(TaskEntity task) { if (isHistoryLevelAtLeast(HistoryLevel.AUDIT)) { HistoricTaskInstanceEntity historicTaskInstance = getHistoricTaskInstanceEntityManager().findById(task.getId()); if (historicTaskInstance != null) { historicTaskInstance.setClaimTime(task.getClaimTime()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static String getContextRelativeURI(final HttpServletRequest pRequest) { String context = pRequest.getContextPath(); if (!StringUtil.isEmpty(context)) { // "" for root context return pRequest.getRequestURI().substring(context.length()); } return pRequest.getRequestURI(); } }
public class class_name { public static String getContextRelativeURI(final HttpServletRequest pRequest) { String context = pRequest.getContextPath(); if (!StringUtil.isEmpty(context)) { // "" for root context return pRequest.getRequestURI().substring(context.length()); // depends on control dependency: [if], data = [none] } return pRequest.getRequestURI(); } }
public class class_name { synchronized ConsumerSessionImpl get(long id) { if (tc.isEntryEnabled()) SibTr.entry(tc, "get", new Long(id)); ConsumerSessionImpl consumer = null ; if( _messageProcessor.isStarted() ) { consumer = (ConsumerSessionImpl) _consumers.get(new Long(id)); } if (tc.isEntryEnabled()) SibTr.exit(tc, "get", consumer); return consumer; } }
public class class_name { synchronized ConsumerSessionImpl get(long id) { if (tc.isEntryEnabled()) SibTr.entry(tc, "get", new Long(id)); ConsumerSessionImpl consumer = null ; if( _messageProcessor.isStarted() ) { consumer = (ConsumerSessionImpl) _consumers.get(new Long(id)); // depends on control dependency: [if], data = [none] } if (tc.isEntryEnabled()) SibTr.exit(tc, "get", consumer); return consumer; } }
public class class_name { private RestrictionLevel getRestrictionLevel(String input) { // Section 5.2 step 1: if (!fAllowedCharsSet.containsAll(input)) { return RestrictionLevel.UNRESTRICTIVE; } // Section 5.2 step 2: if (ASCII.containsAll(input)) { return RestrictionLevel.ASCII; } // Section 5.2 steps 3: ScriptSet resolvedScriptSet = new ScriptSet(); getResolvedScriptSet(input, resolvedScriptSet); // Section 5.2 step 4: if (!resolvedScriptSet.isEmpty()) { return RestrictionLevel.SINGLE_SCRIPT_RESTRICTIVE; } // Section 5.2 step 5: ScriptSet resolvedNoLatn = new ScriptSet(); getResolvedScriptSetWithout(input, UScript.LATIN, resolvedNoLatn); // Section 5.2 step 6: if (resolvedNoLatn.get(UScript.HAN_WITH_BOPOMOFO) || resolvedNoLatn.get(UScript.JAPANESE) || resolvedNoLatn.get(UScript.KOREAN)) { return RestrictionLevel.HIGHLY_RESTRICTIVE; } // Section 5.2 step 7: if (!resolvedNoLatn.isEmpty() && !resolvedNoLatn.get(UScript.CYRILLIC) && !resolvedNoLatn.get(UScript.GREEK) && !resolvedNoLatn.get(UScript.CHEROKEE)) { return RestrictionLevel.MODERATELY_RESTRICTIVE; } // Section 5.2 step 8: return RestrictionLevel.MINIMALLY_RESTRICTIVE; } }
public class class_name { private RestrictionLevel getRestrictionLevel(String input) { // Section 5.2 step 1: if (!fAllowedCharsSet.containsAll(input)) { return RestrictionLevel.UNRESTRICTIVE; // depends on control dependency: [if], data = [none] } // Section 5.2 step 2: if (ASCII.containsAll(input)) { return RestrictionLevel.ASCII; // depends on control dependency: [if], data = [none] } // Section 5.2 steps 3: ScriptSet resolvedScriptSet = new ScriptSet(); getResolvedScriptSet(input, resolvedScriptSet); // Section 5.2 step 4: if (!resolvedScriptSet.isEmpty()) { return RestrictionLevel.SINGLE_SCRIPT_RESTRICTIVE; // depends on control dependency: [if], data = [none] } // Section 5.2 step 5: ScriptSet resolvedNoLatn = new ScriptSet(); getResolvedScriptSetWithout(input, UScript.LATIN, resolvedNoLatn); // Section 5.2 step 6: if (resolvedNoLatn.get(UScript.HAN_WITH_BOPOMOFO) || resolvedNoLatn.get(UScript.JAPANESE) || resolvedNoLatn.get(UScript.KOREAN)) { return RestrictionLevel.HIGHLY_RESTRICTIVE; // depends on control dependency: [if], data = [none] } // Section 5.2 step 7: if (!resolvedNoLatn.isEmpty() && !resolvedNoLatn.get(UScript.CYRILLIC) && !resolvedNoLatn.get(UScript.GREEK) && !resolvedNoLatn.get(UScript.CHEROKEE)) { return RestrictionLevel.MODERATELY_RESTRICTIVE; // depends on control dependency: [if], data = [none] } // Section 5.2 step 8: return RestrictionLevel.MINIMALLY_RESTRICTIVE; } }
public class class_name { public static String replaceBy(CharSequence cs, Map<String, Object> map) { if (null == cs) return null; String str = cs.toString(); if (str.length() == 0) return str; if (null == map || map.isEmpty()) return str; // 准备两个分组 List<String> keys1 = new ArrayList<String>(map.size()); List<String> keys2 = new ArrayList<String>(map.size()); for (Map.Entry<String, Object> en : map.entrySet()) { String key = en.getKey(); // 没值,分作第一组 if (null == en.getValue()) { keys1.add(key); } // 有值,作为第二组 else { keys2.add(key); } } // 准备模式: 0:一组null, 1:一组val, 2: 两组 int mode = -1; // 准备正则表达式 StringBuilder regex = new StringBuilder(); if (keys1.size() > 0) { regex.append("(" + Strings.join("|", keys1) + ")"); mode = 0; } if (keys2.size() > 0) { if (mode < 0) { mode = 1; } else { mode = 2; regex.append('|'); } regex.append("(" + Strings.join("|", keys2) + ")"); } // mode 1,2 的时候才有必要转换吧 if (mode <= 0) return str; // 编译正则表达式 Pattern p = Pattern.compile(regex.toString()); // 准备返回值 StringBuilder sb = new StringBuilder(); int pos = 0; // 匹配字符串 Matcher m = p.matcher(str); while (m.find()) { // 1:一组val if (1 == mode) { // 截取前面的字符串 if (m.start() > pos) { sb.append(str.substring(pos, m.start())); } // 得到 Key,并替换 String key = m.group(1); sb.append(map.get(key)); } // 2: 两组 else { // 如果落到 Null 组了,那么直接 copy if (null != m.group(1)) { sb.append(str.substring(pos, m.end())); } // 否则 else { // 截取前面的字符串 if (m.start() > pos) { sb.append(str.substring(pos, m.start())); } // 得到 Key,并替换 String key = m.group(m.groupCount()); sb.append(map.get(key)); } } // 最后记录一下 pos pos = m.end(); } // 木有匹配,直接返回 if (pos == 0) return str; if (pos < str.length()) sb.append(str.substring(pos)); // 拼上最后一截并返回 return sb.toString(); } }
public class class_name { public static String replaceBy(CharSequence cs, Map<String, Object> map) { if (null == cs) return null; String str = cs.toString(); if (str.length() == 0) return str; if (null == map || map.isEmpty()) return str; // 准备两个分组 List<String> keys1 = new ArrayList<String>(map.size()); List<String> keys2 = new ArrayList<String>(map.size()); for (Map.Entry<String, Object> en : map.entrySet()) { String key = en.getKey(); // 没值,分作第一组 if (null == en.getValue()) { keys1.add(key); // depends on control dependency: [if], data = [none] } // 有值,作为第二组 else { keys2.add(key); // depends on control dependency: [if], data = [none] } } // 准备模式: 0:一组null, 1:一组val, 2: 两组 int mode = -1; // 准备正则表达式 StringBuilder regex = new StringBuilder(); if (keys1.size() > 0) { regex.append("(" + Strings.join("|", keys1) + ")"); mode = 0; // depends on control dependency: [if], data = [none] } if (keys2.size() > 0) { if (mode < 0) { mode = 1; // depends on control dependency: [if], data = [none] } else { mode = 2; // depends on control dependency: [if], data = [none] regex.append('|'); // depends on control dependency: [if], data = [none] } regex.append("(" + Strings.join("|", keys2) + ")"); // depends on control dependency: [if], data = [none] } // mode 1,2 的时候才有必要转换吧 if (mode <= 0) return str; // 编译正则表达式 Pattern p = Pattern.compile(regex.toString()); // 准备返回值 StringBuilder sb = new StringBuilder(); int pos = 0; // 匹配字符串 Matcher m = p.matcher(str); while (m.find()) { // 1:一组val if (1 == mode) { // 截取前面的字符串 if (m.start() > pos) { sb.append(str.substring(pos, m.start())); // depends on control dependency: [if], data = [none] } // 得到 Key,并替换 String key = m.group(1); sb.append(map.get(key)); // depends on control dependency: [if], data = [none] } // 2: 两组 else { // 如果落到 Null 组了,那么直接 copy if (null != m.group(1)) { sb.append(str.substring(pos, m.end())); // depends on control dependency: [if], data = [none] } // 否则 else { // 截取前面的字符串 if (m.start() > pos) { sb.append(str.substring(pos, m.start())); // depends on control dependency: [if], data = [none] } // 得到 Key,并替换 String key = m.group(m.groupCount()); sb.append(map.get(key)); // depends on control dependency: [if], data = [none] } } // 最后记录一下 pos pos = m.end(); // depends on control dependency: [while], data = [none] } // 木有匹配,直接返回 if (pos == 0) return str; if (pos < str.length()) sb.append(str.substring(pos)); // 拼上最后一截并返回 return sb.toString(); } }
public class class_name { @Override public void onConfigurationChanged(Configuration newConfig) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { super.onConfigurationChanged(newConfig); } else if (mMenuView != null) { mMenuView.onConfigurationChanged(newConfig); } // Action bar can change size on configuration changes. // Reread the desired height from the theme-specified style. TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.SherlockActionBar, R.attr.actionBarStyle, 0); setContentHeight(a.getLayoutDimension(R.styleable.SherlockActionBar_height, 0)); a.recycle(); if (mSplitWhenNarrow) { setSplitActionBar(getResources_getBoolean(getContext(), R.bool.abs__split_action_bar_is_narrow)); } if (mActionMenuPresenter != null) { mActionMenuPresenter.onConfigurationChanged(newConfig); } } }
public class class_name { @Override public void onConfigurationChanged(Configuration newConfig) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { super.onConfigurationChanged(newConfig); // depends on control dependency: [if], data = [none] } else if (mMenuView != null) { mMenuView.onConfigurationChanged(newConfig); // depends on control dependency: [if], data = [none] } // Action bar can change size on configuration changes. // Reread the desired height from the theme-specified style. TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.SherlockActionBar, R.attr.actionBarStyle, 0); setContentHeight(a.getLayoutDimension(R.styleable.SherlockActionBar_height, 0)); a.recycle(); if (mSplitWhenNarrow) { setSplitActionBar(getResources_getBoolean(getContext(), R.bool.abs__split_action_bar_is_narrow)); // depends on control dependency: [if], data = [none] } if (mActionMenuPresenter != null) { mActionMenuPresenter.onConfigurationChanged(newConfig); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected double getExpectedRepDistance(NumberVector rep, DiscreteUncertainObject uo) { SquaredEuclideanDistanceFunction euclidean = SquaredEuclideanDistanceFunction.STATIC; int counter = 0; double sum = 0.0; for(int i = 0; i < uo.getNumberSamples(); i++) { sum += euclidean.distance(rep, uo.getSample(i)); counter++; } return sum / counter; } }
public class class_name { protected double getExpectedRepDistance(NumberVector rep, DiscreteUncertainObject uo) { SquaredEuclideanDistanceFunction euclidean = SquaredEuclideanDistanceFunction.STATIC; int counter = 0; double sum = 0.0; for(int i = 0; i < uo.getNumberSamples(); i++) { sum += euclidean.distance(rep, uo.getSample(i)); // depends on control dependency: [for], data = [i] counter++; // depends on control dependency: [for], data = [none] } return sum / counter; } }
public class class_name { @Override public OperationResult<R> tryOperation(Operation<CL, R> operation) throws ConnectionException { Operation<CL, R> filteredOperation = config.getOperationFilterFactory().attachFilter(operation); while (true) { attemptCounter++; try { connection = borrowConnection(filteredOperation); startTime = System.currentTimeMillis(); OperationResult<R> result = connection.execute(filteredOperation); result.setAttemptsCount(attemptCounter); monitor.incOperationSuccess(getCurrentHost(), result.getLatency()); return result; } catch (Exception e) { ConnectionException ce = (e instanceof ConnectionException) ? (ConnectionException) e : new UnknownException(e); try { informException(ce); monitor.incFailover(ce.getHost(), ce); } catch (ConnectionException ex) { monitor.incOperationFailure(getCurrentHost(), ex); throw ex; } } finally { releaseConnection(); } } } }
public class class_name { @Override public OperationResult<R> tryOperation(Operation<CL, R> operation) throws ConnectionException { Operation<CL, R> filteredOperation = config.getOperationFilterFactory().attachFilter(operation); while (true) { attemptCounter++; try { connection = borrowConnection(filteredOperation); // depends on control dependency: [try], data = [none] startTime = System.currentTimeMillis(); // depends on control dependency: [try], data = [none] OperationResult<R> result = connection.execute(filteredOperation); result.setAttemptsCount(attemptCounter); // depends on control dependency: [try], data = [none] monitor.incOperationSuccess(getCurrentHost(), result.getLatency()); // depends on control dependency: [try], data = [none] return result; // depends on control dependency: [try], data = [none] } catch (Exception e) { ConnectionException ce = (e instanceof ConnectionException) ? (ConnectionException) e : new UnknownException(e); try { informException(ce); // depends on control dependency: [try], data = [none] monitor.incFailover(ce.getHost(), ce); // depends on control dependency: [try], data = [none] } catch (ConnectionException ex) { monitor.incOperationFailure(getCurrentHost(), ex); throw ex; } // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] finally { releaseConnection(); } } } }
public class class_name { public static void generateJSEventHandlers(ResponseWriter rw, UIComponent component) throws IOException { Map<String, Object> attributes = component.getAttributes(); String[] eventHandlers = {"onclick", "onblur", "onmouseover"}; for (String event:eventHandlers) { String handler = A.asString(attributes.get(event)); if (null != handler) { rw.writeAttribute(event, handler, event); } } } }
public class class_name { public static void generateJSEventHandlers(ResponseWriter rw, UIComponent component) throws IOException { Map<String, Object> attributes = component.getAttributes(); String[] eventHandlers = {"onclick", "onblur", "onmouseover"}; for (String event:eventHandlers) { String handler = A.asString(attributes.get(event)); if (null != handler) { rw.writeAttribute(event, handler, event); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void logout(Subject subject) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "logout"); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "logout"); } } }
public class class_name { public void logout(Subject subject) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "logout"); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "logout"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static byte setBit(final byte pData, final int pBitIndex, final boolean pOn) { if (pBitIndex < 0 || pBitIndex > 7) { throw new IllegalArgumentException("parameter 'pBitIndex' must be between 0 and 7. pBitIndex=" + pBitIndex); } byte ret = pData; if (pOn) { // Set bit ret |= 1 << pBitIndex; } else { // Unset bit ret &= ~(1 << pBitIndex); } return ret; } }
public class class_name { public static byte setBit(final byte pData, final int pBitIndex, final boolean pOn) { if (pBitIndex < 0 || pBitIndex > 7) { throw new IllegalArgumentException("parameter 'pBitIndex' must be between 0 and 7. pBitIndex=" + pBitIndex); } byte ret = pData; if (pOn) { // Set bit ret |= 1 << pBitIndex; // depends on control dependency: [if], data = [none] } else { // Unset bit ret &= ~(1 << pBitIndex); // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public static PropertyKey fromString(String input) { // First try to parse it as default key PropertyKey key = DEFAULT_KEYS_MAP.get(input); if (key != null) { return key; } // Try to match input with alias key = DEFAULT_ALIAS_MAP.get(input); if (key != null) { return key; } // Try different templates and see if any template matches for (Template template : Template.values()) { key = template.getPropertyKey(input); if (key != null) { return key; } } throw new IllegalArgumentException( ExceptionMessage.INVALID_CONFIGURATION_KEY.getMessage(input)); } }
public class class_name { public static PropertyKey fromString(String input) { // First try to parse it as default key PropertyKey key = DEFAULT_KEYS_MAP.get(input); if (key != null) { return key; // depends on control dependency: [if], data = [none] } // Try to match input with alias key = DEFAULT_ALIAS_MAP.get(input); if (key != null) { return key; // depends on control dependency: [if], data = [none] } // Try different templates and see if any template matches for (Template template : Template.values()) { key = template.getPropertyKey(input); // depends on control dependency: [for], data = [template] if (key != null) { return key; // depends on control dependency: [if], data = [none] } } throw new IllegalArgumentException( ExceptionMessage.INVALID_CONFIGURATION_KEY.getMessage(input)); } }
public class class_name { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { final ViewHolder viewHolder; if (convertView == null) { convertView = mLayoutInflater.inflate(R.layout.item_country, parent, false); viewHolder = new ViewHolder(); viewHolder.mImageView = (ImageView) convertView.findViewById(R.id.intl_phone_edit__country__item_image); viewHolder.mNameView = (TextView) convertView.findViewById(R.id.intl_phone_edit__country__item_name); viewHolder.mDialCode = (TextView) convertView.findViewById(R.id.intl_phone_edit__country__item_dialcode); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } Country country = getItem(position); viewHolder.mImageView.setImageResource(getFlagResource(country)); viewHolder.mNameView.setText(country.getName()); viewHolder.mDialCode.setText(String.format("+%s", country.getDialCode())); return convertView; } }
public class class_name { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { final ViewHolder viewHolder; if (convertView == null) { convertView = mLayoutInflater.inflate(R.layout.item_country, parent, false); // depends on control dependency: [if], data = [none] viewHolder = new ViewHolder(); // depends on control dependency: [if], data = [none] viewHolder.mImageView = (ImageView) convertView.findViewById(R.id.intl_phone_edit__country__item_image); // depends on control dependency: [if], data = [none] viewHolder.mNameView = (TextView) convertView.findViewById(R.id.intl_phone_edit__country__item_name); // depends on control dependency: [if], data = [none] viewHolder.mDialCode = (TextView) convertView.findViewById(R.id.intl_phone_edit__country__item_dialcode); // depends on control dependency: [if], data = [none] convertView.setTag(viewHolder); // depends on control dependency: [if], data = [none] } else { viewHolder = (ViewHolder) convertView.getTag(); // depends on control dependency: [if], data = [none] } Country country = getItem(position); viewHolder.mImageView.setImageResource(getFlagResource(country)); viewHolder.mNameView.setText(country.getName()); viewHolder.mDialCode.setText(String.format("+%s", country.getDialCode())); return convertView; } }
public class class_name { public void marshall(UpdateVirtualServiceRequest updateVirtualServiceRequest, ProtocolMarshaller protocolMarshaller) { if (updateVirtualServiceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateVirtualServiceRequest.getClientToken(), CLIENTTOKEN_BINDING); protocolMarshaller.marshall(updateVirtualServiceRequest.getMeshName(), MESHNAME_BINDING); protocolMarshaller.marshall(updateVirtualServiceRequest.getSpec(), SPEC_BINDING); protocolMarshaller.marshall(updateVirtualServiceRequest.getVirtualServiceName(), VIRTUALSERVICENAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateVirtualServiceRequest updateVirtualServiceRequest, ProtocolMarshaller protocolMarshaller) { if (updateVirtualServiceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateVirtualServiceRequest.getClientToken(), CLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateVirtualServiceRequest.getMeshName(), MESHNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateVirtualServiceRequest.getSpec(), SPEC_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateVirtualServiceRequest.getVirtualServiceName(), VIRTUALSERVICENAME_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 String readPassword(String password) { if (password == null || encryptors.size() < 1) { return password; } Matcher matcher = PASSWORD_PATTERN.matcher(password); if (matcher.find()) { return this.decryptPassword(matcher.group(1)); } return password; } }
public class class_name { public String readPassword(String password) { if (password == null || encryptors.size() < 1) { return password; // depends on control dependency: [if], data = [none] } Matcher matcher = PASSWORD_PATTERN.matcher(password); if (matcher.find()) { return this.decryptPassword(matcher.group(1)); // depends on control dependency: [if], data = [none] } return password; } }
public class class_name { public CreateAssessmentTemplateRequest withRulesPackageArns(String... rulesPackageArns) { if (this.rulesPackageArns == null) { setRulesPackageArns(new java.util.ArrayList<String>(rulesPackageArns.length)); } for (String ele : rulesPackageArns) { this.rulesPackageArns.add(ele); } return this; } }
public class class_name { public CreateAssessmentTemplateRequest withRulesPackageArns(String... rulesPackageArns) { if (this.rulesPackageArns == null) { setRulesPackageArns(new java.util.ArrayList<String>(rulesPackageArns.length)); // depends on control dependency: [if], data = [none] } for (String ele : rulesPackageArns) { this.rulesPackageArns.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static String underscored(final String input) { if (input == null || input.length() == 0) { return ""; } return input.trim().replaceAll("([a-z\\d])([A-Z]+)", "$1_$2").replaceAll("[-\\s]+", "_").toLowerCase(); } }
public class class_name { public static String underscored(final String input) { if (input == null || input.length() == 0) { return ""; // depends on control dependency: [if], data = [none] } return input.trim().replaceAll("([a-z\\d])([A-Z]+)", "$1_$2").replaceAll("[-\\s]+", "_").toLowerCase(); } }
public class class_name { private boolean isBlocked(Pathfindable mover, int tx, int ty) { final Collection<Integer> ids = getObjectsId(tx, ty); int ignoredCount = 0; for (final Integer id : ids) { if (mover.isIgnoredId(id)) { ignoredCount++; } } return ignoredCount < ids.size(); } }
public class class_name { private boolean isBlocked(Pathfindable mover, int tx, int ty) { final Collection<Integer> ids = getObjectsId(tx, ty); int ignoredCount = 0; for (final Integer id : ids) { if (mover.isIgnoredId(id)) { ignoredCount++; // depends on control dependency: [if], data = [none] } } return ignoredCount < ids.size(); } }
public class class_name { private void refresh(Collection<Bundle> bundles) { if (FrameworkState.isStopping()) { // do nothing; system is shutting down removal pendings will be removed automatically return; } Bundle system = context.getBundle(Constants.SYSTEM_BUNDLE_LOCATION); FrameworkWiring fwkWiring = system.adapt(FrameworkWiring.class); final CountDownLatch refreshed = new CountDownLatch(1); fwkWiring.refreshBundles(bundles, new FrameworkListener() { @Override public void frameworkEvent(FrameworkEvent event) { refreshed.countDown(); } }); try { // only wait for 30 seconds refreshed.await(30, TimeUnit.SECONDS); } catch (InterruptedException e) { // not really expected; auto-FFDC is ok // keep thread interrupted Thread.interrupted(); } } }
public class class_name { private void refresh(Collection<Bundle> bundles) { if (FrameworkState.isStopping()) { // do nothing; system is shutting down removal pendings will be removed automatically return; // depends on control dependency: [if], data = [none] } Bundle system = context.getBundle(Constants.SYSTEM_BUNDLE_LOCATION); FrameworkWiring fwkWiring = system.adapt(FrameworkWiring.class); final CountDownLatch refreshed = new CountDownLatch(1); fwkWiring.refreshBundles(bundles, new FrameworkListener() { @Override public void frameworkEvent(FrameworkEvent event) { refreshed.countDown(); } }); try { // only wait for 30 seconds refreshed.await(30, TimeUnit.SECONDS); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // not really expected; auto-FFDC is ok // keep thread interrupted Thread.interrupted(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String convertDateToTimeString(Date date) { if (date == null) { return null; } else { // DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS'Z'"); DateTimeFormatter df = FORMATTER_SECONDS_Z; return df.print(date.getTime()); } } }
public class class_name { public static String convertDateToTimeString(Date date) { if (date == null) { return null; // depends on control dependency: [if], data = [none] } else { // DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS'Z'"); DateTimeFormatter df = FORMATTER_SECONDS_Z; return df.print(date.getTime()); // depends on control dependency: [if], data = [(date] } } }
public class class_name { private Map<String, Set<String>> getDependencies(Pattern pattern) { Map<String, Set<String>> result = new HashMap<String, Set<String>>(); for (PatternNode node : pattern.aliasToNode.values()) { Set<String> currentDependencies = new HashSet<String>(); OWhereClause filter = aliasFilters.get(node.alias); if (filter != null && filter.getBaseExpression() != null) { List<String> involvedAliases = filter.getBaseExpression().getMatchPatternInvolvedAliases(); if (involvedAliases != null) { currentDependencies.addAll(involvedAliases); } } result.put(node.alias, currentDependencies); } return result; } }
public class class_name { private Map<String, Set<String>> getDependencies(Pattern pattern) { Map<String, Set<String>> result = new HashMap<String, Set<String>>(); for (PatternNode node : pattern.aliasToNode.values()) { Set<String> currentDependencies = new HashSet<String>(); OWhereClause filter = aliasFilters.get(node.alias); if (filter != null && filter.getBaseExpression() != null) { List<String> involvedAliases = filter.getBaseExpression().getMatchPatternInvolvedAliases(); if (involvedAliases != null) { currentDependencies.addAll(involvedAliases); // depends on control dependency: [if], data = [(involvedAliases] } } result.put(node.alias, currentDependencies); // depends on control dependency: [for], data = [node] } return result; } }
public class class_name { public void onShutdown() { for (String listenerName : registeredFileListeners.keySet()) { logger.info("Deregistering File Listener: " + listenerName); FileListener listener = registeredFileListeners.get(listenerName); listener.stopListening(); } } }
public class class_name { public void onShutdown() { for (String listenerName : registeredFileListeners.keySet()) { logger.info("Deregistering File Listener: " + listenerName); // depends on control dependency: [for], data = [listenerName] FileListener listener = registeredFileListeners.get(listenerName); listener.stopListening(); // depends on control dependency: [for], data = [none] } } }
public class class_name { public void receiveVideo(boolean receive) { if (engine != null) { boolean receiveVideo = engine.receiveVideo(receive); if (!receiveVideo && receive) { // video has been re-enabled seekToCurrentPlayback(); } } else { log.debug("PlayEngine was null, receiveVideo cannot be modified"); } } }
public class class_name { public void receiveVideo(boolean receive) { if (engine != null) { boolean receiveVideo = engine.receiveVideo(receive); if (!receiveVideo && receive) { // video has been re-enabled seekToCurrentPlayback(); // depends on control dependency: [if], data = [none] } } else { log.debug("PlayEngine was null, receiveVideo cannot be modified"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void toASCII(PrintWriter pw, boolean addName, String rootName, boolean newLine) { if (_Debug) System.out.println("asciiGrid.toASCII(" + addName + ",'" + rootName + "') getName(): " + getEncodedName()); if (rootName != null) rootName += "." + getEncodedName(); else rootName = getEncodedName(); boolean firstPass = true; Enumeration e = getVariables(); while (e.hasMoreElements()) { toASCII ta = (toASCII) e.nextElement(); if (!newLine && !firstPass) pw.print(", "); ta.toASCII(pw, addName, rootName, newLine); firstPass = false; } if (newLine) pw.print("\n"); } }
public class class_name { public void toASCII(PrintWriter pw, boolean addName, String rootName, boolean newLine) { if (_Debug) System.out.println("asciiGrid.toASCII(" + addName + ",'" + rootName + "') getName(): " + getEncodedName()); if (rootName != null) rootName += "." + getEncodedName(); else rootName = getEncodedName(); boolean firstPass = true; Enumeration e = getVariables(); while (e.hasMoreElements()) { toASCII ta = (toASCII) e.nextElement(); if (!newLine && !firstPass) pw.print(", "); ta.toASCII(pw, addName, rootName, newLine); // depends on control dependency: [while], data = [none] firstPass = false; // depends on control dependency: [while], data = [none] } if (newLine) pw.print("\n"); } }
public class class_name { public String toHELM2() { if (isAnnotationTrue()) { return sourceId.getId() + "," + targetId.getId() + "," + sourceUnit + ":" + rGroupSource + "-" + targetUnit + ":" + rGroupTarget + "\"" + annotation + "\""; } else { return sourceId.getId() + "," + targetId.getId() + "," + sourceUnit + ":" + rGroupSource + "-" + targetUnit + ":" + rGroupTarget; } } }
public class class_name { public String toHELM2() { if (isAnnotationTrue()) { return sourceId.getId() + "," + targetId.getId() + "," + sourceUnit + ":" + rGroupSource + "-" + targetUnit + ":" + rGroupTarget + "\"" + annotation + "\""; // depends on control dependency: [if], data = [none] } else { return sourceId.getId() + "," + targetId.getId() + "," + sourceUnit + ":" + rGroupSource + "-" + targetUnit + ":" + rGroupTarget; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Implementation protected void search( @NonNull final String query, final Bundle extras, @NonNull SearchCallback callback) { if (isConnected) { final List<MediaItem> searchResults = new ArrayList<>(); for (MediaItem item : mediaItems.values()) { final String mediaTitle = item.getDescription().getTitle().toString().toLowerCase(); if (mediaTitle.contains(query.toLowerCase())) { searchResults.add(item); } } handler.post(() -> callback.onSearchResult(query, extras, searchResults)); } else { handler.post(() -> callback.onError(query, extras)); } } }
public class class_name { @Implementation protected void search( @NonNull final String query, final Bundle extras, @NonNull SearchCallback callback) { if (isConnected) { final List<MediaItem> searchResults = new ArrayList<>(); for (MediaItem item : mediaItems.values()) { final String mediaTitle = item.getDescription().getTitle().toString().toLowerCase(); if (mediaTitle.contains(query.toLowerCase())) { searchResults.add(item); // depends on control dependency: [if], data = [none] } } handler.post(() -> callback.onSearchResult(query, extras, searchResults)); // depends on control dependency: [if], data = [none] } else { handler.post(() -> callback.onError(query, extras)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public Page allocate(int size, boolean thief, boolean victim, OffHeapStorageArea owner) { while (true) { processQueue(); long now = max.get(); if (now < size) { return null; } else if (max.compareAndSet(now, now - size)) { ByteBuffer buffer; try { buffer = ByteBuffer.allocateDirect(size); } catch (OutOfMemoryError e) { return null; } bufferSizes.put(new PhantomReference<>(buffer, allocatedBuffers), size); return new Page(buffer, owner); } } } }
public class class_name { @Override public Page allocate(int size, boolean thief, boolean victim, OffHeapStorageArea owner) { while (true) { processQueue(); // depends on control dependency: [while], data = [none] long now = max.get(); if (now < size) { return null; // depends on control dependency: [if], data = [none] } else if (max.compareAndSet(now, now - size)) { ByteBuffer buffer; try { buffer = ByteBuffer.allocateDirect(size); // depends on control dependency: [try], data = [none] } catch (OutOfMemoryError e) { return null; } // depends on control dependency: [catch], data = [none] bufferSizes.put(new PhantomReference<>(buffer, allocatedBuffers), size); // depends on control dependency: [if], data = [none] return new Page(buffer, owner); // depends on control dependency: [if], data = [none] } } } }
public class class_name { void merge(MtasSolrMtasResult newItem) throws IOException { HashMap<MtasDataCollector<?, ?>, MtasDataCollector<?, ?>> map = new HashMap<>(); if (newItem.dataCollector.withTotal()) { dataCollector.setWithTotal(); } dataCollector.merge(newItem.dataCollector, map, true); if (newItem.functionData != null) { if (functionData == null) { functionData = new HashMap<>(); } for (MtasDataCollector<?, ?> keyCollector : newItem.functionData .keySet()) { if (map.containsKey(keyCollector)) { // compute mapped key MtasDataCollector<?, ?> newKeyCollector = keyCollector; while (map.containsKey(newKeyCollector)) { newKeyCollector = map.get(keyCollector); } if (functionData.containsKey(newKeyCollector)) { HashMap<String, MtasSolrMtasResult> tmpList = functionData .get(newKeyCollector); for (String functionKey : newItem.functionData.get(keyCollector) .keySet()) { if (tmpList.containsKey(functionKey)) { tmpList.get(functionKey).merge( newItem.functionData.get(keyCollector).get(functionKey)); } else { tmpList.put(functionKey, newItem.functionData.get(keyCollector).get(functionKey)); } } } else { functionData.put(newKeyCollector, newItem.functionData.get(keyCollector)); } } } } } }
public class class_name { void merge(MtasSolrMtasResult newItem) throws IOException { HashMap<MtasDataCollector<?, ?>, MtasDataCollector<?, ?>> map = new HashMap<>(); if (newItem.dataCollector.withTotal()) { dataCollector.setWithTotal(); } dataCollector.merge(newItem.dataCollector, map, true); if (newItem.functionData != null) { if (functionData == null) { functionData = new HashMap<>(); } for (MtasDataCollector<?, ?> keyCollector : newItem.functionData .keySet()) { if (map.containsKey(keyCollector)) { // compute mapped key MtasDataCollector<?, ?> newKeyCollector = keyCollector; while (map.containsKey(newKeyCollector)) { newKeyCollector = map.get(keyCollector); // depends on control dependency: [while], data = [none] } if (functionData.containsKey(newKeyCollector)) { HashMap<String, MtasSolrMtasResult> tmpList = functionData .get(newKeyCollector); for (String functionKey : newItem.functionData.get(keyCollector) .keySet()) { if (tmpList.containsKey(functionKey)) { tmpList.get(functionKey).merge( newItem.functionData.get(keyCollector).get(functionKey)); // depends on control dependency: [if], data = [none] } else { tmpList.put(functionKey, newItem.functionData.get(keyCollector).get(functionKey)); // depends on control dependency: [if], data = [none] } } } else { functionData.put(newKeyCollector, newItem.functionData.get(keyCollector)); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { private FilterMappingDescriptor createFilterMapping(FilterMappingType filterMappingType, Map<String, FilterDescriptor> filters, Map<String, ServletDescriptor> servlets, Store store) { FilterMappingDescriptor filterMappingDescriptor = store.create(FilterMappingDescriptor.class); FilterNameType filterName = filterMappingType.getFilterName(); FilterDescriptor filterDescriptor = getOrCreateNamedDescriptor(FilterDescriptor.class, filterName.getValue(), filters, store); filterDescriptor.getMappings().add(filterMappingDescriptor); for (Object urlPatternOrServletName : filterMappingType.getUrlPatternOrServletName()) { if (urlPatternOrServletName instanceof UrlPatternType) { UrlPatternType urlPatternType = (UrlPatternType) urlPatternOrServletName; UrlPatternDescriptor urlPatternDescriptor = createUrlPattern(urlPatternType, store); filterMappingDescriptor.getUrlPatterns().add(urlPatternDescriptor); } else if (urlPatternOrServletName instanceof ServletNameType) { ServletNameType servletNameType = (ServletNameType) urlPatternOrServletName; ServletDescriptor servletDescriptor = getOrCreateNamedDescriptor(ServletDescriptor.class, servletNameType.getValue(), servlets, store); filterMappingDescriptor.setServlet(servletDescriptor); } } for (DispatcherType dispatcherType : filterMappingType.getDispatcher()) { DispatcherDescriptor dispatcherDescriptor = store.create(DispatcherDescriptor.class); dispatcherDescriptor.setValue(dispatcherType.getValue()); filterMappingDescriptor.getDispatchers().add(dispatcherDescriptor); } return filterMappingDescriptor; } }
public class class_name { private FilterMappingDescriptor createFilterMapping(FilterMappingType filterMappingType, Map<String, FilterDescriptor> filters, Map<String, ServletDescriptor> servlets, Store store) { FilterMappingDescriptor filterMappingDescriptor = store.create(FilterMappingDescriptor.class); FilterNameType filterName = filterMappingType.getFilterName(); FilterDescriptor filterDescriptor = getOrCreateNamedDescriptor(FilterDescriptor.class, filterName.getValue(), filters, store); filterDescriptor.getMappings().add(filterMappingDescriptor); for (Object urlPatternOrServletName : filterMappingType.getUrlPatternOrServletName()) { if (urlPatternOrServletName instanceof UrlPatternType) { UrlPatternType urlPatternType = (UrlPatternType) urlPatternOrServletName; UrlPatternDescriptor urlPatternDescriptor = createUrlPattern(urlPatternType, store); filterMappingDescriptor.getUrlPatterns().add(urlPatternDescriptor); // depends on control dependency: [if], data = [none] } else if (urlPatternOrServletName instanceof ServletNameType) { ServletNameType servletNameType = (ServletNameType) urlPatternOrServletName; ServletDescriptor servletDescriptor = getOrCreateNamedDescriptor(ServletDescriptor.class, servletNameType.getValue(), servlets, store); filterMappingDescriptor.setServlet(servletDescriptor); // depends on control dependency: [if], data = [none] } } for (DispatcherType dispatcherType : filterMappingType.getDispatcher()) { DispatcherDescriptor dispatcherDescriptor = store.create(DispatcherDescriptor.class); dispatcherDescriptor.setValue(dispatcherType.getValue()); // depends on control dependency: [for], data = [dispatcherType] filterMappingDescriptor.getDispatchers().add(dispatcherDescriptor); // depends on control dependency: [for], data = [none] } return filterMappingDescriptor; } }
public class class_name { public static <T> T getObjectInstanceFromGroovyResource(final Resource resource, final Class[] constructorArgs, final Object[] args, final Class<T> expectedType) { try { if (resource == null) { LOGGER.debug("No groovy script is defined"); return null; } val script = IOUtils.toString(resource.getInputStream(), StandardCharsets.UTF_8); val clazz = AccessController.doPrivileged((PrivilegedAction<Class<T>>) () -> { val classLoader = new GroovyClassLoader(ScriptingUtils.class.getClassLoader(), new CompilerConfiguration(), true); return classLoader.parseClass(script); }); LOGGER.debug("Preparing constructor arguments [{}] for resource [{}]", args, resource); val ctor = clazz.getDeclaredConstructor(constructorArgs); val result = ctor.newInstance(args); if (!expectedType.isAssignableFrom(result.getClass())) { throw new ClassCastException("Result [" + result + " is of type " + result.getClass() + " when we were expecting " + expectedType); } return result; } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; } }
public class class_name { public static <T> T getObjectInstanceFromGroovyResource(final Resource resource, final Class[] constructorArgs, final Object[] args, final Class<T> expectedType) { try { if (resource == null) { LOGGER.debug("No groovy script is defined"); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } val script = IOUtils.toString(resource.getInputStream(), StandardCharsets.UTF_8); val clazz = AccessController.doPrivileged((PrivilegedAction<Class<T>>) () -> { val classLoader = new GroovyClassLoader(ScriptingUtils.class.getClassLoader(), new CompilerConfiguration(), true); return classLoader.parseClass(script); }); LOGGER.debug("Preparing constructor arguments [{}] for resource [{}]", args, resource); val ctor = clazz.getDeclaredConstructor(constructorArgs); // depends on control dependency: [try], data = [none] val result = ctor.newInstance(args); if (!expectedType.isAssignableFrom(result.getClass())) { throw new ClassCastException("Result [" + result + " is of type " + result.getClass() + " when we were expecting " + expectedType); } return result; // depends on control dependency: [try], data = [none] } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { private static String format(String template, @javax.annotation.Nullable Object... args) { // If no arguments return the template. if (args == null) { return template; } // start substituting the arguments into the '%s' placeholders StringBuilder builder = new StringBuilder(template.length() + 16 * args.length); int templateStart = 0; int i = 0; while (i < args.length) { int placeholderStart = template.indexOf("%s", templateStart); if (placeholderStart == -1) { break; } builder.append(template, templateStart, placeholderStart); builder.append(args[i++]); templateStart = placeholderStart + 2; } builder.append(template, templateStart, template.length()); // if we run out of placeholders, append the extra args in square braces if (i < args.length) { builder.append(" ["); builder.append(args[i++]); while (i < args.length) { builder.append(", "); builder.append(args[i++]); } builder.append(']'); } return builder.toString(); } }
public class class_name { private static String format(String template, @javax.annotation.Nullable Object... args) { // If no arguments return the template. if (args == null) { return template; // depends on control dependency: [if], data = [none] } // start substituting the arguments into the '%s' placeholders StringBuilder builder = new StringBuilder(template.length() + 16 * args.length); int templateStart = 0; int i = 0; while (i < args.length) { int placeholderStart = template.indexOf("%s", templateStart); if (placeholderStart == -1) { break; } builder.append(template, templateStart, placeholderStart); // depends on control dependency: [while], data = [none] builder.append(args[i++]); // depends on control dependency: [while], data = [none] templateStart = placeholderStart + 2; // depends on control dependency: [while], data = [none] } builder.append(template, templateStart, template.length()); // if we run out of placeholders, append the extra args in square braces if (i < args.length) { builder.append(" ["); // depends on control dependency: [if], data = [none] builder.append(args[i++]); // depends on control dependency: [if], data = [none] while (i < args.length) { builder.append(", "); // depends on control dependency: [while], data = [none] builder.append(args[i++]); // depends on control dependency: [while], data = [none] } builder.append(']'); // depends on control dependency: [if], data = [none] } return builder.toString(); } }
public class class_name { synchronized protected Cluster getCluster(ClusterIdentifier key) { Cluster cluster; try { cluster = clusterCache.get(key); if (cluster.isClosed()) { LOGGER.info("Cluster [" + cluster + "] was closed, obtaining a new one..."); clusterCache.invalidate(key); cluster = clusterCache.get(key); } } catch (ExecutionException e) { Throwable t = e.getCause(); throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t); } return cluster; } }
public class class_name { synchronized protected Cluster getCluster(ClusterIdentifier key) { Cluster cluster; try { cluster = clusterCache.get(key); // depends on control dependency: [try], data = [none] if (cluster.isClosed()) { LOGGER.info("Cluster [" + cluster + "] was closed, obtaining a new one..."); clusterCache.invalidate(key); cluster = clusterCache.get(key); // depends on control dependency: [if], data = [none] } } catch (ExecutionException e) { Throwable t = e.getCause(); throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t); } // depends on control dependency: [catch], data = [none] return cluster; } }
public class class_name { public Predictor frequency(double... frel) { frequencies = frel; CommandLine<Double> line = new CommandLine<>(FREQUENCY, 5); for (double f : frel) { line.add(f); } input.add(line); return this; } }
public class class_name { public Predictor frequency(double... frel) { frequencies = frel; CommandLine<Double> line = new CommandLine<>(FREQUENCY, 5); for (double f : frel) { line.add(f); // depends on control dependency: [for], data = [f] } input.add(line); return this; } }
public class class_name { @Override public File downloadResource(final String url, final String path) throws ResourceDownloadError { JSch jsch = new JSch(); String[] sftpPath = url.substring(7).split("\\@"); final String[] userCreds = sftpPath[0].split("\\:"); try { String host; int port = ProtocolHandlerConstants.DEFAULT_SSH_PORT; String filePath = sftpPath[1].substring(sftpPath[1].indexOf('/')); String[] location = sftpPath[1].split("\\/"); if (location[0].contains(":")) { String[] hostPort = location[0].split("\\:"); host = hostPort[0]; port = Integer.parseInt(hostPort[1]); } else { host = location[0]; } if (userCreds == null || userCreds.length == 0) { throw new UnsupportedOperationException( "Non-specified user in sftp URL not supported yet."); } Session session = jsch.getSession(userCreds[0], host, port); session.setConfig("StrictHostKeyChecking", "no"); //don't validate against a known_hosts file session.setConfig("PreferredAuthentications", "password,gssapi-with-mic,publickey,keyboard-interactive"); if (userCreds.length == 1) { session.setUserInfo(ui); } else { session.setPassword(userCreds[1]); } session.connect(); Channel channel = session.openChannel("sftp"); channel.connect(); ChannelSftp c = (ChannelSftp) channel; File downloadFile = new File(path); FileOutputStream tempFileOutputStream = new FileOutputStream(downloadFile); IOUtils.copy(c.get(filePath), tempFileOutputStream); channel.disconnect(); session.disconnect(); return downloadFile; } catch (Exception e) { final String msg = "Error downloading namespace"; throw new ResourceDownloadError(url, msg, e); } } }
public class class_name { @Override public File downloadResource(final String url, final String path) throws ResourceDownloadError { JSch jsch = new JSch(); String[] sftpPath = url.substring(7).split("\\@"); final String[] userCreds = sftpPath[0].split("\\:"); try { String host; int port = ProtocolHandlerConstants.DEFAULT_SSH_PORT; String filePath = sftpPath[1].substring(sftpPath[1].indexOf('/')); String[] location = sftpPath[1].split("\\/"); if (location[0].contains(":")) { String[] hostPort = location[0].split("\\:"); host = hostPort[0]; // depends on control dependency: [if], data = [none] port = Integer.parseInt(hostPort[1]); // depends on control dependency: [if], data = [none] } else { host = location[0]; // depends on control dependency: [if], data = [none] } if (userCreds == null || userCreds.length == 0) { throw new UnsupportedOperationException( "Non-specified user in sftp URL not supported yet."); } Session session = jsch.getSession(userCreds[0], host, port); session.setConfig("StrictHostKeyChecking", "no"); //don't validate against a known_hosts file session.setConfig("PreferredAuthentications", "password,gssapi-with-mic,publickey,keyboard-interactive"); if (userCreds.length == 1) { session.setUserInfo(ui); // depends on control dependency: [if], data = [none] } else { session.setPassword(userCreds[1]); // depends on control dependency: [if], data = [none] } session.connect(); Channel channel = session.openChannel("sftp"); channel.connect(); ChannelSftp c = (ChannelSftp) channel; File downloadFile = new File(path); FileOutputStream tempFileOutputStream = new FileOutputStream(downloadFile); IOUtils.copy(c.get(filePath), tempFileOutputStream); channel.disconnect(); session.disconnect(); return downloadFile; } catch (Exception e) { final String msg = "Error downloading namespace"; throw new ResourceDownloadError(url, msg, e); } } }
public class class_name { String computeKeys(ExecutableElement methodElement, List<String> arguments) { String keys = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator()); if (arguments != null && !arguments.isEmpty()) { JsCacheResult jcr = methodElement.getAnnotation(JsCacheResult.class); // if there is a jcr annotation with value diferrent of *, so we dont use all arguments if (!considerateAllArgs(jcr)) { keys = stringJoinAndDecorate(Arrays.asList(jcr.keys()), COMMA, new KeyForArgDecorator()); } } return keys; } }
public class class_name { String computeKeys(ExecutableElement methodElement, List<String> arguments) { String keys = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator()); if (arguments != null && !arguments.isEmpty()) { JsCacheResult jcr = methodElement.getAnnotation(JsCacheResult.class); // if there is a jcr annotation with value diferrent of *, so we dont use all arguments if (!considerateAllArgs(jcr)) { keys = stringJoinAndDecorate(Arrays.asList(jcr.keys()), COMMA, new KeyForArgDecorator()); // depends on control dependency: [if], data = [none] } } return keys; } }
public class class_name { public void pruneUnusedCameras() { // Count how many views are used by each camera int histogram[] = new int[structure.cameras.length]; for (int i = 0; i < structure.views.length; i++) { histogram[structure.views[i].camera]++; } // See which cameras need to be removed and create a look up table from old to new camera IDs int oldToNew[] = new int[structure.cameras.length]; List<SceneStructureMetric.Camera> remaining = new ArrayList<>(); for (int i = 0; i < structure.cameras.length; i++) { if( histogram[i] > 0 ) { oldToNew[i] = remaining.size(); remaining.add(structure.cameras[i]); } } // Create the new camera array without the unused cameras structure.cameras = new SceneStructureMetric.Camera[remaining.size()]; for (int i = 0; i < remaining.size(); i++) { structure.cameras[i] = remaining.get(i); } // Update the references to the cameras for (int i = 0; i < structure.views.length; i++) { SceneStructureMetric.View v = structure.views[i]; v.camera = oldToNew[v.camera]; } } }
public class class_name { public void pruneUnusedCameras() { // Count how many views are used by each camera int histogram[] = new int[structure.cameras.length]; for (int i = 0; i < structure.views.length; i++) { histogram[structure.views[i].camera]++; // depends on control dependency: [for], data = [i] } // See which cameras need to be removed and create a look up table from old to new camera IDs int oldToNew[] = new int[structure.cameras.length]; List<SceneStructureMetric.Camera> remaining = new ArrayList<>(); for (int i = 0; i < structure.cameras.length; i++) { if( histogram[i] > 0 ) { oldToNew[i] = remaining.size(); // depends on control dependency: [if], data = [none] remaining.add(structure.cameras[i]); // depends on control dependency: [if], data = [none] } } // Create the new camera array without the unused cameras structure.cameras = new SceneStructureMetric.Camera[remaining.size()]; for (int i = 0; i < remaining.size(); i++) { structure.cameras[i] = remaining.get(i); // depends on control dependency: [for], data = [i] } // Update the references to the cameras for (int i = 0; i < structure.views.length; i++) { SceneStructureMetric.View v = structure.views[i]; v.camera = oldToNew[v.camera]; // depends on control dependency: [for], data = [none] } } }
public class class_name { @Override public Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler) { if (emptyMessage(message)) { return message; } MessageHeaderAccessor headers = mutableHeaderAccessor(message); TraceContextOrSamplingFlags extracted = this.extractor.extract(headers); // Start and finish a consumer span as we will immediately process it. Span consumerSpan = this.tracer.nextSpan(extracted); if (!consumerSpan.isNoop()) { consumerSpan.kind(Span.Kind.CONSUMER).start(); consumerSpan.remoteServiceName(REMOTE_SERVICE_NAME); addTags(message, consumerSpan, channel); consumerSpan.finish(); } // create and scope a span for the message processor this.threadLocalSpan .next(TraceContextOrSamplingFlags.create(consumerSpan.context())) .name("handle").start(); // remove any trace headers, but don't re-inject as we are synchronously // processing the // message and can rely on scoping to access this span later. MessageHeaderPropagation.removeAnyTraceHeaders(headers, this.tracing.propagation().keys()); if (log.isDebugEnabled()) { log.debug("Created a new span in before handle" + consumerSpan); } if (message instanceof ErrorMessage) { return new ErrorMessage((Throwable) message.getPayload(), headers.getMessageHeaders()); } headers.setImmutable(); return new GenericMessage<>(message.getPayload(), headers.getMessageHeaders()); } }
public class class_name { @Override public Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler) { if (emptyMessage(message)) { return message; // depends on control dependency: [if], data = [none] } MessageHeaderAccessor headers = mutableHeaderAccessor(message); TraceContextOrSamplingFlags extracted = this.extractor.extract(headers); // Start and finish a consumer span as we will immediately process it. Span consumerSpan = this.tracer.nextSpan(extracted); if (!consumerSpan.isNoop()) { consumerSpan.kind(Span.Kind.CONSUMER).start(); // depends on control dependency: [if], data = [none] consumerSpan.remoteServiceName(REMOTE_SERVICE_NAME); // depends on control dependency: [if], data = [none] addTags(message, consumerSpan, channel); // depends on control dependency: [if], data = [none] consumerSpan.finish(); // depends on control dependency: [if], data = [none] } // create and scope a span for the message processor this.threadLocalSpan .next(TraceContextOrSamplingFlags.create(consumerSpan.context())) .name("handle").start(); // remove any trace headers, but don't re-inject as we are synchronously // processing the // message and can rely on scoping to access this span later. MessageHeaderPropagation.removeAnyTraceHeaders(headers, this.tracing.propagation().keys()); if (log.isDebugEnabled()) { log.debug("Created a new span in before handle" + consumerSpan); // depends on control dependency: [if], data = [none] } if (message instanceof ErrorMessage) { return new ErrorMessage((Throwable) message.getPayload(), headers.getMessageHeaders()); // depends on control dependency: [if], data = [none] } headers.setImmutable(); return new GenericMessage<>(message.getPayload(), headers.getMessageHeaders()); } }
public class class_name { @Override public List<String> databasesLike(String like) { List<String> databases = null; GeoPackageMetadataDb metadataDb = new GeoPackageMetadataDb( context); metadataDb.open(); try { GeoPackageMetadataDataSource dataSource = new GeoPackageMetadataDataSource(metadataDb); databases = dataSource.getMetadataWhereNameLike(like, GeoPackageMetadata.COLUMN_NAME); } finally { metadataDb.close(); } databases = deleteMissingDatabases(databases); return databases; } }
public class class_name { @Override public List<String> databasesLike(String like) { List<String> databases = null; GeoPackageMetadataDb metadataDb = new GeoPackageMetadataDb( context); metadataDb.open(); try { GeoPackageMetadataDataSource dataSource = new GeoPackageMetadataDataSource(metadataDb); databases = dataSource.getMetadataWhereNameLike(like, GeoPackageMetadata.COLUMN_NAME); // depends on control dependency: [try], data = [none] } finally { metadataDb.close(); } databases = deleteMissingDatabases(databases); return databases; } }
public class class_name { public boolean remove(DATA data) { if(root == null) { return false; } double distanceToRoot = distanceFunction.calculate(data, root.data); try { root.removeData(data, distanceToRoot); } catch(RootNodeReplacement e) { @SuppressWarnings("unchecked") Node newRoot = (Node) e.newRoot; root = newRoot; } catch(DataNotFound e) { return false; } catch (NodeUnderCapacity e) { throw new RuntimeException("Should have never happened", e); } return true; } }
public class class_name { public boolean remove(DATA data) { if(root == null) { return false; // depends on control dependency: [if], data = [none] } double distanceToRoot = distanceFunction.calculate(data, root.data); try { root.removeData(data, distanceToRoot); // depends on control dependency: [try], data = [none] } catch(RootNodeReplacement e) { @SuppressWarnings("unchecked") Node newRoot = (Node) e.newRoot; root = newRoot; } catch(DataNotFound e) { // depends on control dependency: [catch], data = [none] return false; } catch (NodeUnderCapacity e) { // depends on control dependency: [catch], data = [none] throw new RuntimeException("Should have never happened", e); } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { @Override public void shutdown(boolean compact) { try { if (view != null) { view.getRequestPanel().saveConfig(model.getOptionsParam().getConfig()); view.getResponsePanel().saveConfig(model.getOptionsParam().getConfig()); } getProxy(null).stopServer(); super.shutdown(compact); } finally { // Ensure all extensions' config changes done during shutdown are saved. saveConfigurations(); } } }
public class class_name { @Override public void shutdown(boolean compact) { try { if (view != null) { view.getRequestPanel().saveConfig(model.getOptionsParam().getConfig()); // depends on control dependency: [if], data = [none] view.getResponsePanel().saveConfig(model.getOptionsParam().getConfig()); // depends on control dependency: [if], data = [none] } getProxy(null).stopServer(); // depends on control dependency: [try], data = [none] super.shutdown(compact); // depends on control dependency: [try], data = [none] } finally { // Ensure all extensions' config changes done during shutdown are saved. saveConfigurations(); } } }
public class class_name { private void initPatternButtonGroup() { m_groupPattern = new CmsRadioButtonGroup(); m_patternButtons = new HashMap<>(); createAndAddButton(PatternType.DAILY, Messages.GUI_SERIALDATE_TYPE_DAILY_0); m_patternButtons.put(PatternType.NONE, m_patternButtons.get(PatternType.DAILY)); createAndAddButton(PatternType.WEEKLY, Messages.GUI_SERIALDATE_TYPE_WEEKLY_0); createAndAddButton(PatternType.MONTHLY, Messages.GUI_SERIALDATE_TYPE_MONTHLY_0); createAndAddButton(PatternType.YEARLY, Messages.GUI_SERIALDATE_TYPE_YEARLY_0); // createAndAddButton(PatternType.INDIVIDUAL, Messages.GUI_SERIALDATE_TYPE_INDIVIDUAL_0); m_groupPattern.addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> event) { if (handleChange()) { String value = event.getValue(); if (value != null) { m_controller.setPattern(value); } } } }); } }
public class class_name { private void initPatternButtonGroup() { m_groupPattern = new CmsRadioButtonGroup(); m_patternButtons = new HashMap<>(); createAndAddButton(PatternType.DAILY, Messages.GUI_SERIALDATE_TYPE_DAILY_0); m_patternButtons.put(PatternType.NONE, m_patternButtons.get(PatternType.DAILY)); createAndAddButton(PatternType.WEEKLY, Messages.GUI_SERIALDATE_TYPE_WEEKLY_0); createAndAddButton(PatternType.MONTHLY, Messages.GUI_SERIALDATE_TYPE_MONTHLY_0); createAndAddButton(PatternType.YEARLY, Messages.GUI_SERIALDATE_TYPE_YEARLY_0); // createAndAddButton(PatternType.INDIVIDUAL, Messages.GUI_SERIALDATE_TYPE_INDIVIDUAL_0); m_groupPattern.addValueChangeHandler(new ValueChangeHandler<String>() { public void onValueChange(ValueChangeEvent<String> event) { if (handleChange()) { String value = event.getValue(); if (value != null) { m_controller.setPattern(value); // depends on control dependency: [if], data = [(value] } } } }); } }
public class class_name { private List<CmsSelectWidgetOption> getSortNamesIndex() { List<CmsSelectWidgetOption> retVal = new ArrayList<CmsSelectWidgetOption>(); try { List<String> names = OpenCms.getSearchManager().getIndexNames(); for (int i = 0; i < names.size(); i++) { String indexName = names.get(i); String wpIndexName = getSettings().getUserSettings().getWorkplaceSearchIndexName(); boolean isDefault = indexName.toLowerCase().equals(wpIndexName.toLowerCase()); retVal.add(new CmsSelectWidgetOption(names.get(i), isDefault, names.get(i))); } } catch (Exception e) { // noop } return retVal; } }
public class class_name { private List<CmsSelectWidgetOption> getSortNamesIndex() { List<CmsSelectWidgetOption> retVal = new ArrayList<CmsSelectWidgetOption>(); try { List<String> names = OpenCms.getSearchManager().getIndexNames(); for (int i = 0; i < names.size(); i++) { String indexName = names.get(i); String wpIndexName = getSettings().getUserSettings().getWorkplaceSearchIndexName(); boolean isDefault = indexName.toLowerCase().equals(wpIndexName.toLowerCase()); retVal.add(new CmsSelectWidgetOption(names.get(i), isDefault, names.get(i))); // depends on control dependency: [for], data = [i] } } catch (Exception e) { // noop } // depends on control dependency: [catch], data = [none] return retVal; } }
public class class_name { public String toTrad(String str) { char[] c = str.toCharArray(); for (int i = 0; i < str.length(); i++) { char cc = s2l.get(c[i]); if (cc != 0) { c[i] = cc; } } return new String(c); } }
public class class_name { public String toTrad(String str) { char[] c = str.toCharArray(); for (int i = 0; i < str.length(); i++) { char cc = s2l.get(c[i]); if (cc != 0) { c[i] = cc; // depends on control dependency: [if], data = [none] } } return new String(c); } }
public class class_name { protected void assignDataToHandler(ServerHandlerClass handler, Object instance) { if(getParentExtension().getConfigProperties() != null) { new ConfigPropertyDeserializer().deserialize( handler.getPropertiesClassWrapper(), instance, getParentExtension().getConfigProperties()); } } }
public class class_name { protected void assignDataToHandler(ServerHandlerClass handler, Object instance) { if(getParentExtension().getConfigProperties() != null) { new ConfigPropertyDeserializer().deserialize( handler.getPropertiesClassWrapper(), instance, getParentExtension().getConfigProperties()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void mergeDeprecatedInfo() throws MavenReportException { if ("sun_checks.xml".equals(configLocation) && !"sun".equals(format)) { configLocation = FORMAT_TO_CONFIG_LOCATION.get(format); throw new MavenReportException("'format' parameter is deprecated: please replace with <configLocation>" + configLocation + "</configLocation>."); } if (StringUtils.isEmpty(propertiesLocation)) { if (propertiesFile != null) { propertiesLocation = propertiesFile.getPath(); throw new MavenReportException("'propertiesFile' parameter is deprecated: please replace with " + "<propertiesLocation>" + propertiesLocation + "</propertiesLocation>."); } else if (propertiesURL != null) { propertiesLocation = propertiesURL.toExternalForm(); throw new MavenReportException("'propertiesURL' parameter is deprecated: please replace with " + "<propertiesLocation>" + propertiesLocation + "</propertiesLocation>."); } } if ("LICENSE.txt".equals(headerLocation)) { File defaultHeaderFile = new File(project.getBasedir(), "LICENSE.txt"); if (!defaultHeaderFile.equals(headerFile)) { headerLocation = headerFile.getPath(); } } if (StringUtils.isEmpty(suppressionsLocation)) { suppressionsLocation = suppressionsFile; if (StringUtils.isNotEmpty(suppressionsFile)) { throw new MavenReportException("'suppressionsFile' parameter is deprecated: please replace with " + "<suppressionsLocation>" + suppressionsLocation + "</suppressionsLocation>."); } } if (StringUtils.isEmpty(packageNamesLocation)) { packageNamesLocation = packageNamesFile; if (StringUtils.isNotEmpty(packageNamesFile)) { throw new MavenReportException("'packageNamesFile' parameter is deprecated: please replace with " + "<packageNamesFile>" + suppressionsLocation + "</packageNamesFile>."); } } } }
public class class_name { private void mergeDeprecatedInfo() throws MavenReportException { if ("sun_checks.xml".equals(configLocation) && !"sun".equals(format)) { configLocation = FORMAT_TO_CONFIG_LOCATION.get(format); throw new MavenReportException("'format' parameter is deprecated: please replace with <configLocation>" + configLocation + "</configLocation>."); } if (StringUtils.isEmpty(propertiesLocation)) { if (propertiesFile != null) { propertiesLocation = propertiesFile.getPath(); // depends on control dependency: [if], data = [none] throw new MavenReportException("'propertiesFile' parameter is deprecated: please replace with " + "<propertiesLocation>" + propertiesLocation + "</propertiesLocation>."); } else if (propertiesURL != null) { propertiesLocation = propertiesURL.toExternalForm(); throw new MavenReportException("'propertiesURL' parameter is deprecated: please replace with " + "<propertiesLocation>" + propertiesLocation + "</propertiesLocation>."); } } if ("LICENSE.txt".equals(headerLocation)) { File defaultHeaderFile = new File(project.getBasedir(), "LICENSE.txt"); if (!defaultHeaderFile.equals(headerFile)) { headerLocation = headerFile.getPath(); } } if (StringUtils.isEmpty(suppressionsLocation)) { suppressionsLocation = suppressionsFile; if (StringUtils.isNotEmpty(suppressionsFile)) { throw new MavenReportException("'suppressionsFile' parameter is deprecated: please replace with " + "<suppressionsLocation>" + suppressionsLocation + "</suppressionsLocation>."); } } if (StringUtils.isEmpty(packageNamesLocation)) { packageNamesLocation = packageNamesFile; if (StringUtils.isNotEmpty(packageNamesFile)) { throw new MavenReportException("'packageNamesFile' parameter is deprecated: please replace with " + "<packageNamesFile>" + suppressionsLocation + "</packageNamesFile>."); } } } }
public class class_name { void setDataSourceLogWriter(PrintWriter writer) throws SQLException { for(ConnectionPoolSegment segment : segments) { if(segment.dbConnection.datasource != null) { segment.dbConnection.datasource.setLogWriter(writer); } } } }
public class class_name { void setDataSourceLogWriter(PrintWriter writer) throws SQLException { for(ConnectionPoolSegment segment : segments) { if(segment.dbConnection.datasource != null) { segment.dbConnection.datasource.setLogWriter(writer); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void doBulkReverseKNN(RdKNNNode node, DBIDs ids, Map<DBID, ModifiableDoubleDBIDList> result) { if(node.isLeaf()) { for(int i = 0; i < node.getNumEntries(); i++) { RdKNNLeafEntry entry = (RdKNNLeafEntry) node.getEntry(i); for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { DBID id = DBIDUtil.deref(iter); double distance = distanceQuery.distance(entry.getDBID(), id); if(distance <= entry.getKnnDistance()) { result.get(id).add(distance, entry.getDBID()); } } } } // node is a inner node else { for(int i = 0; i < node.getNumEntries(); i++) { RdKNNDirectoryEntry entry = (RdKNNDirectoryEntry) node.getEntry(i); ModifiableDBIDs candidates = DBIDUtil.newArray(); for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { DBID id = DBIDUtil.deref(iter); double minDist = distanceQuery.minDist(entry, id); if(minDist <= entry.getKnnDistance()) { candidates.add(id); } if(!candidates.isEmpty()) { doBulkReverseKNN(getNode(entry), candidates, result); } } } } } }
public class class_name { private void doBulkReverseKNN(RdKNNNode node, DBIDs ids, Map<DBID, ModifiableDoubleDBIDList> result) { if(node.isLeaf()) { for(int i = 0; i < node.getNumEntries(); i++) { RdKNNLeafEntry entry = (RdKNNLeafEntry) node.getEntry(i); for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { DBID id = DBIDUtil.deref(iter); double distance = distanceQuery.distance(entry.getDBID(), id); if(distance <= entry.getKnnDistance()) { result.get(id).add(distance, entry.getDBID()); // depends on control dependency: [if], data = [(distance] } } } } // node is a inner node else { for(int i = 0; i < node.getNumEntries(); i++) { RdKNNDirectoryEntry entry = (RdKNNDirectoryEntry) node.getEntry(i); ModifiableDBIDs candidates = DBIDUtil.newArray(); for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { DBID id = DBIDUtil.deref(iter); double minDist = distanceQuery.minDist(entry, id); if(minDist <= entry.getKnnDistance()) { candidates.add(id); // depends on control dependency: [if], data = [none] } if(!candidates.isEmpty()) { doBulkReverseKNN(getNode(entry), candidates, result); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public void eInit(Resource resource, String packageName, IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.script == null) { this.script = SarlFactory.eINSTANCE.createSarlScript(); EList<EObject> content = resource.getContents(); if (!content.isEmpty()) { content.clear(); } content.add(this.script); if (!Strings.isEmpty(packageName)) { script.setPackage(packageName); } } } }
public class class_name { public void eInit(Resource resource, String packageName, IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.script == null) { this.script = SarlFactory.eINSTANCE.createSarlScript(); // depends on control dependency: [if], data = [none] EList<EObject> content = resource.getContents(); if (!content.isEmpty()) { content.clear(); // depends on control dependency: [if], data = [none] } content.add(this.script); // depends on control dependency: [if], data = [(this.script] if (!Strings.isEmpty(packageName)) { script.setPackage(packageName); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public EClass getIfcRelSchedulesCostItems() { if (ifcRelSchedulesCostItemsEClass == null) { ifcRelSchedulesCostItemsEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(481); } return ifcRelSchedulesCostItemsEClass; } }
public class class_name { public EClass getIfcRelSchedulesCostItems() { if (ifcRelSchedulesCostItemsEClass == null) { ifcRelSchedulesCostItemsEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(481); // depends on control dependency: [if], data = [none] } return ifcRelSchedulesCostItemsEClass; } }
public class class_name { public java.util.List<String> getDeploymentGroups() { if (deploymentGroups == null) { deploymentGroups = new com.amazonaws.internal.SdkInternalList<String>(); } return deploymentGroups; } }
public class class_name { public java.util.List<String> getDeploymentGroups() { if (deploymentGroups == null) { deploymentGroups = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return deploymentGroups; } }
public class class_name { public List<Triple<F,L,Double>> getTopFeatures(Set<L> labels, double threshold, boolean useMagnitude, int numFeatures, boolean descending) { if (labels != null) { Set<Integer> iLabels = getLabelIndices(labels); return getTopFeaturesLabelIndices(iLabels, threshold, useMagnitude, numFeatures, descending); } else { return getTopFeaturesLabelIndices(null, threshold, useMagnitude, numFeatures, descending); } } }
public class class_name { public List<Triple<F,L,Double>> getTopFeatures(Set<L> labels, double threshold, boolean useMagnitude, int numFeatures, boolean descending) { if (labels != null) { Set<Integer> iLabels = getLabelIndices(labels); return getTopFeaturesLabelIndices(iLabels, threshold, useMagnitude, numFeatures, descending); // depends on control dependency: [if], data = [none] } else { return getTopFeaturesLabelIndices(null, threshold, useMagnitude, numFeatures, descending); // depends on control dependency: [if], data = [none] } } }
public class class_name { static void connect(SocketChannel channel, SocketAddress endpoint, int timeout) throws IOException { boolean blockingOn = channel.isBlocking(); if (blockingOn) { channel.configureBlocking(false); } try { if (channel.connect(endpoint)) { return; } long timeoutLeft = timeout; long endTime = (timeout > 0) ? (System.currentTimeMillis() + timeout): 0; while (true) { // we might have to call finishConnect() more than once // for some channels (with user level protocols) int ret = selector.select((SelectableChannel)channel, SelectionKey.OP_CONNECT, timeoutLeft); if (ret > 0 && channel.finishConnect()) { return; } if (ret == 0 || (timeout > 0 && (timeoutLeft = (endTime - System.currentTimeMillis())) <= 0)) { throw new SocketTimeoutException( timeoutExceptionString(channel, timeout, SelectionKey.OP_CONNECT)); } } } catch (IOException e) { // javadoc for SocketChannel.connect() says channel should be closed. try { channel.close(); } catch (IOException ignored) {} throw e; } finally { if (blockingOn && channel.isOpen()) { channel.configureBlocking(true); } } } }
public class class_name { static void connect(SocketChannel channel, SocketAddress endpoint, int timeout) throws IOException { boolean blockingOn = channel.isBlocking(); if (blockingOn) { channel.configureBlocking(false); } try { if (channel.connect(endpoint)) { return; // depends on control dependency: [if], data = [none] } long timeoutLeft = timeout; long endTime = (timeout > 0) ? (System.currentTimeMillis() + timeout): 0; while (true) { // we might have to call finishConnect() more than once // for some channels (with user level protocols) int ret = selector.select((SelectableChannel)channel, SelectionKey.OP_CONNECT, timeoutLeft); if (ret > 0 && channel.finishConnect()) { return; // depends on control dependency: [if], data = [none] } if (ret == 0 || (timeout > 0 && (timeoutLeft = (endTime - System.currentTimeMillis())) <= 0)) { throw new SocketTimeoutException( timeoutExceptionString(channel, timeout, SelectionKey.OP_CONNECT)); } } } catch (IOException e) { // javadoc for SocketChannel.connect() says channel should be closed. try { channel.close(); // depends on control dependency: [try], data = [none] } catch (IOException ignored) {} // depends on control dependency: [catch], data = [none] throw e; } finally { if (blockingOn && channel.isOpen()) { channel.configureBlocking(true); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(ListLocalDisksRequest listLocalDisksRequest, ProtocolMarshaller protocolMarshaller) { if (listLocalDisksRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listLocalDisksRequest.getGatewayARN(), GATEWAYARN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListLocalDisksRequest listLocalDisksRequest, ProtocolMarshaller protocolMarshaller) { if (listLocalDisksRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listLocalDisksRequest.getGatewayARN(), GATEWAYARN_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 void processRows( IncrementalIndex<?> index, BitmapFactory bitmapFactory, List<IncrementalIndex.DimensionDesc> dimensions ) { int rowNum = 0; for (IncrementalIndexRow row : index.getFacts().persistIterable()) { final Object[] dims = row.getDims(); for (IncrementalIndex.DimensionDesc dimension : dimensions) { final int dimIndex = dimension.getIndex(); DimensionAccessor accessor = accessors.get(dimension.getName()); // Add 'null' to the dimension's dictionary. if (dimIndex >= dims.length || dims[dimIndex] == null) { accessor.indexer.processRowValsToUnsortedEncodedKeyComponent(null, true); continue; } final ColumnCapabilities capabilities = dimension.getCapabilities(); if (capabilities.hasBitmapIndexes()) { final MutableBitmap[] bitmapIndexes = accessor.invertedIndexes; final DimensionIndexer indexer = accessor.indexer; indexer.fillBitmapsFromUnsortedEncodedKeyComponent(dims[dimIndex], rowNum, bitmapIndexes, bitmapFactory); } } ++rowNum; } } }
public class class_name { private void processRows( IncrementalIndex<?> index, BitmapFactory bitmapFactory, List<IncrementalIndex.DimensionDesc> dimensions ) { int rowNum = 0; for (IncrementalIndexRow row : index.getFacts().persistIterable()) { final Object[] dims = row.getDims(); for (IncrementalIndex.DimensionDesc dimension : dimensions) { final int dimIndex = dimension.getIndex(); DimensionAccessor accessor = accessors.get(dimension.getName()); // Add 'null' to the dimension's dictionary. if (dimIndex >= dims.length || dims[dimIndex] == null) { accessor.indexer.processRowValsToUnsortedEncodedKeyComponent(null, true); // depends on control dependency: [if], data = [none] continue; } final ColumnCapabilities capabilities = dimension.getCapabilities(); if (capabilities.hasBitmapIndexes()) { final MutableBitmap[] bitmapIndexes = accessor.invertedIndexes; final DimensionIndexer indexer = accessor.indexer; indexer.fillBitmapsFromUnsortedEncodedKeyComponent(dims[dimIndex], rowNum, bitmapIndexes, bitmapFactory); // depends on control dependency: [if], data = [none] } } ++rowNum; // depends on control dependency: [for], data = [row] } } }
public class class_name { public static void dispose() { synchronized (Command.class) { if (IS_BIND) { Context context = Cmd.getContext(); if (context != null) { try { context.unbindService(I_CONN); } catch (Exception e) { e.printStackTrace(); } } I_COMMAND = null; IS_BIND = false; } } } }
public class class_name { public static void dispose() { synchronized (Command.class) { if (IS_BIND) { Context context = Cmd.getContext(); if (context != null) { try { context.unbindService(I_CONN); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } I_COMMAND = null; // depends on control dependency: [if], data = [none] IS_BIND = false; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setShards(java.util.Collection<Shard> shards) { if (shards == null) { this.shards = null; return; } this.shards = new com.amazonaws.internal.SdkInternalList<Shard>(shards); } }
public class class_name { public void setShards(java.util.Collection<Shard> shards) { if (shards == null) { this.shards = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.shards = new com.amazonaws.internal.SdkInternalList<Shard>(shards); } }
public class class_name { private void loadCustomNodeChildren(final TreeItemIdNode node) { // Check node was flagged as having children or already has children if (!node.hasChildren() || !node.getChildren().isEmpty()) { return; } // Get the row index for the node String itemId = node.getItemId(); List<Integer> rowIndex = getRowIndexForCustomItemId(itemId); // Get the tree item model TreeItemModel model = getTreeModel(); // Check tree item is expandable and has children if (!model.isExpandable(rowIndex) || !model.hasChildren(rowIndex)) { node.setHasChildren(false); return; } // Check actual child count (could have no children even though hasChildren returned true) int count = model.getChildCount(rowIndex); if (count <= 0) { node.setHasChildren(false); return; } // Get the map of item ids already in the custom tree Map<String, TreeItemIdNode> mapIds = getCustomIdNodeMap(); // Add children of item to the node tree boolean childAdded = false; for (int i = 0; i < count; i++) { List<Integer> childIdx = new ArrayList<>(rowIndex); childIdx.add(i); String childItemId = model.getItemId(childIdx); // Check the child item is not already in the custom tree if (mapIds.containsKey(childItemId)) { continue; } TreeItemIdNode childNode = new TreeItemIdNode(childItemId); childNode.setHasChildren(model.hasChildren(childIdx)); node.addChild(childNode); childAdded = true; // For client mode we have to drill down all the children if (childNode.hasChildren() && getExpandMode() == WTree.ExpandMode.CLIENT) { loadCustomNodeChildren(childNode); } } // This could happen if all the children have been used in the custom map if (!childAdded) { node.setHasChildren(false); } } }
public class class_name { private void loadCustomNodeChildren(final TreeItemIdNode node) { // Check node was flagged as having children or already has children if (!node.hasChildren() || !node.getChildren().isEmpty()) { return; // depends on control dependency: [if], data = [none] } // Get the row index for the node String itemId = node.getItemId(); List<Integer> rowIndex = getRowIndexForCustomItemId(itemId); // Get the tree item model TreeItemModel model = getTreeModel(); // Check tree item is expandable and has children if (!model.isExpandable(rowIndex) || !model.hasChildren(rowIndex)) { node.setHasChildren(false); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Check actual child count (could have no children even though hasChildren returned true) int count = model.getChildCount(rowIndex); if (count <= 0) { node.setHasChildren(false); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Get the map of item ids already in the custom tree Map<String, TreeItemIdNode> mapIds = getCustomIdNodeMap(); // Add children of item to the node tree boolean childAdded = false; for (int i = 0; i < count; i++) { List<Integer> childIdx = new ArrayList<>(rowIndex); childIdx.add(i); // depends on control dependency: [for], data = [i] String childItemId = model.getItemId(childIdx); // Check the child item is not already in the custom tree if (mapIds.containsKey(childItemId)) { continue; } TreeItemIdNode childNode = new TreeItemIdNode(childItemId); childNode.setHasChildren(model.hasChildren(childIdx)); // depends on control dependency: [for], data = [none] node.addChild(childNode); // depends on control dependency: [for], data = [none] childAdded = true; // depends on control dependency: [for], data = [none] // For client mode we have to drill down all the children if (childNode.hasChildren() && getExpandMode() == WTree.ExpandMode.CLIENT) { loadCustomNodeChildren(childNode); // depends on control dependency: [if], data = [none] } } // This could happen if all the children have been used in the custom map if (!childAdded) { node.setHasChildren(false); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void createManagedServiceFactory(BundleContext context) { // sanity check if (managedServiceFactoryReg != null) { managedServiceFactoryReg.unregister(); managedServiceFactoryReg = null; } final Dictionary<String, String> props = new Hashtable<>(); props.put(Constants.SERVICE_PID, HttpContextProcessing.PID); httpContextProcessing = new HttpContextProcessing(bundleContext, serverController); managedServiceFactoryReg = context.registerService(ManagedServiceFactory.class, httpContextProcessing, props); } }
public class class_name { private void createManagedServiceFactory(BundleContext context) { // sanity check if (managedServiceFactoryReg != null) { managedServiceFactoryReg.unregister(); // depends on control dependency: [if], data = [none] managedServiceFactoryReg = null; // depends on control dependency: [if], data = [none] } final Dictionary<String, String> props = new Hashtable<>(); props.put(Constants.SERVICE_PID, HttpContextProcessing.PID); httpContextProcessing = new HttpContextProcessing(bundleContext, serverController); managedServiceFactoryReg = context.registerService(ManagedServiceFactory.class, httpContextProcessing, props); } }
public class class_name { public final void createCalendarSource() { Callback<CreateCalendarSourceParameter, CalendarSource> factory = getCalendarSourceFactory(); if (factory != null) { CreateCalendarSourceParameter param = new CreateCalendarSourceParameter(this); CalendarSource calendarSource = factory.call(param); if (calendarSource != null && !getCalendarSources().contains(calendarSource)) { getCalendarSources().add(calendarSource); } } } }
public class class_name { public final void createCalendarSource() { Callback<CreateCalendarSourceParameter, CalendarSource> factory = getCalendarSourceFactory(); if (factory != null) { CreateCalendarSourceParameter param = new CreateCalendarSourceParameter(this); CalendarSource calendarSource = factory.call(param); if (calendarSource != null && !getCalendarSources().contains(calendarSource)) { getCalendarSources().add(calendarSource); // depends on control dependency: [if], data = [(calendarSource] } } } }
public class class_name { private String getActivityInstanceId(PvmExecutionImpl targetScope) { if (targetScope.isConcurrent()) { return targetScope.getActivityInstanceId(); } else { ActivityImpl targetActivity = targetScope.getActivity(); if ((targetActivity != null && targetActivity.getActivities().isEmpty())) { return targetScope.getActivityInstanceId(); } else { return targetScope.getParentActivityInstanceId(); } } } }
public class class_name { private String getActivityInstanceId(PvmExecutionImpl targetScope) { if (targetScope.isConcurrent()) { return targetScope.getActivityInstanceId(); // depends on control dependency: [if], data = [none] } else { ActivityImpl targetActivity = targetScope.getActivity(); if ((targetActivity != null && targetActivity.getActivities().isEmpty())) { return targetScope.getActivityInstanceId(); // depends on control dependency: [if], data = [none] } else { return targetScope.getParentActivityInstanceId(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static void init() { // Get configuration // Read from "server.properties" or custom file. String configFile = null; Properties serverProperties = new Properties(); try { configFile = System.getProperty(PROPERTY_PREFIX + "config", "server.properties"); LOG.info("Loading server configuration from " + configFile); try (InputStream is = new FileInputStream(configFile)) { serverProperties.load(is); } } catch (FileNotFoundException e) { LOG.warn(configFile + " not found."); } catch (IOException e) { LOG.error("Unexpected error reading " + configFile); } init(serverProperties); } }
public class class_name { public static void init() { // Get configuration // Read from "server.properties" or custom file. String configFile = null; Properties serverProperties = new Properties(); try { configFile = System.getProperty(PROPERTY_PREFIX + "config", "server.properties"); LOG.info("Loading server configuration from " + configFile); // depends on control dependency: [try], data = [none] try (InputStream is = new FileInputStream(configFile)) { serverProperties.load(is); } } catch (FileNotFoundException e) { LOG.warn(configFile + " not found."); } catch (IOException e) { // depends on control dependency: [catch], data = [none] LOG.error("Unexpected error reading " + configFile); } // depends on control dependency: [catch], data = [none] init(serverProperties); } }
public class class_name { public boolean hasParameter(String parameter) { if (info == null || info.parameters == null) { return false; } return info.parameters.containsKey(parameter); } }
public class class_name { public boolean hasParameter(String parameter) { if (info == null || info.parameters == null) { return false; // depends on control dependency: [if], data = [none] } return info.parameters.containsKey(parameter); } }
public class class_name { static int readInt(byte[] byteArray, int offset) { int i = 0; for (int j = 0; j < 4; j++) { int shift = 24 - j * 8; i += (byteArray[offset + j] & 0xFF) << shift; } return i; } }
public class class_name { static int readInt(byte[] byteArray, int offset) { int i = 0; for (int j = 0; j < 4; j++) { int shift = 24 - j * 8; i += (byteArray[offset + j] & 0xFF) << shift; // depends on control dependency: [for], data = [j] } return i; } }