code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void permitSem() { if (channelStatus.isStart()) { channelMutex.set(true); logger.debug("channel status is ok!"); } else { channelMutex.set(false); logger.debug("channel status is fail!"); } boolean permit = isPermit(false); if (permit == false) { if (logger.isDebugEnabled()) { logger.debug("Permit is fail!"); } // 如果未授权,则设置信号量为0 permitMutex.set(false); } else { // 信号量+1 if (logger.isDebugEnabled()) { logger.debug("Permit is Ok!"); } permitMutex.set(true); } processChanged(permit);// 通知下变化 } }
public class class_name { private void permitSem() { if (channelStatus.isStart()) { channelMutex.set(true); // depends on control dependency: [if], data = [none] logger.debug("channel status is ok!"); // depends on control dependency: [if], data = [none] } else { channelMutex.set(false); // depends on control dependency: [if], data = [none] logger.debug("channel status is fail!"); // depends on control dependency: [if], data = [none] } boolean permit = isPermit(false); if (permit == false) { if (logger.isDebugEnabled()) { logger.debug("Permit is fail!"); // depends on control dependency: [if], data = [none] } // 如果未授权,则设置信号量为0 permitMutex.set(false); // depends on control dependency: [if], data = [false)] } else { // 信号量+1 if (logger.isDebugEnabled()) { logger.debug("Permit is Ok!"); // depends on control dependency: [if], data = [none] } permitMutex.set(true); // depends on control dependency: [if], data = [none] } processChanged(permit);// 通知下变化 } }
public class class_name { @SuppressWarnings("unchecked") @Override public Iterator<Map<String, String>> getChoices(final String _input) { final List<Map<String, String>> retList = new ArrayList<Map<String, String>>(); try { final AbstractUIPageObject pageObject = (AbstractUIPageObject) getPage().getDefaultModelObject(); final Map<String, String> uiID2Oid = pageObject == null ? null : pageObject.getUiID2Oid(); final List<Return> returns = this.autoComplete.getAutoCompletion(_input, uiID2Oid); for (final Return aReturn : returns) { final Object ob = aReturn.get(ReturnValues.VALUES); if (ob instanceof List) { retList.addAll((Collection<? extends Map<String, String>>) ob); } } } catch (final EFapsException e) { AutoCompleteComboBox.LOG.error("Error in getChoice()", e); } return retList.iterator(); } }
public class class_name { @SuppressWarnings("unchecked") @Override public Iterator<Map<String, String>> getChoices(final String _input) { final List<Map<String, String>> retList = new ArrayList<Map<String, String>>(); try { final AbstractUIPageObject pageObject = (AbstractUIPageObject) getPage().getDefaultModelObject(); final Map<String, String> uiID2Oid = pageObject == null ? null : pageObject.getUiID2Oid(); final List<Return> returns = this.autoComplete.getAutoCompletion(_input, uiID2Oid); for (final Return aReturn : returns) { final Object ob = aReturn.get(ReturnValues.VALUES); if (ob instanceof List) { retList.addAll((Collection<? extends Map<String, String>>) ob); // depends on control dependency: [if], data = [none] } } } catch (final EFapsException e) { AutoCompleteComboBox.LOG.error("Error in getChoice()", e); } // depends on control dependency: [catch], data = [none] return retList.iterator(); } }
public class class_name { public static Set<BioPAXElement> runPathsFromToMultiSet( Set<Set<BioPAXElement>> sourceSets, Set<Set<BioPAXElement>> targetSets, Model model, LimitType limitType, int limit, Filter... filters) { Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); } else return Collections.emptySet(); Set<Node> source = prepareSingleNodeSetFromSets(sourceSets, graph); Set<Node> target = prepareSingleNodeSetFromSets(targetSets, graph); PathsFromToQuery query = new PathsFromToQuery(source, target, limitType, limit, true); Set<GraphObject> resultWrappers = query.run(); return convertQueryResult(resultWrappers, graph, true); } }
public class class_name { public static Set<BioPAXElement> runPathsFromToMultiSet( Set<Set<BioPAXElement>> sourceSets, Set<Set<BioPAXElement>> targetSets, Model model, LimitType limitType, int limit, Filter... filters) { Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); // depends on control dependency: [if], data = [none] } else return Collections.emptySet(); Set<Node> source = prepareSingleNodeSetFromSets(sourceSets, graph); Set<Node> target = prepareSingleNodeSetFromSets(targetSets, graph); PathsFromToQuery query = new PathsFromToQuery(source, target, limitType, limit, true); Set<GraphObject> resultWrappers = query.run(); return convertQueryResult(resultWrappers, graph, true); } }
public class class_name { public void setUndeploy(java.util.Collection<String> undeploy) { if (undeploy == null) { this.undeploy = null; return; } this.undeploy = new com.amazonaws.internal.SdkInternalList<String>(undeploy); } }
public class class_name { public void setUndeploy(java.util.Collection<String> undeploy) { if (undeploy == null) { this.undeploy = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.undeploy = new com.amazonaws.internal.SdkInternalList<String>(undeploy); } }
public class class_name { void rebuildMenu() { if (!getSelectedIds().isEmpty() && (m_menuBuilder != null)) { m_menu.removeAllItems(); m_menuBuilder.buildContextMenu(getContextProvider().getDialogContext(), m_menu); } } }
public class class_name { void rebuildMenu() { if (!getSelectedIds().isEmpty() && (m_menuBuilder != null)) { m_menu.removeAllItems(); // depends on control dependency: [if], data = [none] m_menuBuilder.buildContextMenu(getContextProvider().getDialogContext(), m_menu); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void mapObjectOnFormModel(FormModel formModel, Object objectToMap) { BeanWrapper beanWrapper = new BeanWrapperImpl(objectToMap); for (String fieldName : (Set<String>) formModel.getFieldNames()) { try { formModel.getValueModel(fieldName).setValue(beanWrapper.getPropertyValue(fieldName)); } catch (BeansException be) { // silently ignoring, just mapping values, so if there's one missing, don't bother } } } }
public class class_name { public static void mapObjectOnFormModel(FormModel formModel, Object objectToMap) { BeanWrapper beanWrapper = new BeanWrapperImpl(objectToMap); for (String fieldName : (Set<String>) formModel.getFieldNames()) { try { formModel.getValueModel(fieldName).setValue(beanWrapper.getPropertyValue(fieldName)); // depends on control dependency: [try], data = [none] } catch (BeansException be) { // silently ignoring, just mapping values, so if there's one missing, don't bother } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public void marshall(Country country, ProtocolMarshaller protocolMarshaller) { if (country == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(country.getCountryCode(), COUNTRYCODE_BINDING); protocolMarshaller.marshall(country.getCountryName(), COUNTRYNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Country country, ProtocolMarshaller protocolMarshaller) { if (country == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(country.getCountryCode(), COUNTRYCODE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(country.getCountryName(), COUNTRYNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected final void setParameters(Map<String, String> parameters) { if (parameters == null) { m_parameters.clear(); } else { m_parameters.clear(); Parameter p; for (String key:parameters.keySet()) { p = new Parameter(key); p.setValue(parameters.get(key)); m_parameters.put(key, p); } } } }
public class class_name { protected final void setParameters(Map<String, String> parameters) { if (parameters == null) { m_parameters.clear(); // depends on control dependency: [if], data = [none] } else { m_parameters.clear(); // depends on control dependency: [if], data = [none] Parameter p; for (String key:parameters.keySet()) { p = new Parameter(key); // depends on control dependency: [for], data = [key] p.setValue(parameters.get(key)); // depends on control dependency: [for], data = [key] m_parameters.put(key, p); // depends on control dependency: [for], data = [key] } } } }
public class class_name { private static String formatXPathForJavaXPath(String xpath) throws Exception { String newXPath = ""; if (xpath.startsWith("xpath=")) { xpath = xpath.replace("xpath=", ""); } boolean convertIndicator = true; boolean onSlash = false; boolean onSingleQuote = false; boolean onDoubleQuote = false; for (int i = 0; i < xpath.length(); i++) { char c = xpath.charAt(i); if (c == '/') { if (!onSingleQuote && !onDoubleQuote) { if (convertIndicator) { if (!onSlash) { onSlash = true; } else { onSlash = false; } } else { convertIndicator = true; onSlash = true; } } } else if (c == '[') { if (!onSingleQuote && !onDoubleQuote) convertIndicator = false; } else if (c == ']') { if (!onSingleQuote && !onDoubleQuote) convertIndicator = true; } else if (c == '\'') { if (!onSingleQuote) onSingleQuote = true; else onSingleQuote = false; } else if (c == '\"') { if (!onDoubleQuote) onDoubleQuote = true; else onDoubleQuote = false; } if (convertIndicator) newXPath = newXPath + String.valueOf(c).toLowerCase(); else newXPath = newXPath + String.valueOf(c); } return newXPath; } }
public class class_name { private static String formatXPathForJavaXPath(String xpath) throws Exception { String newXPath = ""; if (xpath.startsWith("xpath=")) { xpath = xpath.replace("xpath=", ""); } boolean convertIndicator = true; boolean onSlash = false; boolean onSingleQuote = false; boolean onDoubleQuote = false; for (int i = 0; i < xpath.length(); i++) { char c = xpath.charAt(i); if (c == '/') { if (!onSingleQuote && !onDoubleQuote) { if (convertIndicator) { if (!onSlash) { onSlash = true; // depends on control dependency: [if], data = [none] } else { onSlash = false; // depends on control dependency: [if], data = [none] } } else { convertIndicator = true; // depends on control dependency: [if], data = [none] onSlash = true; // depends on control dependency: [if], data = [none] } } } else if (c == '[') { if (!onSingleQuote && !onDoubleQuote) convertIndicator = false; } else if (c == ']') { if (!onSingleQuote && !onDoubleQuote) convertIndicator = true; } else if (c == '\'') { if (!onSingleQuote) onSingleQuote = true; else onSingleQuote = false; } else if (c == '\"') { if (!onDoubleQuote) onDoubleQuote = true; else onDoubleQuote = false; } if (convertIndicator) newXPath = newXPath + String.valueOf(c).toLowerCase(); else newXPath = newXPath + String.valueOf(c); } return newXPath; } }
public class class_name { public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } } }
public class class_name { public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException { if (target == null && Modifier.isProtected(modifiers)) { int mods = modifiers; mods = mods & (~Modifier.PROTECTED); mods = mods | Modifier.PUBLIC; /* * See if we fail because of class modifiers */ Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); try { /* * We're still here so class access was ok. * Now try with default field access. */ mods = mods & (~Modifier.PUBLIC); Reflection.ensureMemberAccess(currentClass, memberClass, target, mods); /* * We're still here so access is ok without * checking for protected. */ return; } catch (IllegalAccessException e) { /* * Access failed but we're 'protected' so * if the test below succeeds then we're ok. */ if (isSubclassOf(currentClass, memberClass)) { return; // depends on control dependency: [if], data = [none] } else { throw e; } } } else { Reflection.ensureMemberAccess(currentClass, memberClass, target, modifiers); } } }
public class class_name { public void setFormats(Format[] newFormats) { int formatNumber = 0; for (int partIndex = 0; formatNumber < newFormats.length && (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) { setCustomArgStartFormat(partIndex, newFormats[formatNumber]); ++formatNumber; } } }
public class class_name { public void setFormats(Format[] newFormats) { int formatNumber = 0; for (int partIndex = 0; formatNumber < newFormats.length && (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) { setCustomArgStartFormat(partIndex, newFormats[formatNumber]); // depends on control dependency: [for], data = [partIndex] ++formatNumber; // depends on control dependency: [for], data = [none] } } }
public class class_name { protected final void addRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue) { if (StringUtils.isNotEmpty(annotationName) && annotationValue != null) { Map<String, Map<CharSequence, Object>> allAnnotations = getAllAnnotations(); addRepeatableInternal(annotationName, annotationValue, allAnnotations); } } }
public class class_name { protected final void addRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue) { if (StringUtils.isNotEmpty(annotationName) && annotationValue != null) { Map<String, Map<CharSequence, Object>> allAnnotations = getAllAnnotations(); addRepeatableInternal(annotationName, annotationValue, allAnnotations); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Map<String, String> listVMsAndTemplates(HttpInputs httpInputs, VmInputs vmInputs, String delimiter) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { Map<String, ManagedObjectReference> virtualMachinesMorMap = new MorObjectHandler() .getSpecificObjectsMap(connectionResources, ManagedObjectType.VIRTUAL_MACHINE.getValue()); Set<String> virtualMachineNamesList = virtualMachinesMorMap.keySet(); if (virtualMachineNamesList.size() > 0) { return ResponseUtils.getResultsMap(ResponseUtils .getResponseStringFromCollection(virtualMachineNamesList, delimiter), Outputs.RETURN_CODE_SUCCESS); } else { return ResponseUtils.getResultsMap("No VM found in datacenter.", Outputs.RETURN_CODE_FAILURE); } } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } } }
public class class_name { public Map<String, String> listVMsAndTemplates(HttpInputs httpInputs, VmInputs vmInputs, String delimiter) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { Map<String, ManagedObjectReference> virtualMachinesMorMap = new MorObjectHandler() .getSpecificObjectsMap(connectionResources, ManagedObjectType.VIRTUAL_MACHINE.getValue()); Set<String> virtualMachineNamesList = virtualMachinesMorMap.keySet(); if (virtualMachineNamesList.size() > 0) { return ResponseUtils.getResultsMap(ResponseUtils .getResponseStringFromCollection(virtualMachineNamesList, delimiter), Outputs.RETURN_CODE_SUCCESS); // depends on control dependency: [if], data = [none] } else { return ResponseUtils.getResultsMap("No VM found in datacenter.", Outputs.RETURN_CODE_FAILURE); // depends on control dependency: [if], data = [none] } } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); // depends on control dependency: [if], data = [none] clearConnectionFromContext(httpInputs.getGlobalSessionObject()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static void loopBlocks(int start , int endExclusive , int minBlock, IntRangeConsumer consumer ) { final ForkJoinPool pool = BoofConcurrency.pool; int numThreads = pool.getParallelism(); int range = endExclusive-start; if( range == 0 ) // nothing to do here! return; if( range < 0 ) throw new IllegalArgumentException("end must be more than start. "+start+" -> "+endExclusive); int block = selectBlockSize(range,minBlock,numThreads); try { pool.submit(new IntRangeTask(start,endExclusive,block,consumer)).get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } }
public class class_name { public static void loopBlocks(int start , int endExclusive , int minBlock, IntRangeConsumer consumer ) { final ForkJoinPool pool = BoofConcurrency.pool; int numThreads = pool.getParallelism(); int range = endExclusive-start; if( range == 0 ) // nothing to do here! return; if( range < 0 ) throw new IllegalArgumentException("end must be more than start. "+start+" -> "+endExclusive); int block = selectBlockSize(range,minBlock,numThreads); try { pool.submit(new IntRangeTask(start,endExclusive,block,consumer)).get(); // depends on control dependency: [try], data = [none] } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String dumpStack(final Throwable cause) { if (cause == null) { return "Throwable was null"; } final StringWriter sw = new StringWriter(); final PrintWriter s = new PrintWriter(sw); // This is very close to what Thread.dumpStack does. cause.printStackTrace(s); final String stack = sw.toString(); try { sw.close(); } catch (final IOException e) { LOG.warn("Could not close writer", e); } s.close(); return stack; } }
public class class_name { public static String dumpStack(final Throwable cause) { if (cause == null) { return "Throwable was null"; // depends on control dependency: [if], data = [none] } final StringWriter sw = new StringWriter(); final PrintWriter s = new PrintWriter(sw); // This is very close to what Thread.dumpStack does. cause.printStackTrace(s); final String stack = sw.toString(); try { sw.close(); // depends on control dependency: [try], data = [none] } catch (final IOException e) { LOG.warn("Could not close writer", e); } // depends on control dependency: [catch], data = [none] s.close(); return stack; } }
public class class_name { public Query offset(final Integer offset) { this.offset = offset; // If we defined offset without limit, force a limit to handle MySQL and others gracefully. if (limit <= 0) { limit = Integer.MAX_VALUE - offset; } return this; } }
public class class_name { public Query offset(final Integer offset) { this.offset = offset; // If we defined offset without limit, force a limit to handle MySQL and others gracefully. if (limit <= 0) { limit = Integer.MAX_VALUE - offset; // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public static JsonObject jsonFromMultimap(MultiMap attributes) { JsonObject json = new JsonObject(); if (attributes != null) { for (Map.Entry<String, String> e: attributes.entries()) { json.put(e.getKey(), e.getValue()); } } return json; } }
public class class_name { public static JsonObject jsonFromMultimap(MultiMap attributes) { JsonObject json = new JsonObject(); if (attributes != null) { for (Map.Entry<String, String> e: attributes.entries()) { json.put(e.getKey(), e.getValue()); // depends on control dependency: [for], data = [e] } } return json; } }
public class class_name { String objectsToString(String key, Object objects) { java.io.StringWriter stringWriter = new java.io.StringWriter(); stringWriter.write(key); stringWriter.write(":"); if (objects == null) { stringWriter.write("\n"); } else if (objects instanceof Object[]) { for (int i = 0; i < ((Object[]) objects).length; i++) { Object object = ((Object[]) objects)[i]; if (object == null) stringWriter.write("null\n"); else { stringWriter.write(((Object[]) objects)[i].toString()); stringWriter.write("\n"); } } } else { stringWriter.write(objects.toString()); stringWriter.write("\n"); } return stringWriter.toString(); } }
public class class_name { String objectsToString(String key, Object objects) { java.io.StringWriter stringWriter = new java.io.StringWriter(); stringWriter.write(key); stringWriter.write(":"); if (objects == null) { stringWriter.write("\n"); // depends on control dependency: [if], data = [none] } else if (objects instanceof Object[]) { for (int i = 0; i < ((Object[]) objects).length; i++) { Object object = ((Object[]) objects)[i]; if (object == null) stringWriter.write("null\n"); else { stringWriter.write(((Object[]) objects)[i].toString()); // depends on control dependency: [if], data = [none] stringWriter.write("\n"); // depends on control dependency: [if], data = [none] } } } else { stringWriter.write(objects.toString()); // depends on control dependency: [if], data = [none] stringWriter.write("\n"); // depends on control dependency: [if], data = [none] } return stringWriter.toString(); } }
public class class_name { public String relativize(final URL url) { if (this.isOpaque() || url.isOpaque()) { return url.toString(); } if (!this.scheme().equals(url.scheme())) { return url.toString(); } if (this.authority() == null ^ url.authority() == null) { return url.toString(); } if (this.authority() != null && !this.authority().equals(url.authority())) { return url.toString(); } String prefixPath = (this.path().endsWith("/"))? this.path : this.path() + "/"; if (!url.path().startsWith(prefixPath) && !this.path().equals(url.path())) { return url.toString(); } StringBuilder output = new StringBuilder(); if (!this.path().equals(url.path())) { output.append(url.path().replaceFirst(prefixPath, "")); } if (url.query() != null) { output.append('?').append(url.query()); } if (url.fragment() != null) { output.append('#').append(url.fragment()); } return output.toString(); } }
public class class_name { public String relativize(final URL url) { if (this.isOpaque() || url.isOpaque()) { return url.toString(); // depends on control dependency: [if], data = [none] } if (!this.scheme().equals(url.scheme())) { return url.toString(); // depends on control dependency: [if], data = [none] } if (this.authority() == null ^ url.authority() == null) { return url.toString(); // depends on control dependency: [if], data = [none] } if (this.authority() != null && !this.authority().equals(url.authority())) { return url.toString(); // depends on control dependency: [if], data = [none] } String prefixPath = (this.path().endsWith("/"))? this.path : this.path() + "/"; if (!url.path().startsWith(prefixPath) && !this.path().equals(url.path())) { return url.toString(); // depends on control dependency: [if], data = [none] } StringBuilder output = new StringBuilder(); if (!this.path().equals(url.path())) { output.append(url.path().replaceFirst(prefixPath, "")); // depends on control dependency: [if], data = [none] } if (url.query() != null) { output.append('?').append(url.query()); // depends on control dependency: [if], data = [(url.query()] } if (url.fragment() != null) { output.append('#').append(url.fragment()); // depends on control dependency: [if], data = [(url.fragment()] } return output.toString(); } }
public class class_name { public ChannelUriStringBuilder termLength(final Integer termLength) { if (null != termLength) { LogBufferDescriptor.checkTermLength(termLength); } this.termLength = termLength; return this; } }
public class class_name { public ChannelUriStringBuilder termLength(final Integer termLength) { if (null != termLength) { LogBufferDescriptor.checkTermLength(termLength); // depends on control dependency: [if], data = [termLength)] } this.termLength = termLength; return this; } }
public class class_name { public static void sleepQuietly(final long sleepFor, final TimeUnit unit) { try { Thread.sleep(unit.toMillis(sleepFor)); } catch (Throwable t) { // do nothing } } }
public class class_name { public static void sleepQuietly(final long sleepFor, final TimeUnit unit) { try { Thread.sleep(unit.toMillis(sleepFor)); // depends on control dependency: [try], data = [none] } catch (Throwable t) { // do nothing } // depends on control dependency: [catch], data = [none] } }
public class class_name { public ViewScopeContextualStorage getContextualStorage( BeanManager beanManager, String viewScopeId) { ViewScopeContextualStorage contextualStorage = storageMap.get(viewScopeId); if (contextualStorage == null) { synchronized (this) { contextualStorage = storageMap.get(viewScopeId); if (contextualStorage == null) { contextualStorage = new ViewScopeContextualStorage(beanManager); storageMap.put(viewScopeId, contextualStorage); } } } return contextualStorage; } }
public class class_name { public ViewScopeContextualStorage getContextualStorage( BeanManager beanManager, String viewScopeId) { ViewScopeContextualStorage contextualStorage = storageMap.get(viewScopeId); if (contextualStorage == null) { synchronized (this) // depends on control dependency: [if], data = [none] { contextualStorage = storageMap.get(viewScopeId); if (contextualStorage == null) { contextualStorage = new ViewScopeContextualStorage(beanManager); // depends on control dependency: [if], data = [none] storageMap.put(viewScopeId, contextualStorage); // depends on control dependency: [if], data = [none] } } } return contextualStorage; } }
public class class_name { protected List<Integer> getUserWidths() { List<Integer> ret = null; try { if (Context.getThreadContext().containsUserAttribute( getCacheKey(UITable.UserCacheKey.COLUMNWIDTH))) { setUserWidth(true); final String widths = Context.getThreadContext().getUserAttribute( getCacheKey(UITable.UserCacheKey.COLUMNWIDTH)); final StringTokenizer tokens = new StringTokenizer(widths, ";"); ret = new ArrayList<>(); while (tokens.hasMoreTokens()) { final String token = tokens.nextToken(); for (int i = 0; i < token.length(); i++) { if (!Character.isDigit(token.charAt(i))) { final int width = Integer.parseInt(token.substring(0, i)); ret.add(width); break; } } } } } catch (final NumberFormatException e) { // we don't throw an error because this are only Usersettings AbstractUIHeaderObject.LOG.error("error during the retrieve of UserAttributes in getUserWidths()", e); } catch (final EFapsException e) { // we don't throw an error because this are only Usersettings AbstractUIHeaderObject.LOG.error("error during the retrieve of UserAttributes in getUserWidths()", e); } return ret; } }
public class class_name { protected List<Integer> getUserWidths() { List<Integer> ret = null; try { if (Context.getThreadContext().containsUserAttribute( getCacheKey(UITable.UserCacheKey.COLUMNWIDTH))) { setUserWidth(true); // depends on control dependency: [if], data = [none] final String widths = Context.getThreadContext().getUserAttribute( getCacheKey(UITable.UserCacheKey.COLUMNWIDTH)); final StringTokenizer tokens = new StringTokenizer(widths, ";"); ret = new ArrayList<>(); // depends on control dependency: [if], data = [none] while (tokens.hasMoreTokens()) { final String token = tokens.nextToken(); for (int i = 0; i < token.length(); i++) { if (!Character.isDigit(token.charAt(i))) { final int width = Integer.parseInt(token.substring(0, i)); ret.add(width); // depends on control dependency: [if], data = [none] break; } } } } } catch (final NumberFormatException e) { // we don't throw an error because this are only Usersettings AbstractUIHeaderObject.LOG.error("error during the retrieve of UserAttributes in getUserWidths()", e); } catch (final EFapsException e) { // depends on control dependency: [catch], data = [none] // we don't throw an error because this are only Usersettings AbstractUIHeaderObject.LOG.error("error during the retrieve of UserAttributes in getUserWidths()", e); } // depends on control dependency: [catch], data = [none] return ret; } }
public class class_name { private void markUngroupedEnclosedNodes(InstructionGroup group) { while_: while (true) { for (int i = getIndexOfFirstInsn(group), max = getIndexOfLastInsn(group); i < max; i++) { InstructionGraphNode node = method.getGraphNodes().get(i); if (node.getGroup() == null) { markGroup(node, group); sort(group); continue while_; } } break; } } }
public class class_name { private void markUngroupedEnclosedNodes(InstructionGroup group) { while_: while (true) { for (int i = getIndexOfFirstInsn(group), max = getIndexOfLastInsn(group); i < max; i++) { InstructionGraphNode node = method.getGraphNodes().get(i); if (node.getGroup() == null) { markGroup(node, group); // depends on control dependency: [if], data = [none] sort(group); // depends on control dependency: [if], data = [none] continue while_; } } break; } } }
public class class_name { protected double computeScore( int leftX , int rightX , int centerY ) { double ret=0; for( int y = -radiusY; y <= radiusY; y++ ) { for( int x = -radiusX; x <= radiusX; x++ ) { double l = GeneralizedImageOps.get(imageLeft,leftX+x,centerY+y); double r = GeneralizedImageOps.get(imageRight,rightX+x,centerY+y); ret += Math.abs(l-r); } } return ret; } }
public class class_name { protected double computeScore( int leftX , int rightX , int centerY ) { double ret=0; for( int y = -radiusY; y <= radiusY; y++ ) { for( int x = -radiusX; x <= radiusX; x++ ) { double l = GeneralizedImageOps.get(imageLeft,leftX+x,centerY+y); double r = GeneralizedImageOps.get(imageRight,rightX+x,centerY+y); ret += Math.abs(l-r); // depends on control dependency: [for], data = [none] } } return ret; } }
public class class_name { public boolean setMethodArguments(String pathName, String methodName, Integer ordinal, Object... arguments) { try { BasicNameValuePair[] params = new BasicNameValuePair[arguments.length + 2]; int x = 0; for (Object argument : arguments) { params[x] = new BasicNameValuePair("arguments[]", argument.toString()); x++; } params[x] = new BasicNameValuePair("profileIdentifier", this._profileName); params[x + 1] = new BasicNameValuePair("ordinal", ordinal.toString()); JSONObject response = new JSONObject(doPost(BASE_PATH + uriEncode(pathName) + "/" + methodName, params)); return true; } catch (Exception e) { e.printStackTrace(); } return false; } }
public class class_name { public boolean setMethodArguments(String pathName, String methodName, Integer ordinal, Object... arguments) { try { BasicNameValuePair[] params = new BasicNameValuePair[arguments.length + 2]; int x = 0; for (Object argument : arguments) { params[x] = new BasicNameValuePair("arguments[]", argument.toString()); // depends on control dependency: [for], data = [argument] x++; // depends on control dependency: [for], data = [none] } params[x] = new BasicNameValuePair("profileIdentifier", this._profileName); // depends on control dependency: [try], data = [none] params[x + 1] = new BasicNameValuePair("ordinal", ordinal.toString()); // depends on control dependency: [try], data = [none] JSONObject response = new JSONObject(doPost(BASE_PATH + uriEncode(pathName) + "/" + methodName, params)); return true; // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public static void serializeTo( Destination destination , RawDataBuffer out ) { try { if (destination == null) { out.writeByte(NO_DESTINATION); } else if (destination instanceof Queue) { out.writeByte(TYPE_QUEUE); out.writeUTF(((Queue)destination).getQueueName()); } else if (destination instanceof Topic) { out.writeByte(TYPE_TOPIC); out.writeUTF(((Topic)destination).getTopicName()); } else throw new IllegalArgumentException("Unsupported destination : "+destination); } catch (JMSException e) { throw new IllegalArgumentException("Cannot serialize destination : "+e.getMessage()); } } }
public class class_name { public static void serializeTo( Destination destination , RawDataBuffer out ) { try { if (destination == null) { out.writeByte(NO_DESTINATION); // depends on control dependency: [if], data = [none] } else if (destination instanceof Queue) { out.writeByte(TYPE_QUEUE); // depends on control dependency: [if], data = [none] out.writeUTF(((Queue)destination).getQueueName()); // depends on control dependency: [if], data = [none] } else if (destination instanceof Topic) { out.writeByte(TYPE_TOPIC); // depends on control dependency: [if], data = [none] out.writeUTF(((Topic)destination).getTopicName()); // depends on control dependency: [if], data = [none] } else throw new IllegalArgumentException("Unsupported destination : "+destination); } catch (JMSException e) { throw new IllegalArgumentException("Cannot serialize destination : "+e.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.doGet(request, response); //jsonp is specified when response is expected to go to javascript function. String jsonp = request.getParameter(HTTPClientInterface.JSONP); AuthenticationResult authResult = null; String target = request.getPathInfo(); try { response.setContentType(JSON_CONTENT_TYPE); if (!HTTPClientInterface.validateJSONP(jsonp, (Request )request, response)) { return; } response.setStatus(HttpServletResponse.SC_OK); //Requests require authentication. authResult = authenticate(request); if (!authResult.isAuthenticated()) { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, authResult.m_message)); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return; } //Authenticated but has no permissions. if (!authResult.m_authUser.hasPermission(Permission.ADMIN)) { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Permission denied")); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return; } if (target != null && !target.endsWith("/")) { // the URI may or may not end with / target += "/"; } if (target == null) { target = "/"; //Default. } //Authenticated and has ADMIN permission if (target.equals("/download/")) { //Deployment xml is text/xml response.setContentType("text/xml;charset=utf-8"); DeploymentType dt = CatalogUtil.shallowClusterAndPathsClone(this.getDeployment()); // reflect the actual number of cluster members dt.getCluster().setHostcount(getCatalogContext().getClusterSettings().hostcount()); response.getWriter().write(CatalogUtil.getDeployment(dt, true)); } else if (target.startsWith("/users/")) { // username may be passed in after the / (not as a param) if (request.getMethod().equalsIgnoreCase("POST")) { handleUpdateUser(jsonp, target, request, response, authResult); } else if (request.getMethod().equalsIgnoreCase("PUT")) { handleCreateUser(jsonp, target, request, response, authResult); } else if (request.getMethod().equalsIgnoreCase("DELETE")) { handleRemoveUser(jsonp, target, request, response, authResult); } else { handleGetUsers(jsonp, target, request, response); } } else if (target.equals("/export/types/")) { handleGetExportTypes(jsonp, response); } else if (target.equals("/")) { // just deployment if (request.getMethod().equalsIgnoreCase("POST")) { handleUpdateDeployment(jsonp, request, response, authResult); } else { //non POST response.setCharacterEncoding("UTF-8"); if (jsonp != null) { response.getWriter().write(jsonp + "("); } DeploymentType dt = getDeployment(); // reflect the actual number of cluster members dt.getCluster().setHostcount(getCatalogContext().getClusterSettings().hostcount()); m_mapper.writeValue(response.getWriter(), dt); if (jsonp != null) { response.getWriter().write(")"); } } } else { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Resource not found")); response.setStatus(HttpServletResponse.SC_NOT_FOUND); } } catch (Exception ex) { m_log.info("Not servicing url: " + target + " Details: " + ex.getMessage(), ex); } } }
public class class_name { @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.doGet(request, response); //jsonp is specified when response is expected to go to javascript function. String jsonp = request.getParameter(HTTPClientInterface.JSONP); AuthenticationResult authResult = null; String target = request.getPathInfo(); try { response.setContentType(JSON_CONTENT_TYPE); if (!HTTPClientInterface.validateJSONP(jsonp, (Request )request, response)) { return; // depends on control dependency: [if], data = [none] } response.setStatus(HttpServletResponse.SC_OK); //Requests require authentication. authResult = authenticate(request); if (!authResult.isAuthenticated()) { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, authResult.m_message)); // depends on control dependency: [if], data = [none] response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } //Authenticated but has no permissions. if (!authResult.m_authUser.hasPermission(Permission.ADMIN)) { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Permission denied")); // depends on control dependency: [if], data = [none] response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (target != null && !target.endsWith("/")) { // the URI may or may not end with / target += "/"; // depends on control dependency: [if], data = [none] } if (target == null) { target = "/"; //Default. // depends on control dependency: [if], data = [none] } //Authenticated and has ADMIN permission if (target.equals("/download/")) { //Deployment xml is text/xml response.setContentType("text/xml;charset=utf-8"); // depends on control dependency: [if], data = [none] DeploymentType dt = CatalogUtil.shallowClusterAndPathsClone(this.getDeployment()); // reflect the actual number of cluster members dt.getCluster().setHostcount(getCatalogContext().getClusterSettings().hostcount()); // depends on control dependency: [if], data = [none] response.getWriter().write(CatalogUtil.getDeployment(dt, true)); // depends on control dependency: [if], data = [none] } else if (target.startsWith("/users/")) { // username may be passed in after the / (not as a param) if (request.getMethod().equalsIgnoreCase("POST")) { handleUpdateUser(jsonp, target, request, response, authResult); // depends on control dependency: [if], data = [none] } else if (request.getMethod().equalsIgnoreCase("PUT")) { handleCreateUser(jsonp, target, request, response, authResult); // depends on control dependency: [if], data = [none] } else if (request.getMethod().equalsIgnoreCase("DELETE")) { handleRemoveUser(jsonp, target, request, response, authResult); // depends on control dependency: [if], data = [none] } else { handleGetUsers(jsonp, target, request, response); // depends on control dependency: [if], data = [none] } } else if (target.equals("/export/types/")) { handleGetExportTypes(jsonp, response); // depends on control dependency: [if], data = [none] } else if (target.equals("/")) { // just deployment if (request.getMethod().equalsIgnoreCase("POST")) { handleUpdateDeployment(jsonp, request, response, authResult); // depends on control dependency: [if], data = [none] } else { //non POST response.setCharacterEncoding("UTF-8"); // depends on control dependency: [if], data = [none] if (jsonp != null) { response.getWriter().write(jsonp + "("); // depends on control dependency: [if], data = [(jsonp] } DeploymentType dt = getDeployment(); // reflect the actual number of cluster members dt.getCluster().setHostcount(getCatalogContext().getClusterSettings().hostcount()); // depends on control dependency: [if], data = [none] m_mapper.writeValue(response.getWriter(), dt); // depends on control dependency: [if], data = [none] if (jsonp != null) { response.getWriter().write(")"); // depends on control dependency: [if], data = [none] } } } else { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Resource not found")); // depends on control dependency: [if], data = [none] response.setStatus(HttpServletResponse.SC_NOT_FOUND); // depends on control dependency: [if], data = [none] } } catch (Exception ex) { m_log.info("Not servicing url: " + target + " Details: " + ex.getMessage(), ex); } } }
public class class_name { @Override public Multimap<URI, URI> listTypedInputs(URI operationUri) { if (operationUri == null) { return ImmutableMultimap.of(); } ImmutableMultimap.Builder<URI, URI> result = ImmutableMultimap.builder(); for (URI input : this.opInputMap.get(operationUri)) { result.putAll(input, this.modelReferencesMap.get(input)); } return result.build(); } }
public class class_name { @Override public Multimap<URI, URI> listTypedInputs(URI operationUri) { if (operationUri == null) { return ImmutableMultimap.of(); // depends on control dependency: [if], data = [none] } ImmutableMultimap.Builder<URI, URI> result = ImmutableMultimap.builder(); for (URI input : this.opInputMap.get(operationUri)) { result.putAll(input, this.modelReferencesMap.get(input)); // depends on control dependency: [for], data = [input] } return result.build(); } }
public class class_name { protected void initializeState(TTTState<I, D> state) { for (int i = 0; i < alphabet.size(); i++) { I sym = alphabet.getSymbol(i); TTTTransition<I, D> trans = createTransition(state, sym); trans.setNonTreeTarget(dtree.getRoot()); state.setTransition(i, trans); openTransitions.insertIncoming(trans); } } }
public class class_name { protected void initializeState(TTTState<I, D> state) { for (int i = 0; i < alphabet.size(); i++) { I sym = alphabet.getSymbol(i); TTTTransition<I, D> trans = createTransition(state, sym); trans.setNonTreeTarget(dtree.getRoot()); // depends on control dependency: [for], data = [none] state.setTransition(i, trans); // depends on control dependency: [for], data = [i] openTransitions.insertIncoming(trans); // depends on control dependency: [for], data = [none] } } }
public class class_name { public void printHelp() { final HelpFormatter formatter = new HelpFormatter(); final Options options = new Options(); addStandardOptions(options); if (line != null && line.hasOption(ARGUMENT.ADVANCED_HELP)) { addAdvancedOptions(options); } final String helpMsg = String.format("%n%s" + " can be used to identify if there are any known CVE vulnerabilities in libraries utilized by an application. " + "%s will automatically update required data from the Internet, such as the CVE and CPE data files from nvd.nist.gov.%n%n", settings.getString("application.name", "DependencyCheck"), settings.getString("application.name", "DependencyCheck")); formatter.printHelp(settings.getString("application.name", "DependencyCheck"), helpMsg, options, "", true); } }
public class class_name { public void printHelp() { final HelpFormatter formatter = new HelpFormatter(); final Options options = new Options(); addStandardOptions(options); if (line != null && line.hasOption(ARGUMENT.ADVANCED_HELP)) { addAdvancedOptions(options); // depends on control dependency: [if], data = [none] } final String helpMsg = String.format("%n%s" + " can be used to identify if there are any known CVE vulnerabilities in libraries utilized by an application. " + "%s will automatically update required data from the Internet, such as the CVE and CPE data files from nvd.nist.gov.%n%n", settings.getString("application.name", "DependencyCheck"), settings.getString("application.name", "DependencyCheck")); formatter.printHelp(settings.getString("application.name", "DependencyCheck"), helpMsg, options, "", true); } }
public class class_name { public static String[] split(FacesContext context, String value, char... separators) { if (LangUtils.isValueBlank(value)) { return null; } List<String> tokens = new ArrayList<>(5); StringBuilder buffer = SharedStringBuilder.get(context, SHARED_SPLIT_BUFFER_KEY); int parenthesesCounter = 0; int length = value.length(); for (int i = 0; i < length; i++) { char c = value.charAt(i); if (c == '(') { parenthesesCounter++; } if (c == ')') { parenthesesCounter--; } if (parenthesesCounter == 0) { boolean isSeparator = false; for (char separator : separators) { if (c == separator) { isSeparator = true; } } if (isSeparator) { // lets add token inside buffer to our tokens tokens.add(buffer.toString()); // now we need to clear buffer buffer.delete(0, buffer.length()); } else { buffer.append(c); } } else { buffer.append(c); } } // lets not forget about part after the separator tokens.add(buffer.toString()); return tokens.toArray(new String[tokens.size()]); } }
public class class_name { public static String[] split(FacesContext context, String value, char... separators) { if (LangUtils.isValueBlank(value)) { return null; // depends on control dependency: [if], data = [none] } List<String> tokens = new ArrayList<>(5); StringBuilder buffer = SharedStringBuilder.get(context, SHARED_SPLIT_BUFFER_KEY); int parenthesesCounter = 0; int length = value.length(); for (int i = 0; i < length; i++) { char c = value.charAt(i); if (c == '(') { parenthesesCounter++; // depends on control dependency: [if], data = [none] } if (c == ')') { parenthesesCounter--; // depends on control dependency: [if], data = [none] } if (parenthesesCounter == 0) { boolean isSeparator = false; for (char separator : separators) { if (c == separator) { isSeparator = true; // depends on control dependency: [if], data = [none] } } if (isSeparator) { // lets add token inside buffer to our tokens tokens.add(buffer.toString()); // depends on control dependency: [if], data = [none] // now we need to clear buffer buffer.delete(0, buffer.length()); // depends on control dependency: [if], data = [none] } else { buffer.append(c); // depends on control dependency: [if], data = [none] } } else { buffer.append(c); // depends on control dependency: [if], data = [none] } } // lets not forget about part after the separator tokens.add(buffer.toString()); return tokens.toArray(new String[tokens.size()]); } }
public class class_name { public static double[] parseDoubles(String[] doubleStrings) { double[] values = new double[doubleStrings.length]; for (int i = 0; i < doubleStrings.length; i++) { values[i] = Double.parseDouble(doubleStrings[i].trim()); } return values; } }
public class class_name { public static double[] parseDoubles(String[] doubleStrings) { double[] values = new double[doubleStrings.length]; for (int i = 0; i < doubleStrings.length; i++) { values[i] = Double.parseDouble(doubleStrings[i].trim()); // depends on control dependency: [for], data = [i] } return values; } }
public class class_name { protected void runCommand(String commandName, CommandInterpreter interpreter) { PrintWriter out = new PrintWriter(new CommandInterpreterWriter(interpreter)); String[] args = fetchCommandParams(interpreter); try { Method method = service.getClass().getMethod(commandName, PrintWriter.class, String[].class); method.invoke(service, out, args); } catch (NoSuchMethodException e) { out.println("No such command: " + commandName); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to execute command: " + commandName + " with args: " + Arrays.toString(args), e); e.printStackTrace(out); } } }
public class class_name { protected void runCommand(String commandName, CommandInterpreter interpreter) { PrintWriter out = new PrintWriter(new CommandInterpreterWriter(interpreter)); String[] args = fetchCommandParams(interpreter); try { Method method = service.getClass().getMethod(commandName, PrintWriter.class, String[].class); method.invoke(service, out, args); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { out.println("No such command: " + commandName); } catch (Exception e) { // depends on control dependency: [catch], data = [none] LOG.log(Level.WARNING, "Unable to execute command: " + commandName + " with args: " + Arrays.toString(args), e); e.printStackTrace(out); } // depends on control dependency: [catch], data = [none] } }
public class class_name { void add_vector(SparseVector vec) { for (Map.Entry<Integer, Double> entry : vec.entrySet()) { Double v = get(entry.getKey()); if (v == null) v = 0.; put(entry.getKey(), v + entry.getValue()); } } }
public class class_name { void add_vector(SparseVector vec) { for (Map.Entry<Integer, Double> entry : vec.entrySet()) { Double v = get(entry.getKey()); if (v == null) v = 0.; put(entry.getKey(), v + entry.getValue()); // depends on control dependency: [for], data = [entry] } } }
public class class_name { public void setTextVisible(final boolean VISIBLE) { if (null == textVisible) { _textVisible = VISIBLE; fireUpdateEvent(VISIBILITY_EVENT); } else { textVisible.set(VISIBLE); } } }
public class class_name { public void setTextVisible(final boolean VISIBLE) { if (null == textVisible) { _textVisible = VISIBLE; // depends on control dependency: [if], data = [none] fireUpdateEvent(VISIBILITY_EVENT); // depends on control dependency: [if], data = [none] } else { textVisible.set(VISIBLE); // depends on control dependency: [if], data = [none] } } }
public class class_name { public List<DifferentialFunction> exec(List<DifferentialFunction> ops) { for (int i = 0; i < ops.size(); i++) { Op op = (Op) ops.get(i); Nd4j.getExecutioner().exec(op); } return ops; } }
public class class_name { public List<DifferentialFunction> exec(List<DifferentialFunction> ops) { for (int i = 0; i < ops.size(); i++) { Op op = (Op) ops.get(i); Nd4j.getExecutioner().exec(op); // depends on control dependency: [for], data = [none] } return ops; } }
public class class_name { @Override public EClass getIfcPositiveRatioMeasure() { if (ifcPositiveRatioMeasureEClass == null) { ifcPositiveRatioMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(903); } return ifcPositiveRatioMeasureEClass; } }
public class class_name { @Override public EClass getIfcPositiveRatioMeasure() { if (ifcPositiveRatioMeasureEClass == null) { ifcPositiveRatioMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(903); // depends on control dependency: [if], data = [none] } return ifcPositiveRatioMeasureEClass; } }
public class class_name { public static <X> String createTypeId(Class<X> clazz, Collection<Annotation> annotations, Collection<AnnotatedMethod<? super X>> methods, Collection<AnnotatedField<? super X>> fields, Collection<AnnotatedConstructor<X>> constructors) { StringBuilder builder = new StringBuilder(); builder.append(clazz.getName()); builder.append(createAnnotationCollectionId(annotations)); builder.append("{"); // now deal with the fields List<AnnotatedField<? super X>> sortedFields = new ArrayList<AnnotatedField<? super X>>(); sortedFields.addAll(fields); Collections.sort(sortedFields, AnnotatedFieldComparator.<X>instance()); for (AnnotatedField<? super X> field : sortedFields) { if (!field.getAnnotations().isEmpty()) { builder.append(createFieldId(field)); builder.append(SEPERATOR); } } // methods List<AnnotatedMethod<? super X>> sortedMethods = new ArrayList<AnnotatedMethod<? super X>>(); sortedMethods.addAll(methods); Collections.sort(sortedMethods, AnnotatedMethodComparator.<X>instance()); for (AnnotatedMethod<? super X> method : sortedMethods) { if (!method.getAnnotations().isEmpty() || hasMethodParameters(method)) { builder.append(createCallableId(method)); builder.append(SEPERATOR); } } // constructors List<AnnotatedConstructor<? super X>> sortedConstructors = new ArrayList<AnnotatedConstructor<? super X>>(); sortedConstructors.addAll(constructors); Collections.sort(sortedConstructors, AnnotatedConstructorComparator.<X>instance()); for (AnnotatedConstructor<? super X> constructor : sortedConstructors) { if (!constructor.getAnnotations().isEmpty() || hasMethodParameters(constructor)) { builder.append(createCallableId(constructor)); builder.append(SEPERATOR); } } builder.append("}"); return builder.toString(); } }
public class class_name { public static <X> String createTypeId(Class<X> clazz, Collection<Annotation> annotations, Collection<AnnotatedMethod<? super X>> methods, Collection<AnnotatedField<? super X>> fields, Collection<AnnotatedConstructor<X>> constructors) { StringBuilder builder = new StringBuilder(); builder.append(clazz.getName()); builder.append(createAnnotationCollectionId(annotations)); builder.append("{"); // now deal with the fields List<AnnotatedField<? super X>> sortedFields = new ArrayList<AnnotatedField<? super X>>(); sortedFields.addAll(fields); Collections.sort(sortedFields, AnnotatedFieldComparator.<X>instance()); for (AnnotatedField<? super X> field : sortedFields) { if (!field.getAnnotations().isEmpty()) { builder.append(createFieldId(field)); // depends on control dependency: [if], data = [none] builder.append(SEPERATOR); // depends on control dependency: [if], data = [none] } } // methods List<AnnotatedMethod<? super X>> sortedMethods = new ArrayList<AnnotatedMethod<? super X>>(); sortedMethods.addAll(methods); Collections.sort(sortedMethods, AnnotatedMethodComparator.<X>instance()); for (AnnotatedMethod<? super X> method : sortedMethods) { if (!method.getAnnotations().isEmpty() || hasMethodParameters(method)) { builder.append(createCallableId(method)); // depends on control dependency: [if], data = [none] builder.append(SEPERATOR); // depends on control dependency: [if], data = [none] } } // constructors List<AnnotatedConstructor<? super X>> sortedConstructors = new ArrayList<AnnotatedConstructor<? super X>>(); sortedConstructors.addAll(constructors); Collections.sort(sortedConstructors, AnnotatedConstructorComparator.<X>instance()); for (AnnotatedConstructor<? super X> constructor : sortedConstructors) { if (!constructor.getAnnotations().isEmpty() || hasMethodParameters(constructor)) { builder.append(createCallableId(constructor)); // depends on control dependency: [if], data = [none] builder.append(SEPERATOR); // depends on control dependency: [if], data = [none] } } builder.append("}"); return builder.toString(); } }
public class class_name { @Override protected void onSharedObject(RTMPConnection conn, Channel channel, Header source, SharedObjectMessage message) { if (log.isDebugEnabled()) { log.debug("onSharedObject - conn: {} channel: {} so message: {}", new Object[] { conn.getSessionId(), channel.getId(), message }); } final IScope scope = conn.getScope(); if (scope != null) { // so name String name = message.getName(); // whether or not the incoming so is persistent boolean persistent = message.isPersistent(); // shared object service ISharedObjectService sharedObjectService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, SharedObjectService.class, false); if (!sharedObjectService.hasSharedObject(scope, name)) { log.debug("Shared object service doesnt have requested object, creation will be attempted"); ISharedObjectSecurityService security = (ISharedObjectSecurityService) ScopeUtils.getScopeService(scope, ISharedObjectSecurityService.class); if (security != null) { // Check handlers to see if creation is allowed for (ISharedObjectSecurity handler : security.getSharedObjectSecurity()) { if (!handler.isCreationAllowed(scope, name, persistent)) { log.debug("Shared object create failed, creation is not allowed"); sendSOCreationFailed(conn, message); return; } } } if (!sharedObjectService.createSharedObject(scope, name, persistent)) { log.debug("Shared object create failed"); sendSOCreationFailed(conn, message); return; } } ISharedObject so = sharedObjectService.getSharedObject(scope, name); if (so != null) { if (so.isPersistent() == persistent) { log.debug("Dispatch persistent shared object"); so.dispatchEvent(message); } else { log.warn("Shared object persistence mismatch - current: {} incoming: {}", so.isPersistent(), persistent); // reset the object so we can re-use it message.reset(); // add the error event message.addEvent(new SharedObjectEvent(ISharedObjectEvent.Type.CLIENT_STATUS, "error", SO_PERSISTENCE_MISMATCH)); conn.getChannel(3).write(message); } } else { log.warn("Shared object lookup returned null for {} in {}", name, scope.getName()); // reset the object so we can re-use it message.reset(); // add the error event message.addEvent(new SharedObjectEvent(ISharedObjectEvent.Type.CLIENT_STATUS, "error", NC_CALL_FAILED)); conn.getChannel(3).write(message); } } else { // The scope already has been deleted log.debug("Shared object scope was not found"); sendSOCreationFailed(conn, message); } } }
public class class_name { @Override protected void onSharedObject(RTMPConnection conn, Channel channel, Header source, SharedObjectMessage message) { if (log.isDebugEnabled()) { log.debug("onSharedObject - conn: {} channel: {} so message: {}", new Object[] { conn.getSessionId(), channel.getId(), message }); // depends on control dependency: [if], data = [none] } final IScope scope = conn.getScope(); if (scope != null) { // so name String name = message.getName(); // whether or not the incoming so is persistent boolean persistent = message.isPersistent(); // shared object service ISharedObjectService sharedObjectService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, SharedObjectService.class, false); if (!sharedObjectService.hasSharedObject(scope, name)) { log.debug("Shared object service doesnt have requested object, creation will be attempted"); // depends on control dependency: [if], data = [none] ISharedObjectSecurityService security = (ISharedObjectSecurityService) ScopeUtils.getScopeService(scope, ISharedObjectSecurityService.class); if (security != null) { // Check handlers to see if creation is allowed for (ISharedObjectSecurity handler : security.getSharedObjectSecurity()) { if (!handler.isCreationAllowed(scope, name, persistent)) { log.debug("Shared object create failed, creation is not allowed"); // depends on control dependency: [if], data = [none] sendSOCreationFailed(conn, message); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } } if (!sharedObjectService.createSharedObject(scope, name, persistent)) { log.debug("Shared object create failed"); // depends on control dependency: [if], data = [none] sendSOCreationFailed(conn, message); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } ISharedObject so = sharedObjectService.getSharedObject(scope, name); if (so != null) { if (so.isPersistent() == persistent) { log.debug("Dispatch persistent shared object"); // depends on control dependency: [if], data = [none] so.dispatchEvent(message); // depends on control dependency: [if], data = [none] } else { log.warn("Shared object persistence mismatch - current: {} incoming: {}", so.isPersistent(), persistent); // depends on control dependency: [if], data = [persistent)] // reset the object so we can re-use it message.reset(); // depends on control dependency: [if], data = [none] // add the error event message.addEvent(new SharedObjectEvent(ISharedObjectEvent.Type.CLIENT_STATUS, "error", SO_PERSISTENCE_MISMATCH)); // depends on control dependency: [if], data = [none] conn.getChannel(3).write(message); // depends on control dependency: [if], data = [none] } } else { log.warn("Shared object lookup returned null for {} in {}", name, scope.getName()); // depends on control dependency: [if], data = [none] // reset the object so we can re-use it message.reset(); // depends on control dependency: [if], data = [none] // add the error event message.addEvent(new SharedObjectEvent(ISharedObjectEvent.Type.CLIENT_STATUS, "error", NC_CALL_FAILED)); // depends on control dependency: [if], data = [none] conn.getChannel(3).write(message); // depends on control dependency: [if], data = [none] } } else { // The scope already has been deleted log.debug("Shared object scope was not found"); // depends on control dependency: [if], data = [none] sendSOCreationFailed(conn, message); // depends on control dependency: [if], data = [none] } } }
public class class_name { public java.util.List<HostEntry> getExtraHosts() { if (extraHosts == null) { extraHosts = new com.amazonaws.internal.SdkInternalList<HostEntry>(); } return extraHosts; } }
public class class_name { public java.util.List<HostEntry> getExtraHosts() { if (extraHosts == null) { extraHosts = new com.amazonaws.internal.SdkInternalList<HostEntry>(); // depends on control dependency: [if], data = [none] } return extraHosts; } }
public class class_name { public synchronized Future<?> addIndexedColumn(ColumnDefinition cdef) { if (indexesByColumn.containsKey(cdef.name.bytes)) return null; assert cdef.getIndexType() != null; SecondaryIndex index; try { index = SecondaryIndex.createInstance(baseCfs, cdef); } catch (ConfigurationException e) { throw new RuntimeException(e); } // Keep a single instance of the index per-cf for row level indexes // since we want all columns to be under the index if (index instanceof PerRowSecondaryIndex) { SecondaryIndex currentIndex = rowLevelIndexMap.get(index.getClass()); if (currentIndex == null) { rowLevelIndexMap.put(index.getClass(), index); index.init(); } else { index = currentIndex; index.addColumnDef(cdef); logger.info("Creating new index : {}",cdef); } } else { // TODO: We sould do better than throw a RuntimeException if (cdef.getIndexType() == IndexType.CUSTOM && index instanceof AbstractSimplePerColumnSecondaryIndex) throw new RuntimeException("Cannot use a subclass of AbstractSimplePerColumnSecondaryIndex as a CUSTOM index, as they assume they are CFS backed"); index.init(); } // link in indexedColumns. this means that writes will add new data to // the index immediately, // so we don't have to lock everything while we do the build. it's up to // the operator to wait // until the index is actually built before using in queries. indexesByColumn.put(cdef.name.bytes, index); // Add to all indexes set: allIndexes.add(index); // if we're just linking in the index to indexedColumns on an // already-built index post-restart, we're done if (index.isIndexBuilt(cdef.name.bytes)) return null; return index.buildIndexAsync(); } }
public class class_name { public synchronized Future<?> addIndexedColumn(ColumnDefinition cdef) { if (indexesByColumn.containsKey(cdef.name.bytes)) return null; assert cdef.getIndexType() != null; SecondaryIndex index; try { index = SecondaryIndex.createInstance(baseCfs, cdef); // depends on control dependency: [try], data = [none] } catch (ConfigurationException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] // Keep a single instance of the index per-cf for row level indexes // since we want all columns to be under the index if (index instanceof PerRowSecondaryIndex) { SecondaryIndex currentIndex = rowLevelIndexMap.get(index.getClass()); if (currentIndex == null) { rowLevelIndexMap.put(index.getClass(), index); // depends on control dependency: [if], data = [none] index.init(); // depends on control dependency: [if], data = [none] } else { index = currentIndex; // depends on control dependency: [if], data = [none] index.addColumnDef(cdef); // depends on control dependency: [if], data = [none] logger.info("Creating new index : {}",cdef); // depends on control dependency: [if], data = [none] } } else { // TODO: We sould do better than throw a RuntimeException if (cdef.getIndexType() == IndexType.CUSTOM && index instanceof AbstractSimplePerColumnSecondaryIndex) throw new RuntimeException("Cannot use a subclass of AbstractSimplePerColumnSecondaryIndex as a CUSTOM index, as they assume they are CFS backed"); index.init(); // depends on control dependency: [if], data = [none] } // link in indexedColumns. this means that writes will add new data to // the index immediately, // so we don't have to lock everything while we do the build. it's up to // the operator to wait // until the index is actually built before using in queries. indexesByColumn.put(cdef.name.bytes, index); // Add to all indexes set: allIndexes.add(index); // if we're just linking in the index to indexedColumns on an // already-built index post-restart, we're done if (index.isIndexBuilt(cdef.name.bytes)) return null; return index.buildIndexAsync(); } }
public class class_name { public boolean getShowProgressBackground() { Drawable drawable = getCurrentDrawable(); if (drawable instanceof ShowBackgroundDrawable) { return ((ShowBackgroundDrawable) drawable).getShowBackground(); } else { return false; } } }
public class class_name { public boolean getShowProgressBackground() { Drawable drawable = getCurrentDrawable(); if (drawable instanceof ShowBackgroundDrawable) { return ((ShowBackgroundDrawable) drawable).getShowBackground(); // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { protected String getErrorMessageFromCookie(final HttpServletRequest request) { final Cookie cookie = getCookieByName(request, AZKABAN_FAILURE_MESSAGE); if (cookie == null) { return null; } return cookie.getValue(); } }
public class class_name { protected String getErrorMessageFromCookie(final HttpServletRequest request) { final Cookie cookie = getCookieByName(request, AZKABAN_FAILURE_MESSAGE); if (cookie == null) { return null; // depends on control dependency: [if], data = [none] } return cookie.getValue(); } }
public class class_name { public static NDArrayMessage of(INDArray arr, int[] dimensions, long index) { //allow null dimensions as long as index is -1 if (dimensions == null) { dimensions = WHOLE_ARRAY_UPDATE; } //validate index being built if (index > 0) { if (dimensions.length > 1 || dimensions.length == 1 && dimensions[0] != -1) throw new IllegalArgumentException( "Inconsistent message. Your index is > 0 indicating you want to send a whole ndarray message but your dimensions indicate you are trying to send a partial update. Please ensure you use a 1 length int array with negative 1 as an element or use NDArrayMesage.wholeArrayUpdate(ndarray) for creation instead"); } return NDArrayMessage.builder().index(index).dimensions(dimensions).sent(getCurrentTimeUtc()).arr(arr).build(); } }
public class class_name { public static NDArrayMessage of(INDArray arr, int[] dimensions, long index) { //allow null dimensions as long as index is -1 if (dimensions == null) { dimensions = WHOLE_ARRAY_UPDATE; // depends on control dependency: [if], data = [none] } //validate index being built if (index > 0) { if (dimensions.length > 1 || dimensions.length == 1 && dimensions[0] != -1) throw new IllegalArgumentException( "Inconsistent message. Your index is > 0 indicating you want to send a whole ndarray message but your dimensions indicate you are trying to send a partial update. Please ensure you use a 1 length int array with negative 1 as an element or use NDArrayMesage.wholeArrayUpdate(ndarray) for creation instead"); } return NDArrayMessage.builder().index(index).dimensions(dimensions).sent(getCurrentTimeUtc()).arr(arr).build(); } }
public class class_name { protected WSCompositeURI duplicate(URI uri) { try { return new WSCompositeURI(uri); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } } }
public class class_name { protected WSCompositeURI duplicate(URI uri) { try { return new WSCompositeURI(uri); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) { Type[] genericExceptionTypes; if (methodOrConstructor instanceof Method) { Method method = (Method) methodOrConstructor; checkArgument( method.getDeclaringClass().isAssignableFrom(rawType), "%s is not defined by a supertype of %s", method, type); genericExceptionTypes = method.getGenericExceptionTypes(); } else if (methodOrConstructor instanceof Constructor) { Constructor<?> constructor = (Constructor<?>) methodOrConstructor; checkArgument( constructor.getDeclaringClass().isAssignableFrom(rawType), "%s does not construct a supertype of %s", constructor, type); genericExceptionTypes = constructor.getGenericExceptionTypes(); } else { throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor); } return resolveAll(genericExceptionTypes); } }
public class class_name { public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) { Type[] genericExceptionTypes; if (methodOrConstructor instanceof Method) { Method method = (Method) methodOrConstructor; checkArgument( method.getDeclaringClass().isAssignableFrom(rawType), "%s is not defined by a supertype of %s", method, type); // depends on control dependency: [if], data = [none] genericExceptionTypes = method.getGenericExceptionTypes(); // depends on control dependency: [if], data = [none] } else if (methodOrConstructor instanceof Constructor) { Constructor<?> constructor = (Constructor<?>) methodOrConstructor; checkArgument( constructor.getDeclaringClass().isAssignableFrom(rawType), "%s does not construct a supertype of %s", constructor, type); // depends on control dependency: [if], data = [none] genericExceptionTypes = constructor.getGenericExceptionTypes(); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor); } return resolveAll(genericExceptionTypes); } }
public class class_name { public BoxFolder.Info restoreFolder(String folderID, String newName, String newParentID) { JsonObject requestJSON = new JsonObject(); if (newName != null) { requestJSON.add("name", newName); } if (newParentID != null) { JsonObject parent = new JsonObject(); parent.add("id", newParentID); requestJSON.add("parent", parent); } URL url = RESTORE_FOLDER_URL_TEMPLATE.build(this.api.getBaseURL(), folderID); BoxJSONRequest request = new BoxJSONRequest(this.api, url, "POST"); request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxFolder restoredFolder = new BoxFolder(this.api, responseJSON.get("id").asString()); return restoredFolder.new Info(responseJSON); } }
public class class_name { public BoxFolder.Info restoreFolder(String folderID, String newName, String newParentID) { JsonObject requestJSON = new JsonObject(); if (newName != null) { requestJSON.add("name", newName); // depends on control dependency: [if], data = [none] } if (newParentID != null) { JsonObject parent = new JsonObject(); parent.add("id", newParentID); // depends on control dependency: [if], data = [none] requestJSON.add("parent", parent); // depends on control dependency: [if], data = [none] } URL url = RESTORE_FOLDER_URL_TEMPLATE.build(this.api.getBaseURL(), folderID); BoxJSONRequest request = new BoxJSONRequest(this.api, url, "POST"); request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxFolder restoredFolder = new BoxFolder(this.api, responseJSON.get("id").asString()); return restoredFolder.new Info(responseJSON); } }
public class class_name { private String replaceInternal(final JQLContext jqlContext, String jql, final List<Triple<Token, Token, String>> replace, JqlBaseListener rewriterListener) { Pair<ParserRuleContext, CommonTokenStream> parser = prepareParser(jqlContext, jql); walker.walk(rewriterListener, parser.value0); TokenStreamRewriter rewriter = new TokenStreamRewriter(parser.value1); for (Triple<Token, Token, String> item : replace) { rewriter.replace(item.value0, item.value1, item.value2); } return rewriter.getText(); } }
public class class_name { private String replaceInternal(final JQLContext jqlContext, String jql, final List<Triple<Token, Token, String>> replace, JqlBaseListener rewriterListener) { Pair<ParserRuleContext, CommonTokenStream> parser = prepareParser(jqlContext, jql); walker.walk(rewriterListener, parser.value0); TokenStreamRewriter rewriter = new TokenStreamRewriter(parser.value1); for (Triple<Token, Token, String> item : replace) { rewriter.replace(item.value0, item.value1, item.value2); // depends on control dependency: [for], data = [item] } return rewriter.getText(); } }
public class class_name { protected void addRemoteTransactionsDependency() { this.getConfigurators().add(new ComponentConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration componentConfiguration) throws DeploymentUnitProcessingException { if (this.hasRemoteView((EJBComponentDescription) description)) { // add a dependency on local transaction service componentConfiguration.getCreateDependencies().add((sb, cs) -> sb.requires(TxnServices.JBOSS_TXN_REMOTE_TRANSACTION_SERVICE)); } } /** * Returns true if the passed EJB component description has at least one remote view * @param ejbComponentDescription * @return */ private boolean hasRemoteView(final EJBComponentDescription ejbComponentDescription) { final Set<ViewDescription> views = ejbComponentDescription.getViews(); for (final ViewDescription view : views) { if (!(view instanceof EJBViewDescription)) { continue; } final MethodIntf viewType = ((EJBViewDescription) view).getMethodIntf(); if (viewType == MethodIntf.REMOTE || viewType == MethodIntf.HOME) { return true; } } return false; } }); } }
public class class_name { protected void addRemoteTransactionsDependency() { this.getConfigurators().add(new ComponentConfigurator() { @Override public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration componentConfiguration) throws DeploymentUnitProcessingException { if (this.hasRemoteView((EJBComponentDescription) description)) { // add a dependency on local transaction service componentConfiguration.getCreateDependencies().add((sb, cs) -> sb.requires(TxnServices.JBOSS_TXN_REMOTE_TRANSACTION_SERVICE)); } } /** * Returns true if the passed EJB component description has at least one remote view * @param ejbComponentDescription * @return */ private boolean hasRemoteView(final EJBComponentDescription ejbComponentDescription) { final Set<ViewDescription> views = ejbComponentDescription.getViews(); for (final ViewDescription view : views) { if (!(view instanceof EJBViewDescription)) { continue; } final MethodIntf viewType = ((EJBViewDescription) view).getMethodIntf(); if (viewType == MethodIntf.REMOTE || viewType == MethodIntf.HOME) { return true; // depends on control dependency: [if], data = [none] } } return false; } }); } }
public class class_name { public void annotateFieldJSR303(JMethod getter, boolean addValidAnnotation) { if (isRequired()) { getter.annotate(NotNull.class); } if (StringUtils.hasText(getPattern())) { JAnnotationUse annotation = getter.annotate(Pattern.class); annotation.param("regexp", getPattern()); } if (getMinLength() != null || getMaxLength() != null) { JAnnotationUse annotation = getter.annotate(Size.class); if (getMinLength() != null) { annotation.param("min", getMinLength()); } if (getMaxLength() != null) { annotation.param("max", getMaxLength()); } } if (addValidAnnotation) { getter.annotate(Valid.class); } if (minimum != null) { JAnnotationUse annotation = getter.annotate(DecimalMin.class); annotation.param("value", String.valueOf(minimum)); } if (maximum != null) { JAnnotationUse annotation = getter.annotate(DecimalMax.class); annotation.param("value", String.valueOf(maximum)); } } }
public class class_name { public void annotateFieldJSR303(JMethod getter, boolean addValidAnnotation) { if (isRequired()) { getter.annotate(NotNull.class); // depends on control dependency: [if], data = [none] } if (StringUtils.hasText(getPattern())) { JAnnotationUse annotation = getter.annotate(Pattern.class); annotation.param("regexp", getPattern()); // depends on control dependency: [if], data = [none] } if (getMinLength() != null || getMaxLength() != null) { JAnnotationUse annotation = getter.annotate(Size.class); if (getMinLength() != null) { annotation.param("min", getMinLength()); // depends on control dependency: [if], data = [none] } if (getMaxLength() != null) { annotation.param("max", getMaxLength()); // depends on control dependency: [if], data = [none] } } if (addValidAnnotation) { getter.annotate(Valid.class); // depends on control dependency: [if], data = [none] } if (minimum != null) { JAnnotationUse annotation = getter.annotate(DecimalMin.class); annotation.param("value", String.valueOf(minimum)); // depends on control dependency: [if], data = [(minimum] } if (maximum != null) { JAnnotationUse annotation = getter.annotate(DecimalMax.class); annotation.param("value", String.valueOf(maximum)); // depends on control dependency: [if], data = [(maximum] } } }
public class class_name { private boolean passConditionalHeaders(HttpRequest request, HttpResponse response, Resource resource) throws IOException { if (!request.getMethod().equals(HttpRequest.__HEAD)) { // If we have meta data for the file // Try a direct match for most common requests. Avoids // parsing the date. ResourceCache.ResourceMetaData metaData = (ResourceCache.ResourceMetaData)resource.getAssociate(); if (metaData!=null) { String ifms=request.getField(HttpFields.__IfModifiedSince); String mdlm=metaData.getLastModified(); if (ifms!=null && mdlm!=null && ifms.equals(mdlm)) { response.setStatus(HttpResponse.__304_Not_Modified); request.setHandled(true); return false; } } long date=0; // Parse the if[un]modified dates and compare to resource if ((date=request.getDateField(HttpFields.__IfUnmodifiedSince))>0) { if (resource.lastModified()/1000 > date/1000) { response.sendError(HttpResponse.__412_Precondition_Failed); return false; } } if ((date=request.getDateField(HttpFields.__IfModifiedSince))>0) { if (resource.lastModified()/1000 <= date/1000) { response.setStatus(HttpResponse.__304_Not_Modified); request.setHandled(true); return false; } } } return true; } }
public class class_name { private boolean passConditionalHeaders(HttpRequest request, HttpResponse response, Resource resource) throws IOException { if (!request.getMethod().equals(HttpRequest.__HEAD)) { // If we have meta data for the file // Try a direct match for most common requests. Avoids // parsing the date. ResourceCache.ResourceMetaData metaData = (ResourceCache.ResourceMetaData)resource.getAssociate(); if (metaData!=null) { String ifms=request.getField(HttpFields.__IfModifiedSince); String mdlm=metaData.getLastModified(); if (ifms!=null && mdlm!=null && ifms.equals(mdlm)) { response.setStatus(HttpResponse.__304_Not_Modified); // depends on control dependency: [if], data = [none] request.setHandled(true); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } long date=0; // Parse the if[un]modified dates and compare to resource if ((date=request.getDateField(HttpFields.__IfUnmodifiedSince))>0) { if (resource.lastModified()/1000 > date/1000) { response.sendError(HttpResponse.__412_Precondition_Failed); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } if ((date=request.getDateField(HttpFields.__IfModifiedSince))>0) { if (resource.lastModified()/1000 <= date/1000) { response.setStatus(HttpResponse.__304_Not_Modified); // depends on control dependency: [if], data = [none] request.setHandled(true); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } } } return true; } }
public class class_name { Tracer newTracer(String passName) { String comment = passName + (recentChange.hasCodeChanged() ? " on recently changed AST" : ""); if (options.getTracerMode().isOn() && tracker != null) { tracker.recordPassStart(passName, true); } return new Tracer("Compiler", comment); } }
public class class_name { Tracer newTracer(String passName) { String comment = passName + (recentChange.hasCodeChanged() ? " on recently changed AST" : ""); if (options.getTracerMode().isOn() && tracker != null) { tracker.recordPassStart(passName, true); // depends on control dependency: [if], data = [none] } return new Tracer("Compiler", comment); } }
public class class_name { public Object set(int index, Object element) { Object oldObject = items.set(index, element); if (hasChanged(oldObject, element)) { fireContentsChanged(index); } return oldObject; } }
public class class_name { public Object set(int index, Object element) { Object oldObject = items.set(index, element); if (hasChanged(oldObject, element)) { fireContentsChanged(index); // depends on control dependency: [if], data = [none] } return oldObject; } }
public class class_name { public Transient<EmbeddableAttributes<T>> getOrCreateTransient() { List<Node> nodeList = childNode.get("transient"); if (nodeList != null && nodeList.size() > 0) { return new TransientImpl<EmbeddableAttributes<T>>(this, "transient", childNode, nodeList.get(0)); } return createTransient(); } }
public class class_name { public Transient<EmbeddableAttributes<T>> getOrCreateTransient() { List<Node> nodeList = childNode.get("transient"); if (nodeList != null && nodeList.size() > 0) { return new TransientImpl<EmbeddableAttributes<T>>(this, "transient", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createTransient(); } }
public class class_name { public void updateButtons() { AbstractButton cancelButton = wizard.getCancelButton(); if (cancelButton != null) { cancelButton.setEnabled(currentPage.isCancelAllowed()); } AbstractButton previousButton = wizard.getPreviousButton(); if (previousButton != null) { previousButton.setEnabled(currentPage.isPreviousAllowed() && !pageHistory.isEmpty()); } AbstractButton nextButton = wizard.getNextButton(); if (nextButton != null) { nextButton.setEnabled(currentPage.isNextAllowed() && (currentPage.getNextPage() != null)); } AbstractButton finishButton = wizard.getFinishButton(); if (finishButton != null) { finishButton.setEnabled(currentPage.isFinishAllowed()); } } }
public class class_name { public void updateButtons() { AbstractButton cancelButton = wizard.getCancelButton(); if (cancelButton != null) { cancelButton.setEnabled(currentPage.isCancelAllowed()); // depends on control dependency: [if], data = [none] } AbstractButton previousButton = wizard.getPreviousButton(); if (previousButton != null) { previousButton.setEnabled(currentPage.isPreviousAllowed() && !pageHistory.isEmpty()); // depends on control dependency: [if], data = [none] } AbstractButton nextButton = wizard.getNextButton(); if (nextButton != null) { nextButton.setEnabled(currentPage.isNextAllowed() && (currentPage.getNextPage() != null)); // depends on control dependency: [if], data = [null)] } AbstractButton finishButton = wizard.getFinishButton(); if (finishButton != null) { finishButton.setEnabled(currentPage.isFinishAllowed()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static ResourceReader getResourceReaderProxy(ResourceGenerator generator, ResourceReaderHandler rsReaderHandler, JawrConfig config) { ResourceReader proxy = null; // Defines the interfaces to be implemented by the ResourceReader int nbExtraInterface = 0; Class<?>[] extraInterfaces = new Class<?>[2]; boolean isResourceGenerator = generator instanceof ResourceGenerator; boolean isStreamResourceGenerator = generator instanceof StreamResourceGenerator; if (isResourceGenerator) { extraInterfaces[nbExtraInterface++] = TextResourceReader.class; } if (isStreamResourceGenerator) { extraInterfaces[nbExtraInterface++] = StreamResourceReader.class; } Class<?>[] generatorInterfaces = getGeneratorInterfaces(generator); Class<?>[] implementedInterfaces = new Class[generatorInterfaces.length + nbExtraInterface]; System.arraycopy(generatorInterfaces, 0, implementedInterfaces, 0, generatorInterfaces.length); System.arraycopy(extraInterfaces, 0, implementedInterfaces, generatorInterfaces.length, nbExtraInterface); // Creates the proxy InvocationHandler handler = new ResourceGeneratorReaderWrapperInvocationHandler(generator, rsReaderHandler, config); proxy = (ResourceReader) Proxy.newProxyInstance(ResourceGeneratorReaderProxyFactory.class.getClassLoader(), implementedInterfaces, handler); return proxy; } }
public class class_name { public static ResourceReader getResourceReaderProxy(ResourceGenerator generator, ResourceReaderHandler rsReaderHandler, JawrConfig config) { ResourceReader proxy = null; // Defines the interfaces to be implemented by the ResourceReader int nbExtraInterface = 0; Class<?>[] extraInterfaces = new Class<?>[2]; boolean isResourceGenerator = generator instanceof ResourceGenerator; boolean isStreamResourceGenerator = generator instanceof StreamResourceGenerator; if (isResourceGenerator) { extraInterfaces[nbExtraInterface++] = TextResourceReader.class; } if (isStreamResourceGenerator) { extraInterfaces[nbExtraInterface++] = StreamResourceReader.class; // depends on control dependency: [if], data = [none] } Class<?>[] generatorInterfaces = getGeneratorInterfaces(generator); Class<?>[] implementedInterfaces = new Class[generatorInterfaces.length + nbExtraInterface]; System.arraycopy(generatorInterfaces, 0, implementedInterfaces, 0, generatorInterfaces.length); System.arraycopy(extraInterfaces, 0, implementedInterfaces, generatorInterfaces.length, nbExtraInterface); // Creates the proxy InvocationHandler handler = new ResourceGeneratorReaderWrapperInvocationHandler(generator, rsReaderHandler, config); proxy = (ResourceReader) Proxy.newProxyInstance(ResourceGeneratorReaderProxyFactory.class.getClassLoader(), implementedInterfaces, handler); return proxy; } }
public class class_name { public int getPartition(byte[] key, byte[] value, int numReduceTasks) { try { /** * {@link partitionId} is the Voldemort primary partition that this * record belongs to. */ int partitionId = ByteUtils.readInt(value, ByteUtils.SIZE_OF_INT); /** * This is the base number we will ultimately mod by {@link numReduceTasks} * to determine which reduce task to shuffle to. */ int magicNumber = partitionId; if (getSaveKeys() && !buildPrimaryReplicasOnly) { /** * When saveKeys is enabled (which also implies we are generating * READ_ONLY_V2 format files), then we are generating files with * a replica type, with one file per replica. * * Each replica is sent to a different reducer, and thus the * {@link magicNumber} is scaled accordingly. * * The downside to this is that it is pretty wasteful. The files * generated for each replicas are identical to one another, so * there's no point in generating them independently in many * reducers. * * This is one of the reasons why buildPrimaryReplicasOnly was * written. In this mode, we only generate the files for the * primary replica, which means the number of reducers is * minimized and {@link magicNumber} does not need to be scaled. */ int replicaType = (int) ByteUtils.readBytes(value, 2 * ByteUtils.SIZE_OF_INT, ByteUtils.SIZE_OF_BYTE); magicNumber = magicNumber * getStoreDef().getReplicationFactor() + replicaType; } if (!getReducerPerBucket()) { /** * Partition files can be split in many chunks in order to limit the * maximum file size downloaded and handled by Voldemort servers. * * {@link chunkId} represents which chunk of partition then current * record belongs to. */ int chunkId = ReadOnlyUtils.chunk(key, getNumChunks()); /** * When reducerPerBucket is disabled, all chunks are sent to a * different reducer. This increases parallelism at the expense * of adding more load on Hadoop. * * {@link magicNumber} is thus scaled accordingly, in order to * leverage the extra reducers available to us. */ magicNumber = magicNumber * getNumChunks() + chunkId; } /** * Finally, we mod {@link magicNumber} by {@link numReduceTasks}, * since the MapReduce framework expects the return of this function * to be bounded by the number of reduce tasks running in the job. */ return magicNumber % numReduceTasks; } catch (Exception e) { throw new VoldemortException("Caught exception in getPartition()!" + " key: " + ByteUtils.toHexString(key) + ", value: " + ByteUtils.toHexString(value) + ", numReduceTasks: " + numReduceTasks, e); } } }
public class class_name { public int getPartition(byte[] key, byte[] value, int numReduceTasks) { try { /** * {@link partitionId} is the Voldemort primary partition that this * record belongs to. */ int partitionId = ByteUtils.readInt(value, ByteUtils.SIZE_OF_INT); /** * This is the base number we will ultimately mod by {@link numReduceTasks} * to determine which reduce task to shuffle to. */ int magicNumber = partitionId; if (getSaveKeys() && !buildPrimaryReplicasOnly) { /** * When saveKeys is enabled (which also implies we are generating * READ_ONLY_V2 format files), then we are generating files with * a replica type, with one file per replica. * * Each replica is sent to a different reducer, and thus the * {@link magicNumber} is scaled accordingly. * * The downside to this is that it is pretty wasteful. The files * generated for each replicas are identical to one another, so * there's no point in generating them independently in many * reducers. * * This is one of the reasons why buildPrimaryReplicasOnly was * written. In this mode, we only generate the files for the * primary replica, which means the number of reducers is * minimized and {@link magicNumber} does not need to be scaled. */ int replicaType = (int) ByteUtils.readBytes(value, 2 * ByteUtils.SIZE_OF_INT, ByteUtils.SIZE_OF_BYTE); magicNumber = magicNumber * getStoreDef().getReplicationFactor() + replicaType; // depends on control dependency: [if], data = [none] } if (!getReducerPerBucket()) { /** * Partition files can be split in many chunks in order to limit the * maximum file size downloaded and handled by Voldemort servers. * * {@link chunkId} represents which chunk of partition then current * record belongs to. */ int chunkId = ReadOnlyUtils.chunk(key, getNumChunks()); /** * When reducerPerBucket is disabled, all chunks are sent to a * different reducer. This increases parallelism at the expense * of adding more load on Hadoop. * * {@link magicNumber} is thus scaled accordingly, in order to * leverage the extra reducers available to us. */ magicNumber = magicNumber * getNumChunks() + chunkId; // depends on control dependency: [if], data = [none] } /** * Finally, we mod {@link magicNumber} by {@link numReduceTasks}, * since the MapReduce framework expects the return of this function * to be bounded by the number of reduce tasks running in the job. */ return magicNumber % numReduceTasks; // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new VoldemortException("Caught exception in getPartition()!" + " key: " + ByteUtils.toHexString(key) + ", value: " + ByteUtils.toHexString(value) + ", numReduceTasks: " + numReduceTasks, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public EClass getIfcSphericalSurface() { if (ifcSphericalSurfaceEClass == null) { ifcSphericalSurfaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(621); } return ifcSphericalSurfaceEClass; } }
public class class_name { @Override public EClass getIfcSphericalSurface() { if (ifcSphericalSurfaceEClass == null) { ifcSphericalSurfaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(621); // depends on control dependency: [if], data = [none] } return ifcSphericalSurfaceEClass; } }
public class class_name { protected static String makeComponentPrefix(String tokenName, String className) { String simpleClassName = className; if (null != className) { int lastDotIdx = className.lastIndexOf("."); if (lastDotIdx > -1) { simpleClassName = className.substring(lastDotIdx + 1, className.length()); } } return tokenName + "." + simpleClassName + "."; } }
public class class_name { protected static String makeComponentPrefix(String tokenName, String className) { String simpleClassName = className; if (null != className) { int lastDotIdx = className.lastIndexOf("."); if (lastDotIdx > -1) { simpleClassName = className.substring(lastDotIdx + 1, className.length()); // depends on control dependency: [if], data = [(lastDotIdx] } } return tokenName + "." + simpleClassName + "."; } }
public class class_name { public void clearFocus() { if (searchView != null) { searchView.clearFocus(); } else if (supportView != null) { supportView.clearFocus(); } else { throw new IllegalStateException(ERROR_NO_SEARCHVIEW); } } }
public class class_name { public void clearFocus() { if (searchView != null) { searchView.clearFocus(); // depends on control dependency: [if], data = [none] } else if (supportView != null) { supportView.clearFocus(); // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException(ERROR_NO_SEARCHVIEW); } } }
public class class_name { public DescribeDBInstancesResult withDBInstances(DBInstance... dBInstances) { if (this.dBInstances == null) { setDBInstances(new java.util.ArrayList<DBInstance>(dBInstances.length)); } for (DBInstance ele : dBInstances) { this.dBInstances.add(ele); } return this; } }
public class class_name { public DescribeDBInstancesResult withDBInstances(DBInstance... dBInstances) { if (this.dBInstances == null) { setDBInstances(new java.util.ArrayList<DBInstance>(dBInstances.length)); // depends on control dependency: [if], data = [none] } for (DBInstance ele : dBInstances) { this.dBInstances.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public List<T> toSortedList() { List<T> sortedItems = Lists.newArrayList(); while (size() > 0) { sortedItems.add(removeMin()); } Collections.reverse(sortedItems); return sortedItems; } }
public class class_name { public List<T> toSortedList() { List<T> sortedItems = Lists.newArrayList(); while (size() > 0) { sortedItems.add(removeMin()); // depends on control dependency: [while], data = [none] } Collections.reverse(sortedItems); return sortedItems; } }
public class class_name { public List<Entry> getSortedChildren() { List<Entry> children = new ArrayList<Entry>(); log.debug("children: " + children.size()); HttpClient client = new HttpClient(); GetMethod get = null; try { log.debug("getting url " + url); get = new GetMethod(url); int rc = client.executeMethod(get); if (rc != HttpStatus.SC_OK) { log.error("HttpStatus:" + rc); } DocumentBuilderFactory domBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder = domBuilderFactory.newDocumentBuilder(); InputStream in = get.getResponseBodyAsStream(); builder = domBuilderFactory.newDocumentBuilder(); Document doc = builder.parse(in); get.releaseConnection(); Element e = (Element) doc.getElementsByTagName("rdf:RDF").item(0); log.debug("got root " + e); NodeList n = e.getElementsByTagName("item"); log.debug("found items " + n.getLength()); for (int i = 0; i < n.getLength(); i++) { Bookmark bookmark = new Bookmark(); Element l = (Element) n.item(i); bookmark.setName(((Element) l.getElementsByTagName("title").item(0)).getTextContent()); bookmark.setUrl(((Element) l.getElementsByTagName("link").item(0)).getTextContent()); if (l.getElementsByTagName("description").getLength() > 0) { bookmark.setNote(((Element) l.getElementsByTagName("description").item(0)).getTextContent()); } children.add(bookmark); log.debug("added bookmark " + bookmark.getName() + " " + bookmark.getUrl()); } } catch (HttpException e) { log.error("Error parsing delicious", e); } catch (IOException e) { log.error("Error parsing delicious", e); } catch (ParserConfigurationException e) { log.error("Error parsing delicious", e); } catch (SAXException e) { log.error("Error parsing delicious", e); } finally { if (get != null) get.releaseConnection(); } log.debug("children: " + children.size()); return children; } }
public class class_name { public List<Entry> getSortedChildren() { List<Entry> children = new ArrayList<Entry>(); log.debug("children: " + children.size()); HttpClient client = new HttpClient(); GetMethod get = null; try { log.debug("getting url " + url); // depends on control dependency: [try], data = [none] get = new GetMethod(url); // depends on control dependency: [try], data = [none] int rc = client.executeMethod(get); if (rc != HttpStatus.SC_OK) { log.error("HttpStatus:" + rc); // depends on control dependency: [if], data = [none] } DocumentBuilderFactory domBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder = domBuilderFactory.newDocumentBuilder(); InputStream in = get.getResponseBodyAsStream(); builder = domBuilderFactory.newDocumentBuilder(); // depends on control dependency: [try], data = [none] Document doc = builder.parse(in); get.releaseConnection(); // depends on control dependency: [try], data = [none] Element e = (Element) doc.getElementsByTagName("rdf:RDF").item(0); log.debug("got root " + e); // depends on control dependency: [try], data = [none] NodeList n = e.getElementsByTagName("item"); log.debug("found items " + n.getLength()); // depends on control dependency: [try], data = [none] for (int i = 0; i < n.getLength(); i++) { Bookmark bookmark = new Bookmark(); Element l = (Element) n.item(i); bookmark.setName(((Element) l.getElementsByTagName("title").item(0)).getTextContent()); // depends on control dependency: [for], data = [none] bookmark.setUrl(((Element) l.getElementsByTagName("link").item(0)).getTextContent()); // depends on control dependency: [for], data = [none] if (l.getElementsByTagName("description").getLength() > 0) { bookmark.setNote(((Element) l.getElementsByTagName("description").item(0)).getTextContent()); // depends on control dependency: [if], data = [0)] } children.add(bookmark); // depends on control dependency: [for], data = [none] log.debug("added bookmark " + bookmark.getName() + " " + bookmark.getUrl()); // depends on control dependency: [for], data = [none] } } catch (HttpException e) { log.error("Error parsing delicious", e); } catch (IOException e) { // depends on control dependency: [catch], data = [none] log.error("Error parsing delicious", e); } catch (ParserConfigurationException e) { // depends on control dependency: [catch], data = [none] log.error("Error parsing delicious", e); } catch (SAXException e) { // depends on control dependency: [catch], data = [none] log.error("Error parsing delicious", e); } finally { // depends on control dependency: [catch], data = [none] if (get != null) get.releaseConnection(); } log.debug("children: " + children.size()); return children; } }
public class class_name { public static List<String> toLines(final String string) throws IOException { if (null == string) { return null; } final List<String> ret = new ArrayList<>(); try (final BufferedReader bufferedReader = new BufferedReader(new StringReader(string))) { String line = bufferedReader.readLine(); while (null != line) { ret.add(line); line = bufferedReader.readLine(); } } return ret; } }
public class class_name { public static List<String> toLines(final String string) throws IOException { if (null == string) { return null; } final List<String> ret = new ArrayList<>(); try (final BufferedReader bufferedReader = new BufferedReader(new StringReader(string))) { String line = bufferedReader.readLine(); while (null != line) { ret.add(line); // depends on control dependency: [while], data = [line)] line = bufferedReader.readLine(); // depends on control dependency: [while], data = [none] } } return ret; } }
public class class_name { protected void removeLock(String nodeIdentifier) { try { NodeData nData = (NodeData)dataManager.getItemData(nodeIdentifier); //Skip removing, because that node was removed in other node of cluster. if (nData == null) { return; } PlainChangesLog changesLog = new PlainChangesLogImpl(new ArrayList<ItemState>(), IdentityConstants.SYSTEM, ExtendedEvent.UNLOCK); ItemData lockOwner = copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1), ItemType.PROPERTY)); //Skip removing, because that lock was removed in other node of cluster. if (lockOwner == null) { return; } changesLog.add(ItemState.createDeletedState(lockOwner)); ItemData lockIsDeep = copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1), ItemType.PROPERTY)); //Skip removing, because that lock was removed in other node of cluster. if (lockIsDeep == null) { return; } changesLog.add(ItemState.createDeletedState(lockIsDeep)); // lock probably removed by other thread if (lockOwner == null && lockIsDeep == null) { return; } dataManager.save(new TransactionChangesLog(changesLog)); } catch (JCRInvalidItemStateException e) { //Skip property not found in DB, because that lock property was removed in other node of cluster. if (LOG.isDebugEnabled()) { LOG.debug("The propperty was removed in other node of cluster.", e); } } catch (RepositoryException e) { LOG.error("Error occur during removing lock" + e.getLocalizedMessage(), e); } } }
public class class_name { protected void removeLock(String nodeIdentifier) { try { NodeData nData = (NodeData)dataManager.getItemData(nodeIdentifier); //Skip removing, because that node was removed in other node of cluster. if (nData == null) { return; // depends on control dependency: [if], data = [none] } PlainChangesLog changesLog = new PlainChangesLogImpl(new ArrayList<ItemState>(), IdentityConstants.SYSTEM, ExtendedEvent.UNLOCK); ItemData lockOwner = copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKOWNER, 1), ItemType.PROPERTY)); //Skip removing, because that lock was removed in other node of cluster. if (lockOwner == null) { return; // depends on control dependency: [if], data = [none] } changesLog.add(ItemState.createDeletedState(lockOwner)); // depends on control dependency: [try], data = [none] ItemData lockIsDeep = copyItemData((PropertyData)dataManager.getItemData(nData, new QPathEntry(Constants.JCR_LOCKISDEEP, 1), ItemType.PROPERTY)); //Skip removing, because that lock was removed in other node of cluster. if (lockIsDeep == null) { return; // depends on control dependency: [if], data = [none] } changesLog.add(ItemState.createDeletedState(lockIsDeep)); // depends on control dependency: [try], data = [none] // lock probably removed by other thread if (lockOwner == null && lockIsDeep == null) { return; // depends on control dependency: [if], data = [none] } dataManager.save(new TransactionChangesLog(changesLog)); // depends on control dependency: [try], data = [none] } catch (JCRInvalidItemStateException e) { //Skip property not found in DB, because that lock property was removed in other node of cluster. if (LOG.isDebugEnabled()) { LOG.debug("The propperty was removed in other node of cluster.", e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] catch (RepositoryException e) { LOG.error("Error occur during removing lock" + e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private CompletionStage<Void> emitMembershipUpdateEvent() { final IRI membershipResource = parent.getMembershipResource().map(MutatingLdpHandler::removeHashFragment) .orElse(null); if (membershipResource != null) { return allOf(getServices().getResourceService().touch(membershipResource).toCompletableFuture(), getServices().getResourceService().get(membershipResource).thenAccept(res -> { if (res.getIdentifier() != null) { getServices().getEventService().emit(new SimpleEvent(getUrl(res.getIdentifier()), getSession().getAgent(), asList(PROV.Activity, AS.Update), asList(res.getInteractionModel()))); } }).toCompletableFuture()); } return completedFuture(null); } }
public class class_name { private CompletionStage<Void> emitMembershipUpdateEvent() { final IRI membershipResource = parent.getMembershipResource().map(MutatingLdpHandler::removeHashFragment) .orElse(null); if (membershipResource != null) { return allOf(getServices().getResourceService().touch(membershipResource).toCompletableFuture(), getServices().getResourceService().get(membershipResource).thenAccept(res -> { if (res.getIdentifier() != null) { getServices().getEventService().emit(new SimpleEvent(getUrl(res.getIdentifier()), getSession().getAgent(), asList(PROV.Activity, AS.Update), asList(res.getInteractionModel()))); } }).toCompletableFuture()); // depends on control dependency: [if], data = [none] } return completedFuture(null); } }
public class class_name { public UserDetail withAttachedManagedPolicies(AttachedPolicy... attachedManagedPolicies) { if (this.attachedManagedPolicies == null) { setAttachedManagedPolicies(new com.amazonaws.internal.SdkInternalList<AttachedPolicy>(attachedManagedPolicies.length)); } for (AttachedPolicy ele : attachedManagedPolicies) { this.attachedManagedPolicies.add(ele); } return this; } }
public class class_name { public UserDetail withAttachedManagedPolicies(AttachedPolicy... attachedManagedPolicies) { if (this.attachedManagedPolicies == null) { setAttachedManagedPolicies(new com.amazonaws.internal.SdkInternalList<AttachedPolicy>(attachedManagedPolicies.length)); // depends on control dependency: [if], data = [none] } for (AttachedPolicy ele : attachedManagedPolicies) { this.attachedManagedPolicies.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public EEnum getOBPYocaOrent() { if (obpYocaOrentEEnum == null) { obpYocaOrentEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(57); } return obpYocaOrentEEnum; } }
public class class_name { public EEnum getOBPYocaOrent() { if (obpYocaOrentEEnum == null) { obpYocaOrentEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(57); // depends on control dependency: [if], data = [none] } return obpYocaOrentEEnum; } }
public class class_name { private void gatherEvidence(Dependency dependency, final String name, String contents) { final Matcher matcher = AC_INIT_PATTERN.matcher(contents); if (matcher.find()) { dependency.addEvidence(EvidenceType.PRODUCT, name, "Package", matcher.group(1), Confidence.HIGHEST); dependency.addEvidence(EvidenceType.VERSION, name, "Package Version", matcher.group(2), Confidence.HIGHEST); if (null != matcher.group(3)) { dependency.addEvidence(EvidenceType.VENDOR, name, "Bug report address", matcher.group(4), Confidence.HIGH); } if (null != matcher.group(5)) { dependency.addEvidence(EvidenceType.PRODUCT, name, "Tarname", matcher.group(6), Confidence.HIGH); } if (null != matcher.group(7)) { final String url = matcher.group(8); if (UrlStringUtils.isUrl(url)) { dependency.addEvidence(EvidenceType.VENDOR, name, "URL", url, Confidence.HIGH); } } } } }
public class class_name { private void gatherEvidence(Dependency dependency, final String name, String contents) { final Matcher matcher = AC_INIT_PATTERN.matcher(contents); if (matcher.find()) { dependency.addEvidence(EvidenceType.PRODUCT, name, "Package", matcher.group(1), Confidence.HIGHEST); // depends on control dependency: [if], data = [none] dependency.addEvidence(EvidenceType.VERSION, name, "Package Version", matcher.group(2), Confidence.HIGHEST); // depends on control dependency: [if], data = [none] if (null != matcher.group(3)) { dependency.addEvidence(EvidenceType.VENDOR, name, "Bug report address", matcher.group(4), Confidence.HIGH); // depends on control dependency: [if], data = [none] } if (null != matcher.group(5)) { dependency.addEvidence(EvidenceType.PRODUCT, name, "Tarname", matcher.group(6), Confidence.HIGH); // depends on control dependency: [if], data = [none] } if (null != matcher.group(7)) { final String url = matcher.group(8); if (UrlStringUtils.isUrl(url)) { dependency.addEvidence(EvidenceType.VENDOR, name, "URL", url, Confidence.HIGH); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private void ensureReferentialIntegrity( ObjectNode jsonObject, String namespace, Table table, Integer id ) throws SQLException { final boolean isCreating = id == null; String keyField = table.getKeyFieldName(); String tableName = String.join(".", namespace, table.name); if (jsonObject.get(keyField) == null || jsonObject.get(keyField).isNull()) { // FIXME: generate key field automatically for certain entities (e.g., trip ID). Maybe this should be // generated for all entities if null? if ("trip_id".equals(keyField)) { jsonObject.put(keyField, UUID.randomUUID().toString()); } else if ("agency_id".equals(keyField)) { LOG.warn("agency_id field for agency id={} is null.", id); int rowSize = getRowCount(tableName, connection); if (rowSize > 1 || (isCreating && rowSize > 0)) { throw new SQLException("agency_id must not be null if more than one agency exists."); } } else { throw new SQLException(String.format("Key field %s must not be null", keyField)); } } String keyValue = jsonObject.get(keyField).asText(); // If updating key field, check that there is no ID conflict on value (e.g., stop_id or route_id) TIntSet uniqueIds = getIdsForCondition(tableName, keyField, keyValue, connection); int size = uniqueIds.size(); if (size == 0 || (size == 1 && id != null && uniqueIds.contains(id))) { // OK. if (size == 0 && !isCreating) { // FIXME: Need to update referencing tables because entity has changed ID. // Entity key value is being changed to an entirely new one. If there are entities that // reference this value, we need to update them. updateReferencingTables(namespace, table, id, keyValue); } } else { // Conflict. The different conflict conditions are outlined below. if (size == 1) { // There was one match found. if (isCreating) { // Under no circumstance should a new entity have a conflict with existing key field. throw new SQLException( String.format("New %s's %s value (%s) conflicts with an existing record in table.", table.entityClass.getSimpleName(), keyField, keyValue) ); } if (!uniqueIds.contains(id)) { // There are two circumstances we could encounter here. // 1. The key value for this entity has been updated to match some other entity's key value (conflict). // 2. The int ID provided in the request parameter does not match any rows in the table. throw new SQLException("Key field must be unique and request parameter ID must exist."); } } else if (size > 1) { // FIXME: Handle edge case where original data set contains duplicate values for key field and this is an // attempt to rectify bad data. String message = String.format( "%d %s entities shares the same key field (%s=%s)! Key field must be unique.", size, table.name, keyField, keyValue); LOG.error(message); throw new SQLException(message); } } } }
public class class_name { private void ensureReferentialIntegrity( ObjectNode jsonObject, String namespace, Table table, Integer id ) throws SQLException { final boolean isCreating = id == null; String keyField = table.getKeyFieldName(); String tableName = String.join(".", namespace, table.name); if (jsonObject.get(keyField) == null || jsonObject.get(keyField).isNull()) { // FIXME: generate key field automatically for certain entities (e.g., trip ID). Maybe this should be // generated for all entities if null? if ("trip_id".equals(keyField)) { jsonObject.put(keyField, UUID.randomUUID().toString()); // depends on control dependency: [if], data = [none] } else if ("agency_id".equals(keyField)) { LOG.warn("agency_id field for agency id={} is null.", id); // depends on control dependency: [if], data = [none] int rowSize = getRowCount(tableName, connection); if (rowSize > 1 || (isCreating && rowSize > 0)) { throw new SQLException("agency_id must not be null if more than one agency exists."); } } else { throw new SQLException(String.format("Key field %s must not be null", keyField)); } } String keyValue = jsonObject.get(keyField).asText(); // If updating key field, check that there is no ID conflict on value (e.g., stop_id or route_id) TIntSet uniqueIds = getIdsForCondition(tableName, keyField, keyValue, connection); int size = uniqueIds.size(); if (size == 0 || (size == 1 && id != null && uniqueIds.contains(id))) { // OK. if (size == 0 && !isCreating) { // FIXME: Need to update referencing tables because entity has changed ID. // Entity key value is being changed to an entirely new one. If there are entities that // reference this value, we need to update them. updateReferencingTables(namespace, table, id, keyValue); // depends on control dependency: [if], data = [none] } } else { // Conflict. The different conflict conditions are outlined below. if (size == 1) { // There was one match found. if (isCreating) { // Under no circumstance should a new entity have a conflict with existing key field. throw new SQLException( String.format("New %s's %s value (%s) conflicts with an existing record in table.", table.entityClass.getSimpleName(), keyField, keyValue) ); } if (!uniqueIds.contains(id)) { // There are two circumstances we could encounter here. // 1. The key value for this entity has been updated to match some other entity's key value (conflict). // 2. The int ID provided in the request parameter does not match any rows in the table. throw new SQLException("Key field must be unique and request parameter ID must exist."); } } else if (size > 1) { // FIXME: Handle edge case where original data set contains duplicate values for key field and this is an // attempt to rectify bad data. String message = String.format( "%d %s entities shares the same key field (%s=%s)! Key field must be unique.", // depends on control dependency: [if], data = [none] size, table.name, keyField, keyValue); LOG.error(message); // depends on control dependency: [if], data = [none] throw new SQLException(message); } } } }
public class class_name { public void marshall(DescribeWebsiteCertificateAuthorityRequest describeWebsiteCertificateAuthorityRequest, ProtocolMarshaller protocolMarshaller) { if (describeWebsiteCertificateAuthorityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeWebsiteCertificateAuthorityRequest.getFleetArn(), FLEETARN_BINDING); protocolMarshaller.marshall(describeWebsiteCertificateAuthorityRequest.getWebsiteCaId(), WEBSITECAID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeWebsiteCertificateAuthorityRequest describeWebsiteCertificateAuthorityRequest, ProtocolMarshaller protocolMarshaller) { if (describeWebsiteCertificateAuthorityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeWebsiteCertificateAuthorityRequest.getFleetArn(), FLEETARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(describeWebsiteCertificateAuthorityRequest.getWebsiteCaId(), WEBSITECAID_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 @NotNull ObjectArrayAssert hasAllElementsOfType(@NotNull Class<?> type) { checkNotNull(type); isNotNull(); for (Object o : actual) { if (type.isInstance(o)) { continue; } failIfCustomMessageIsSet(); fail(format("not all elements in array:<%s> belong to the type:<%s>", actual, type)); } return this; } }
public class class_name { public @NotNull ObjectArrayAssert hasAllElementsOfType(@NotNull Class<?> type) { checkNotNull(type); isNotNull(); for (Object o : actual) { if (type.isInstance(o)) { continue; } failIfCustomMessageIsSet(); // depends on control dependency: [for], data = [o] fail(format("not all elements in array:<%s> belong to the type:<%s>", actual, type)); // depends on control dependency: [for], data = [o] } return this; } }
public class class_name { public static String replaceAllSpecialChracters(String toBeReplaced) { toBeReplaced = toBeReplaced.replaceAll("&", "&amp;"); toBeReplaced = toBeReplaced.replaceAll("<", "&lt;"); toBeReplaced = toBeReplaced.replaceAll(">", "&gt;"); toBeReplaced = toBeReplaced.replaceAll("\"", "&quot;"); toBeReplaced = toBeReplaced.replaceAll("'", "&apos;"); // toBeReplaced = toBeReplaced.replace("^", "&circ"); // toBeReplaced = toBeReplaced.replaceAll("0xb", ""); int len = toBeReplaced.length(); char[] temp = toBeReplaced.toCharArray(); for (int i = 0; i < len; i++) { char xCode = temp[i]; if ((xCode > '\u0000' && xCode <= '\u0020') || (xCode == '\u0026') || (xCode == '\u0022') || (xCode == '\u02C6') || (xCode == '\u201C') || (xCode == '\u201D') || (xCode == '\u201E')) { String sub1 = toBeReplaced.substring(0, i); String sub2 = toBeReplaced.substring(i + 1, len); String replacement = ""; if ((xCode > '\u0000' && xCode <= '\u0020')) replacement = " "; if (xCode == '\u0026') replacement = " "; if (xCode == '\u0022') replacement = " "; if (xCode == '\u02C6') replacement = " "; if (xCode == '\u201C') replacement = " "; if (xCode == '\u201D') replacement = " "; if (xCode == '\u201E') replacement = " "; toBeReplaced = sub1 + replacement + sub2; } len = toBeReplaced.length(); temp = toBeReplaced.toCharArray(); } return (toBeReplaced); } }
public class class_name { public static String replaceAllSpecialChracters(String toBeReplaced) { toBeReplaced = toBeReplaced.replaceAll("&", "&amp;"); toBeReplaced = toBeReplaced.replaceAll("<", "&lt;"); toBeReplaced = toBeReplaced.replaceAll(">", "&gt;"); toBeReplaced = toBeReplaced.replaceAll("\"", "&quot;"); toBeReplaced = toBeReplaced.replaceAll("'", "&apos;"); // toBeReplaced = toBeReplaced.replace("^", "&circ"); // toBeReplaced = toBeReplaced.replaceAll("0xb", ""); int len = toBeReplaced.length(); char[] temp = toBeReplaced.toCharArray(); for (int i = 0; i < len; i++) { char xCode = temp[i]; if ((xCode > '\u0000' && xCode <= '\u0020') || (xCode == '\u0026') || (xCode == '\u0022') || (xCode == '\u02C6') || (xCode == '\u201C') || (xCode == '\u201D') || (xCode == '\u201E')) { String sub1 = toBeReplaced.substring(0, i); String sub2 = toBeReplaced.substring(i + 1, len); String replacement = ""; if ((xCode > '\u0000' && xCode <= '\u0020')) replacement = " "; if (xCode == '\u0026') replacement = " "; if (xCode == '\u0022') replacement = " "; if (xCode == '\u02C6') replacement = " "; if (xCode == '\u201C') replacement = " "; if (xCode == '\u201D') replacement = " "; if (xCode == '\u201E') replacement = " "; toBeReplaced = sub1 + replacement + sub2; } len = toBeReplaced.length(); // depends on control dependency: [for], data = [none] temp = toBeReplaced.toCharArray(); // depends on control dependency: [for], data = [none] } return (toBeReplaced); } }
public class class_name { private synchronized void checkIfConfigurationNeeded(ConfigurationAdmin service) { try { if (factory) { if (factoryConfiguration == null) { factoryConfiguration = service.createFactoryConfiguration(pid, null); factoryConfiguration.update(new Hashtable<String, Object>(properties)); LOG.info( "Created new factory configuration for factory-pid {}, generated pid is {} with properties: {}", new Object[] { pid, factoryConfiguration.getPid(), properties }); } } else { Configuration configuration = service.getConfiguration(pid, null); Dictionary<String, Object> dictionary = configuration.getProperties(); if (dictionary != null) { boolean update = false; Set<Entry<String, Object>> entrySet = properties.entrySet(); for (Entry<String, Object> entry : entrySet) { Object object = dictionary.get(entry.getKey()); if (object == null) { if (entry.getValue() == null) { // Not changed... continue; } } else { if (object.equals(entry.getValue())) { // Not changed... continue; } } // A change is detected... update = true; dictionary.put(entry.getKey(), entry.getValue()); } if (update) { LOG.info("Update existing configuration for pid {} with properties: {}", pid, dictToString(dictionary)); configuration.update(dictionary); } } else { if (create) { configuration.update(new Hashtable<String, Object>(properties)); LOG.info("Created new configuration for pid {} with properties: {}", pid, properties); } } } } catch (IOException e) { LOG.warn("can't modify configuration for PID {}", pid, e); } } }
public class class_name { private synchronized void checkIfConfigurationNeeded(ConfigurationAdmin service) { try { if (factory) { if (factoryConfiguration == null) { factoryConfiguration = service.createFactoryConfiguration(pid, null); // depends on control dependency: [if], data = [null)] factoryConfiguration.update(new Hashtable<String, Object>(properties)); // depends on control dependency: [if], data = [none] LOG.info( "Created new factory configuration for factory-pid {}, generated pid is {} with properties: {}", new Object[] { pid, factoryConfiguration.getPid(), properties }); // depends on control dependency: [if], data = [none] } } else { Configuration configuration = service.getConfiguration(pid, null); Dictionary<String, Object> dictionary = configuration.getProperties(); if (dictionary != null) { boolean update = false; Set<Entry<String, Object>> entrySet = properties.entrySet(); for (Entry<String, Object> entry : entrySet) { Object object = dictionary.get(entry.getKey()); if (object == null) { if (entry.getValue() == null) { // Not changed... continue; } } else { if (object.equals(entry.getValue())) { // Not changed... continue; } } // A change is detected... update = true; // depends on control dependency: [for], data = [none] dictionary.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } if (update) { LOG.info("Update existing configuration for pid {} with properties: {}", pid, dictToString(dictionary)); // depends on control dependency: [if], data = [none] configuration.update(dictionary); // depends on control dependency: [if], data = [none] } } else { if (create) { configuration.update(new Hashtable<String, Object>(properties)); // depends on control dependency: [if], data = [none] LOG.info("Created new configuration for pid {} with properties: {}", pid, properties); // depends on control dependency: [if], data = [none] } } } } catch (IOException e) { LOG.warn("can't modify configuration for PID {}", pid, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public PlanNode findAtOrBelow( Traversal order, Set<Type> typesToFind ) { LinkedList<PlanNode> queue = new LinkedList<PlanNode>(); queue.add(this); while (!queue.isEmpty()) { PlanNode aNode = queue.poll(); switch (order) { case LEVEL_ORDER: if (typesToFind.contains(aNode.getType())) { return aNode; } queue.addAll(aNode.getChildren()); break; case PRE_ORDER: if (typesToFind.contains(aNode.getType())) { return aNode; } queue.addAll(0, aNode.getChildren()); break; case POST_ORDER: queue.addAll(0, aNode.getChildren()); if (typesToFind.contains(aNode.getType())) { return aNode; } break; } } return null; } }
public class class_name { public PlanNode findAtOrBelow( Traversal order, Set<Type> typesToFind ) { LinkedList<PlanNode> queue = new LinkedList<PlanNode>(); queue.add(this); while (!queue.isEmpty()) { PlanNode aNode = queue.poll(); switch (order) { case LEVEL_ORDER: if (typesToFind.contains(aNode.getType())) { return aNode; // depends on control dependency: [if], data = [none] } queue.addAll(aNode.getChildren()); break; case PRE_ORDER: if (typesToFind.contains(aNode.getType())) { return aNode; // depends on control dependency: [if], data = [none] } queue.addAll(0, aNode.getChildren()); break; case POST_ORDER: queue.addAll(0, aNode.getChildren()); if (typesToFind.contains(aNode.getType())) { return aNode; // depends on control dependency: [if], data = [none] } break; } } return null; } }
public class class_name { @Override public boolean match(Term term) { // XXX the checks here essentially reproduce the // semantics of the reaction function FunctionEnum fx = term.getFunctionEnum(); if (fx != REACTION) { // Reaction functions only return false; } List<BELObject> args = term.getFunctionArguments(); if (noItems(args) || args.size() != 2) { // Two function arguments only return false; } BELObject x = args.get(0); if (!(x instanceof Term)) { // First argument must be a term return false; } BELObject y = args.get(1); if (!(y instanceof Term)) { // Second argument must be a term return false; } Term xtrm = (Term) x; if (xtrm.getFunctionEnum() != REACTANTS) { // First argument must be a reactants function return false; } Term ytrm = (Term) y; if (ytrm.getFunctionEnum() != PRODUCTS) { // Second argument must be a products function return false; } List<BELObject> xtrmArgs = xtrm.getFunctionArguments(); if (noItems(xtrmArgs)) { // At least one argument to the reactants function is necessary return false; } List<BELObject> ytrmArgs = ytrm.getFunctionArguments(); if (noItems(ytrmArgs)) { // At least one argument to the products function is necessary return false; } for (final BELObject o : xtrmArgs) { // All arguments must be terms if (!(o instanceof Term)) { return false; } } for (final BELObject o : ytrmArgs) { // All arguments must be terms if (!(o instanceof Term)) { return false; } } return true; } }
public class class_name { @Override public boolean match(Term term) { // XXX the checks here essentially reproduce the // semantics of the reaction function FunctionEnum fx = term.getFunctionEnum(); if (fx != REACTION) { // Reaction functions only return false; // depends on control dependency: [if], data = [none] } List<BELObject> args = term.getFunctionArguments(); if (noItems(args) || args.size() != 2) { // Two function arguments only return false; // depends on control dependency: [if], data = [none] } BELObject x = args.get(0); if (!(x instanceof Term)) { // First argument must be a term return false; // depends on control dependency: [if], data = [none] } BELObject y = args.get(1); if (!(y instanceof Term)) { // Second argument must be a term return false; // depends on control dependency: [if], data = [none] } Term xtrm = (Term) x; if (xtrm.getFunctionEnum() != REACTANTS) { // First argument must be a reactants function return false; // depends on control dependency: [if], data = [none] } Term ytrm = (Term) y; if (ytrm.getFunctionEnum() != PRODUCTS) { // Second argument must be a products function return false; // depends on control dependency: [if], data = [none] } List<BELObject> xtrmArgs = xtrm.getFunctionArguments(); if (noItems(xtrmArgs)) { // At least one argument to the reactants function is necessary return false; // depends on control dependency: [if], data = [none] } List<BELObject> ytrmArgs = ytrm.getFunctionArguments(); if (noItems(ytrmArgs)) { // At least one argument to the products function is necessary return false; // depends on control dependency: [if], data = [none] } for (final BELObject o : xtrmArgs) { // All arguments must be terms if (!(o instanceof Term)) { return false; // depends on control dependency: [if], data = [none] } } for (final BELObject o : ytrmArgs) { // All arguments must be terms if (!(o instanceof Term)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private void initialize() { this.setVisible(false); this.setIconImages(DisplayUtils.getZapIconImages()); this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) { this.setSize(300,200); } this.setTitle(Constant.PROGRAM_NAME); // Handle escape key to close the dialog KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false); AbstractAction escapeAction = new AbstractAction() { private static final long serialVersionUID = 3516424501887406165L; @Override public void actionPerformed(ActionEvent e) { dispatchEvent(new WindowEvent(AbstractDialog.this, WindowEvent.WINDOW_CLOSING)); } }; getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE"); getRootPane().getActionMap().put("ESCAPE",escapeAction); } }
public class class_name { private void initialize() { this.setVisible(false); this.setIconImages(DisplayUtils.getZapIconImages()); this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) { this.setSize(300,200); // depends on control dependency: [if], data = [0)] } this.setTitle(Constant.PROGRAM_NAME); // Handle escape key to close the dialog KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false); AbstractAction escapeAction = new AbstractAction() { private static final long serialVersionUID = 3516424501887406165L; @Override public void actionPerformed(ActionEvent e) { dispatchEvent(new WindowEvent(AbstractDialog.this, WindowEvent.WINDOW_CLOSING)); } }; getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE"); getRootPane().getActionMap().put("ESCAPE",escapeAction); } }
public class class_name { private void insertSessionRepositoryFilter(ServletContext servletContext) { String filterName = DEFAULT_FILTER_NAME; DelegatingFilterProxy springSessionRepositoryFilter = new DelegatingFilterProxy( filterName); String contextAttribute = getWebApplicationContextAttribute(); if (contextAttribute != null) { springSessionRepositoryFilter.setContextAttribute(contextAttribute); } registerFilter(servletContext, true, filterName, springSessionRepositoryFilter); } }
public class class_name { private void insertSessionRepositoryFilter(ServletContext servletContext) { String filterName = DEFAULT_FILTER_NAME; DelegatingFilterProxy springSessionRepositoryFilter = new DelegatingFilterProxy( filterName); String contextAttribute = getWebApplicationContextAttribute(); if (contextAttribute != null) { springSessionRepositoryFilter.setContextAttribute(contextAttribute); // depends on control dependency: [if], data = [(contextAttribute] } registerFilter(servletContext, true, filterName, springSessionRepositoryFilter); } }
public class class_name { public static boolean packageResults() { String packageResults = getProgramProperty(PACKAGE_RESULTS); if (packageResults == null) { return false; } if ("".equals(packageResults)) { return true; } return "true".equalsIgnoreCase(packageResults); } }
public class class_name { public static boolean packageResults() { String packageResults = getProgramProperty(PACKAGE_RESULTS); if (packageResults == null) { return false; // depends on control dependency: [if], data = [none] } if ("".equals(packageResults)) { return true; // depends on control dependency: [if], data = [none] } return "true".equalsIgnoreCase(packageResults); } }
public class class_name { int getColumnByXWithShift(int x, int shiftEveryStep) { checkForInit(); int sum = 0; // header offset int tempX = x - mHeaderRowWidth; if (tempX <= sum) { return 0; } for (int count = mColumnWidths.length, i = 0; i < count; i++) { int nextSum = sum + mColumnWidths[i] + shiftEveryStep; if (tempX > sum && tempX < nextSum) { return i; } else if (tempX < nextSum) { return i - 1; } sum = nextSum; } return mColumnWidths.length - 1; } }
public class class_name { int getColumnByXWithShift(int x, int shiftEveryStep) { checkForInit(); int sum = 0; // header offset int tempX = x - mHeaderRowWidth; if (tempX <= sum) { return 0; // depends on control dependency: [if], data = [none] } for (int count = mColumnWidths.length, i = 0; i < count; i++) { int nextSum = sum + mColumnWidths[i] + shiftEveryStep; if (tempX > sum && tempX < nextSum) { return i; // depends on control dependency: [if], data = [none] } else if (tempX < nextSum) { return i - 1; // depends on control dependency: [if], data = [none] } sum = nextSum; // depends on control dependency: [for], data = [none] } return mColumnWidths.length - 1; } }
public class class_name { public static <T> T executeScriptEngine(final String scriptFile, final Object[] args, final Class<T> clazz) { try { val engineName = getScriptEngineName(scriptFile); val engine = new ScriptEngineManager().getEngineByName(engineName); if (engine == null || StringUtils.isBlank(engineName)) { LOGGER.warn("Script engine is not available for [{}]", engineName); return null; } val resourceFrom = ResourceUtils.getResourceFrom(scriptFile); val theScriptFile = resourceFrom.getFile(); if (theScriptFile.exists()) { LOGGER.debug("Created object instance from class [{}]", theScriptFile.getCanonicalPath()); try (val reader = Files.newBufferedReader(theScriptFile.toPath(), StandardCharsets.UTF_8)) { engine.eval(reader); } val invocable = (Invocable) engine; LOGGER.debug("Executing script's run method, with parameters [{}]", args); val result = invocable.invokeFunction("run", args); LOGGER.debug("Groovy script result is [{}]", result); return getGroovyScriptExecutionResultOrThrow(clazz, result); } LOGGER.warn("[{}] script [{}] does not exist, or cannot be loaded", StringUtils.capitalize(engineName), scriptFile); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; } }
public class class_name { public static <T> T executeScriptEngine(final String scriptFile, final Object[] args, final Class<T> clazz) { try { val engineName = getScriptEngineName(scriptFile); val engine = new ScriptEngineManager().getEngineByName(engineName); if (engine == null || StringUtils.isBlank(engineName)) { LOGGER.warn("Script engine is not available for [{}]", engineName); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } val resourceFrom = ResourceUtils.getResourceFrom(scriptFile); val theScriptFile = resourceFrom.getFile(); if (theScriptFile.exists()) { LOGGER.debug("Created object instance from class [{}]", theScriptFile.getCanonicalPath()); // depends on control dependency: [if], data = [none] try (val reader = Files.newBufferedReader(theScriptFile.toPath(), StandardCharsets.UTF_8)) { engine.eval(reader); } val invocable = (Invocable) engine; LOGGER.debug("Executing script's run method, with parameters [{}]", args); val result = invocable.invokeFunction("run", args); LOGGER.debug("Groovy script result is [{}]", result); return getGroovyScriptExecutionResultOrThrow(clazz, result); // depends on control dependency: [try], data = [none] } LOGGER.warn("[{}] script [{}] does not exist, or cannot be loaded", StringUtils.capitalize(engineName), scriptFile); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public void blur() { String cantFocus = "Unable to focus on "; String action = "Focusing, then unfocusing (blurring) on " + prettyOutput(); String expected = prettyOutputStart() + " is present, displayed, and enabled to be blurred"; try { if (isNotPresentDisplayedEnabledInput(action, expected, cantFocus)) { return; } WebElement webElement = getWebElement(); webElement.sendKeys(Keys.TAB); } catch (Exception e) { log.warn(e); reporter.fail(action, expected, cantFocus + prettyOutputEnd() + e.getMessage()); return; } reporter.pass(action, expected, "Focused, then unfocused (blurred) on " + prettyOutputEnd().trim()); } }
public class class_name { public void blur() { String cantFocus = "Unable to focus on "; String action = "Focusing, then unfocusing (blurring) on " + prettyOutput(); String expected = prettyOutputStart() + " is present, displayed, and enabled to be blurred"; try { if (isNotPresentDisplayedEnabledInput(action, expected, cantFocus)) { return; // depends on control dependency: [if], data = [none] } WebElement webElement = getWebElement(); webElement.sendKeys(Keys.TAB); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn(e); reporter.fail(action, expected, cantFocus + prettyOutputEnd() + e.getMessage()); return; } // depends on control dependency: [catch], data = [none] reporter.pass(action, expected, "Focused, then unfocused (blurred) on " + prettyOutputEnd().trim()); } }
public class class_name { @SuppressWarnings("unchecked") public static <A, B> int compare(Comparable<A> c1, Comparable<B> c2) { if (c1 == c2) // NOSONAR { return 0; } else if (c1 == null) { return -1; } else if (c2 == null) { return 1; } else if (c1.getClass() == c2.getClass()) { return c1.compareTo((A)c2); } else { // differing types -> compare class names String name1 = c1.getClass().getName(); String name2 = c2.getClass().getName(); return name1.compareTo(name2); } } }
public class class_name { @SuppressWarnings("unchecked") public static <A, B> int compare(Comparable<A> c1, Comparable<B> c2) { if (c1 == c2) // NOSONAR { return 0; // depends on control dependency: [if], data = [none] } else if (c1 == null) { return -1; // depends on control dependency: [if], data = [none] } else if (c2 == null) { return 1; // depends on control dependency: [if], data = [none] } else if (c1.getClass() == c2.getClass()) { return c1.compareTo((A)c2); // depends on control dependency: [if], data = [none] } else { // differing types -> compare class names String name1 = c1.getClass().getName(); String name2 = c2.getClass().getName(); return name1.compareTo(name2); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(DisableDomainTransferLockRequest disableDomainTransferLockRequest, ProtocolMarshaller protocolMarshaller) { if (disableDomainTransferLockRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(disableDomainTransferLockRequest.getDomainName(), DOMAINNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DisableDomainTransferLockRequest disableDomainTransferLockRequest, ProtocolMarshaller protocolMarshaller) { if (disableDomainTransferLockRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(disableDomainTransferLockRequest.getDomainName(), DOMAINNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <T,W> List<W> listSecond(List<Pair<T, W>> list) { ArrayList<W> ts = new ArrayList<W>(); for (Pair<T, W> twPair : list) { ts.add(twPair.getSecond()); } return ts; } }
public class class_name { public static <T,W> List<W> listSecond(List<Pair<T, W>> list) { ArrayList<W> ts = new ArrayList<W>(); for (Pair<T, W> twPair : list) { ts.add(twPair.getSecond()); // depends on control dependency: [for], data = [twPair] } return ts; } }
public class class_name { public static long sumFutures(List<Future<Object>> futures) { long total = 0; for (Future<Object> f : futures) { try { total += (Long) f.get(); } catch (Exception ignore) { System.out.println("### sumFutures got exception!"); } } return total; } }
public class class_name { public static long sumFutures(List<Future<Object>> futures) { long total = 0; for (Future<Object> f : futures) { try { total += (Long) f.get(); // depends on control dependency: [try], data = [none] } catch (Exception ignore) { System.out.println("### sumFutures got exception!"); } // depends on control dependency: [catch], data = [none] } return total; } }
public class class_name { public static final short bytesToShort( byte[] data, int[] offset ) { /** * TODO: We use network-order within OceanStore, but temporarily * supporting intel-order to work with some JNI code until JNI code is * set to interoperate with network-order. */ short result = 0; for( int i = 0; i < SIZE_SHORT; ++i ) { result <<= 8; result |= (short) byteToUnsignedInt(data[offset[0]++]); } return result; } }
public class class_name { public static final short bytesToShort( byte[] data, int[] offset ) { /** * TODO: We use network-order within OceanStore, but temporarily * supporting intel-order to work with some JNI code until JNI code is * set to interoperate with network-order. */ short result = 0; for( int i = 0; i < SIZE_SHORT; ++i ) { result <<= 8; // depends on control dependency: [for], data = [none] result |= (short) byteToUnsignedInt(data[offset[0]++]); // depends on control dependency: [for], data = [none] } return result; } }
public class class_name { public void reconcileMQLinks() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "reconcileMQLinks"); // Set reconciling flag to false reconciling = false; LinkTypeFilter filter = new LinkTypeFilter(); filter.MQLINK = Boolean.TRUE; filter.UNRECONCILED = Boolean.TRUE; SIMPIterator itr = linkIndex.iterator(filter); // Get the MQLinkManager MQLinkManager mqlinkManager = getMQLinkManager(); while (itr.hasNext()) { MQLinkHandler dh = (MQLinkHandler) itr.next(); // Retrieve the uuid for the Handler. String mqLinkUuid = dh.getMqLinkUuid().toString(); // Call MQLink Component to alert it to create appropriate resources for // a link that previously existed MQLinkObject mqlinkObj = null; try { mqlinkObj = mqlinkManager.create(messageProcessor.createMQLinkDefinition(mqLinkUuid), (MQLinkLocalization) dh, (ControllableRegistrationService) messageProcessor.getMEInstance(SIMPConstants.JS_MBEAN_FACTORY), true); // We've reconciled and this destination is to be deleted } catch (SIResourceException e) { // No FFDC code needed SibTr.exception(tc, e); } catch (SIException e) { // No FFDC code needed SibTr.exception(tc, e); } // Store mqlinkObj in the handler dh.setMQLinkObject(mqlinkObj); // remove from the list - we won't attempt to delete it until requested // by the MQLink component linkIndex.cleanup(dh); linkIndex.defer(dh); } itr.finished(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "reconcileMQLinks"); } }
public class class_name { public void reconcileMQLinks() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "reconcileMQLinks"); // Set reconciling flag to false reconciling = false; LinkTypeFilter filter = new LinkTypeFilter(); filter.MQLINK = Boolean.TRUE; filter.UNRECONCILED = Boolean.TRUE; SIMPIterator itr = linkIndex.iterator(filter); // Get the MQLinkManager MQLinkManager mqlinkManager = getMQLinkManager(); while (itr.hasNext()) { MQLinkHandler dh = (MQLinkHandler) itr.next(); // Retrieve the uuid for the Handler. String mqLinkUuid = dh.getMqLinkUuid().toString(); // Call MQLink Component to alert it to create appropriate resources for // a link that previously existed MQLinkObject mqlinkObj = null; try { mqlinkObj = mqlinkManager.create(messageProcessor.createMQLinkDefinition(mqLinkUuid), (MQLinkLocalization) dh, (ControllableRegistrationService) messageProcessor.getMEInstance(SIMPConstants.JS_MBEAN_FACTORY), true); // We've reconciled and this destination is to be deleted // depends on control dependency: [try], data = [none] } catch (SIResourceException e) { // No FFDC code needed SibTr.exception(tc, e); } catch (SIException e) // depends on control dependency: [catch], data = [none] { // No FFDC code needed SibTr.exception(tc, e); } // depends on control dependency: [catch], data = [none] // Store mqlinkObj in the handler dh.setMQLinkObject(mqlinkObj); // depends on control dependency: [while], data = [none] // remove from the list - we won't attempt to delete it until requested // by the MQLink component linkIndex.cleanup(dh); // depends on control dependency: [while], data = [none] linkIndex.defer(dh); // depends on control dependency: [while], data = [none] } itr.finished(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "reconcileMQLinks"); } }
public class class_name { public static <T extends ImageGray<T>> StereoDisparity<T,GrayF32> regionSubpixelWta( DisparityAlgorithms whichAlg , int minDisparity , int maxDisparity, int regionRadiusX, int regionRadiusY , double maxPerPixelError , int validateRtoL , double texture , Class<T> imageType ) { double maxError = (regionRadiusX*2+1)*(regionRadiusY*2+1)*maxPerPixelError; // 3 regions are used not just one in this case if( whichAlg == DisparityAlgorithms.RECT_FIVE ) maxError *= 3; DisparitySelect select; if( imageType == GrayU8.class || imageType == GrayS16.class ) { select = selectDisparitySubpixel_S32((int) maxError, validateRtoL, texture); } else if( imageType == GrayF32.class ) { select = selectDisparitySubpixel_F32((int) maxError, validateRtoL, texture); } else { throw new IllegalArgumentException("Unknown image type"); } DisparityScoreRowFormat<T,GrayF32> alg = null; switch( whichAlg ) { case RECT: if( imageType == GrayU8.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRect_U8(minDisparity, maxDisparity,regionRadiusX,regionRadiusY,select); } else if( imageType == GrayS16.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRect_S16(minDisparity, maxDisparity, regionRadiusX, regionRadiusY, select); } else if( imageType == GrayF32.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRect_F32(minDisparity, maxDisparity, regionRadiusX, regionRadiusY, select); } break; case RECT_FIVE: if( imageType == GrayU8.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRectFive_U8(minDisparity, maxDisparity,regionRadiusX,regionRadiusY,select); } else if( imageType == GrayS16.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRectFive_S16(minDisparity, maxDisparity, regionRadiusX, regionRadiusY, select); } else if( imageType == GrayF32.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRectFive_F32(minDisparity, maxDisparity, regionRadiusX, regionRadiusY, select); } break; default: throw new IllegalArgumentException("Unknown algorithms "+whichAlg); } if( alg == null) throw new RuntimeException("Image type not supported: "+imageType.getSimpleName() ); return new WrapDisparitySadRect<>(alg); } }
public class class_name { public static <T extends ImageGray<T>> StereoDisparity<T,GrayF32> regionSubpixelWta( DisparityAlgorithms whichAlg , int minDisparity , int maxDisparity, int regionRadiusX, int regionRadiusY , double maxPerPixelError , int validateRtoL , double texture , Class<T> imageType ) { double maxError = (regionRadiusX*2+1)*(regionRadiusY*2+1)*maxPerPixelError; // 3 regions are used not just one in this case if( whichAlg == DisparityAlgorithms.RECT_FIVE ) maxError *= 3; DisparitySelect select; if( imageType == GrayU8.class || imageType == GrayS16.class ) { select = selectDisparitySubpixel_S32((int) maxError, validateRtoL, texture); // depends on control dependency: [if], data = [none] } else if( imageType == GrayF32.class ) { select = selectDisparitySubpixel_F32((int) maxError, validateRtoL, texture); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unknown image type"); } DisparityScoreRowFormat<T,GrayF32> alg = null; switch( whichAlg ) { case RECT: if( imageType == GrayU8.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRect_U8(minDisparity, maxDisparity,regionRadiusX,regionRadiusY,select); // depends on control dependency: [if], data = [none] } else if( imageType == GrayS16.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRect_S16(minDisparity, maxDisparity, regionRadiusX, regionRadiusY, select); // depends on control dependency: [if], data = [none] } else if( imageType == GrayF32.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRect_F32(minDisparity, maxDisparity, regionRadiusX, regionRadiusY, select); // depends on control dependency: [if], data = [none] } break; case RECT_FIVE: if( imageType == GrayU8.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRectFive_U8(minDisparity, maxDisparity,regionRadiusX,regionRadiusY,select); // depends on control dependency: [if], data = [none] } else if( imageType == GrayS16.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRectFive_S16(minDisparity, maxDisparity, regionRadiusX, regionRadiusY, select); // depends on control dependency: [if], data = [none] } else if( imageType == GrayF32.class ) { alg = FactoryStereoDisparityAlgs.scoreDisparitySadRectFive_F32(minDisparity, maxDisparity, regionRadiusX, regionRadiusY, select); // depends on control dependency: [if], data = [none] } break; default: throw new IllegalArgumentException("Unknown algorithms "+whichAlg); } if( alg == null) throw new RuntimeException("Image type not supported: "+imageType.getSimpleName() ); return new WrapDisparitySadRect<>(alg); } }
public class class_name { public MetricName tagged(String... pairs) { if (pairs == null) { return this; } if (pairs.length % 2 != 0) { throw new IllegalArgumentException("Argument count must be even"); } final Map<String, String> add = new HashMap<>(); for (int i = 0; i < pairs.length; i += 2) { add.put(pairs[i], pairs[i+1]); } return tagged(add); } }
public class class_name { public MetricName tagged(String... pairs) { if (pairs == null) { return this; // depends on control dependency: [if], data = [none] } if (pairs.length % 2 != 0) { throw new IllegalArgumentException("Argument count must be even"); } final Map<String, String> add = new HashMap<>(); for (int i = 0; i < pairs.length; i += 2) { add.put(pairs[i], pairs[i+1]); // depends on control dependency: [for], data = [i] } return tagged(add); } }
public class class_name { protected final boolean tryCP(String directory){ String[] cp = StringUtils.split(System.getProperty("java.class.path"), File.pathSeparatorChar); for(String s : cp){ if(!StringUtils.endsWith(s, ".jar") && !StringUtils.startsWith(s, "/")){ String path = s + File.separator + directory; File file = new File(path); if(this.testDirectory(file)==true){ //found using class path try{ this.url = file.toURI().toURL(); this.file = file; this.fullDirectoryName = FilenameUtils.getPath(file.getAbsolutePath()); this.setRootPath = directory; return true; } catch (MalformedURLException e) { this.errors.addError("init() - malformed URL for file with name " + this.file.getAbsolutePath() + " and message: " + e.getMessage()); } } } } return false; } }
public class class_name { protected final boolean tryCP(String directory){ String[] cp = StringUtils.split(System.getProperty("java.class.path"), File.pathSeparatorChar); for(String s : cp){ if(!StringUtils.endsWith(s, ".jar") && !StringUtils.startsWith(s, "/")){ String path = s + File.separator + directory; File file = new File(path); if(this.testDirectory(file)==true){ //found using class path try{ this.url = file.toURI().toURL(); // depends on control dependency: [try], data = [none] this.file = file; // depends on control dependency: [try], data = [none] this.fullDirectoryName = FilenameUtils.getPath(file.getAbsolutePath()); // depends on control dependency: [try], data = [none] this.setRootPath = directory; // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { this.errors.addError("init() - malformed URL for file with name " + this.file.getAbsolutePath() + " and message: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] } } } return false; } }
public class class_name { private void handleRpcException(RpcException e, int attemptNumber) throws IOException { String messageStart; if (!(e.getStatus().equals(RpcStatus.NETWORK_ERROR))) { messageStart = "rpc"; } else { // check whether to retry if (attemptNumber + 1 < _maximumRetries) { try { int waitTime = _retryWait * (attemptNumber + 1); Thread.sleep(waitTime); } catch (InterruptedException ie) { // restore the interrupt status Thread.currentThread().interrupt(); } LOG.warn("network error happens, server {}, attemptNumber {}", new Object[] { _server, attemptNumber }); return; } messageStart = "network"; } throw new NfsException(NfsStatus.NFS3ERR_IO, String.format("%s error, server: %s, RPC error: %s", messageStart, _server, e.getMessage()), e); } }
public class class_name { private void handleRpcException(RpcException e, int attemptNumber) throws IOException { String messageStart; if (!(e.getStatus().equals(RpcStatus.NETWORK_ERROR))) { messageStart = "rpc"; } else { // check whether to retry if (attemptNumber + 1 < _maximumRetries) { try { int waitTime = _retryWait * (attemptNumber + 1); Thread.sleep(waitTime); // depends on control dependency: [try], data = [none] } catch (InterruptedException ie) { // restore the interrupt status Thread.currentThread().interrupt(); } // depends on control dependency: [catch], data = [none] LOG.warn("network error happens, server {}, attemptNumber {}", new Object[] { _server, attemptNumber }); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } messageStart = "network"; } throw new NfsException(NfsStatus.NFS3ERR_IO, String.format("%s error, server: %s, RPC error: %s", messageStart, _server, e.getMessage()), e); } }
public class class_name { private void _writeStringASCII(final int len, final int maxNonEscaped) throws IOException, JsonGenerationException { // And then we'll need to verify need for escaping etc: int end = _outputTail + len; final int[] escCodes = _outputEscapes; final int escLimit = Math.min(escCodes.length, maxNonEscaped+1); int escCode = 0; output_loop: while (_outputTail < end) { char c; // Fast loop for chars not needing escaping escape_loop: while (true) { c = _outputBuffer[_outputTail]; if (c < escLimit) { escCode = escCodes[c]; if (escCode != 0) { break escape_loop; } } else if (c > maxNonEscaped) { escCode = CharacterEscapes.ESCAPE_STANDARD; break escape_loop; } if (++_outputTail >= end) { break output_loop; } } int flushLen = (_outputTail - _outputHead); if (flushLen > 0) { _writer.write(_outputBuffer, _outputHead, flushLen); } ++_outputTail; _prependOrWriteCharacterEscape(c, escCode); } } }
public class class_name { private void _writeStringASCII(final int len, final int maxNonEscaped) throws IOException, JsonGenerationException { // And then we'll need to verify need for escaping etc: int end = _outputTail + len; final int[] escCodes = _outputEscapes; final int escLimit = Math.min(escCodes.length, maxNonEscaped+1); int escCode = 0; output_loop: while (_outputTail < end) { char c; // Fast loop for chars not needing escaping escape_loop: while (true) { c = _outputBuffer[_outputTail]; if (c < escLimit) { escCode = escCodes[c]; // depends on control dependency: [if], data = [none] if (escCode != 0) { break escape_loop; } } else if (c > maxNonEscaped) { escCode = CharacterEscapes.ESCAPE_STANDARD; // depends on control dependency: [if], data = [none] break escape_loop; } if (++_outputTail >= end) { break output_loop; } } int flushLen = (_outputTail - _outputHead); if (flushLen > 0) { _writer.write(_outputBuffer, _outputHead, flushLen); } ++_outputTail; _prependOrWriteCharacterEscape(c, escCode); } } }
public class class_name { private String addTenantParam(String uri) { if (m_credentials != null && m_credentials.getTenant() != null) { if (uri.indexOf("?") > 0) { return uri + "&tenant=" + m_credentials.getTenant(); } else { return uri + "?tenant=" + m_credentials.getTenant(); } } return uri; } }
public class class_name { private String addTenantParam(String uri) { if (m_credentials != null && m_credentials.getTenant() != null) { if (uri.indexOf("?") > 0) { return uri + "&tenant=" + m_credentials.getTenant(); // depends on control dependency: [if], data = [none] } else { return uri + "?tenant=" + m_credentials.getTenant(); // depends on control dependency: [if], data = [none] } } return uri; } }
public class class_name { @Deprecated public void setAccessExpiresIn(String expiresInSecsFromNow) { checkUserSession("setAccessExpiresIn"); if (expiresInSecsFromNow != null) { long expires = expiresInSecsFromNow.equals("0") ? 0 : System.currentTimeMillis() + Long.parseLong(expiresInSecsFromNow) * 1000L; setAccessExpires(expires); } } }
public class class_name { @Deprecated public void setAccessExpiresIn(String expiresInSecsFromNow) { checkUserSession("setAccessExpiresIn"); if (expiresInSecsFromNow != null) { long expires = expiresInSecsFromNow.equals("0") ? 0 : System.currentTimeMillis() + Long.parseLong(expiresInSecsFromNow) * 1000L; setAccessExpires(expires); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Object convertObjectToDatatype(Object objData, Class<?> classData, Object objDefault, int iScale) throws Exception { if (objData == null) return objDefault; if (objData.getClass() == classData) return objData; objData = objData.toString(); // Make sure it can be converted. DataConverters.initGlobals(); if (objData instanceof String) { // Convert to local format try { if (classData == Short.class) objData = DataConverters.stringToShort((String)objData); else if (classData == Integer.class) objData = DataConverters.stringToInteger((String)objData); else if (classData == Float.class) objData = DataConverters.stringToFloat((String)objData, iScale); else if (classData == Double.class) objData = DataConverters.stringToDouble((String)objData, iScale); else if (classData == Long.class) { objData = DataConverters.stringToDouble((String)objData, iScale); objData = new Long(((Double)objData).longValue()); } else if (classData == Date.class) { Date objDate = null; try { objDate = DataConverters.stringToDate((String)objData, iScale); // Try them all } catch (ParseException ex) { objDate = null; } if (objDate == null) { try { synchronized (DataConverters.gCalendar) { objDate = DataConverters.gGMTDateTimeFormat.parse((String)objData); } } catch (ParseException ex) { objDate = null; } } objData = objDate; } else if (classData == Boolean.class) objData = new Boolean((String)objData); else objData = (String)objData; } catch (Exception ex) { throw ex; } } if (objData == null) if (objDefault != null) return DataConverters.convertObjectToDatatype(objDefault, classData, null, iScale); // No chance of infinite recursion return objData; } }
public class class_name { public static Object convertObjectToDatatype(Object objData, Class<?> classData, Object objDefault, int iScale) throws Exception { if (objData == null) return objDefault; if (objData.getClass() == classData) return objData; objData = objData.toString(); // Make sure it can be converted. DataConverters.initGlobals(); if (objData instanceof String) { // Convert to local format try { if (classData == Short.class) objData = DataConverters.stringToShort((String)objData); else if (classData == Integer.class) objData = DataConverters.stringToInteger((String)objData); else if (classData == Float.class) objData = DataConverters.stringToFloat((String)objData, iScale); else if (classData == Double.class) objData = DataConverters.stringToDouble((String)objData, iScale); else if (classData == Long.class) { objData = DataConverters.stringToDouble((String)objData, iScale); // depends on control dependency: [if], data = [none] objData = new Long(((Double)objData).longValue()); // depends on control dependency: [if], data = [none] } else if (classData == Date.class) { Date objDate = null; try { objDate = DataConverters.stringToDate((String)objData, iScale); // Try them all // depends on control dependency: [try], data = [none] } catch (ParseException ex) { objDate = null; } // depends on control dependency: [catch], data = [none] if (objDate == null) { try { synchronized (DataConverters.gCalendar) // depends on control dependency: [try], data = [none] { objDate = DataConverters.gGMTDateTimeFormat.parse((String)objData); } } catch (ParseException ex) { objDate = null; } // depends on control dependency: [catch], data = [none] } objData = objDate; // depends on control dependency: [if], data = [none] } else if (classData == Boolean.class) objData = new Boolean((String)objData); else objData = (String)objData; } catch (Exception ex) { throw ex; } // depends on control dependency: [catch], data = [none] } if (objData == null) if (objDefault != null) return DataConverters.convertObjectToDatatype(objDefault, classData, null, iScale); // No chance of infinite recursion return objData; } }
public class class_name { public void deactivate() { active.set(false); if (!(conceptQueue.isEmpty() && roleQueue.isEmpty() && featureQueue.isEmpty())) { if (activate()) { parentTodo.add(this); } } } }
public class class_name { public void deactivate() { active.set(false); if (!(conceptQueue.isEmpty() && roleQueue.isEmpty() && featureQueue.isEmpty())) { if (activate()) { parentTodo.add(this); // depends on control dependency: [if], data = [none] } } } }
public class class_name { MessageType fromParquetSchema(List<SchemaElement> schema, List<ColumnOrder> columnOrders) { Iterator<SchemaElement> iterator = schema.iterator(); SchemaElement root = iterator.next(); Types.MessageTypeBuilder builder = Types.buildMessage(); if (root.isSetField_id()) { builder.id(root.field_id); } buildChildren(builder, iterator, root.getNum_children(), columnOrders, 0); return builder.named(root.name); } }
public class class_name { MessageType fromParquetSchema(List<SchemaElement> schema, List<ColumnOrder> columnOrders) { Iterator<SchemaElement> iterator = schema.iterator(); SchemaElement root = iterator.next(); Types.MessageTypeBuilder builder = Types.buildMessage(); if (root.isSetField_id()) { builder.id(root.field_id); // depends on control dependency: [if], data = [none] } buildChildren(builder, iterator, root.getNum_children(), columnOrders, 0); return builder.named(root.name); } }
public class class_name { public static String getCategoryPath(String rootPath, String baseFolder) throws Exception { String base; if (rootPath.startsWith(CmsCategoryService.CENTRALIZED_REPOSITORY)) { base = CmsCategoryService.CENTRALIZED_REPOSITORY; } else { base = baseFolder; if (!base.endsWith("/")) { base += "/"; } if (!base.startsWith("/")) { base = "/" + base; } int pos = rootPath.indexOf(base); if (pos < 0) { throw new Exception("Invalid category location \"" + rootPath + "\"."); } base = rootPath.substring(0, pos + base.length()); } return rootPath.substring(base.length()); } }
public class class_name { public static String getCategoryPath(String rootPath, String baseFolder) throws Exception { String base; if (rootPath.startsWith(CmsCategoryService.CENTRALIZED_REPOSITORY)) { base = CmsCategoryService.CENTRALIZED_REPOSITORY; } else { base = baseFolder; if (!base.endsWith("/")) { base += "/"; // depends on control dependency: [if], data = [none] } if (!base.startsWith("/")) { base = "/" + base; // depends on control dependency: [if], data = [none] } int pos = rootPath.indexOf(base); if (pos < 0) { throw new Exception("Invalid category location \"" + rootPath + "\"."); } base = rootPath.substring(0, pos + base.length()); } return rootPath.substring(base.length()); } }