code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { static void unregister(final Object value) { Set<IDKey> registry = getRegistry(); if (registry != null) { registry.remove(new IDKey(value)); synchronized (HashCodeBuilder.class) { //read again registry = getRegistry(); if (registry != null && registry.isEmpty()) { REGISTRY.remove(); } } } } }
public class class_name { static void unregister(final Object value) { Set<IDKey> registry = getRegistry(); if (registry != null) { registry.remove(new IDKey(value)); // depends on control dependency: [if], data = [none] synchronized (HashCodeBuilder.class) { // depends on control dependency: [if], data = [none] //read again registry = getRegistry(); if (registry != null && registry.isEmpty()) { REGISTRY.remove(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private Collection<? extends ResourceRoot> handleClassPathItems(final DeploymentUnit deploymentUnit) { final Set<ResourceRoot> additionalRoots = new HashSet<ResourceRoot>(); final ArrayDeque<ResourceRoot> toProcess = new ArrayDeque<ResourceRoot>(); final List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit); toProcess.addAll(resourceRoots); final Set<ResourceRoot> processed = new HashSet<ResourceRoot>(resourceRoots); while (!toProcess.isEmpty()) { final ResourceRoot root = toProcess.pop(); final List<ResourceRoot> classPathRoots = root.getAttachmentList(Attachments.CLASS_PATH_RESOURCE_ROOTS); for(ResourceRoot cpRoot : classPathRoots) { if(!processed.contains(cpRoot)) { additionalRoots.add(cpRoot); toProcess.add(cpRoot); processed.add(cpRoot); } } } return additionalRoots; } }
public class class_name { private Collection<? extends ResourceRoot> handleClassPathItems(final DeploymentUnit deploymentUnit) { final Set<ResourceRoot> additionalRoots = new HashSet<ResourceRoot>(); final ArrayDeque<ResourceRoot> toProcess = new ArrayDeque<ResourceRoot>(); final List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit); toProcess.addAll(resourceRoots); final Set<ResourceRoot> processed = new HashSet<ResourceRoot>(resourceRoots); while (!toProcess.isEmpty()) { final ResourceRoot root = toProcess.pop(); final List<ResourceRoot> classPathRoots = root.getAttachmentList(Attachments.CLASS_PATH_RESOURCE_ROOTS); for(ResourceRoot cpRoot : classPathRoots) { if(!processed.contains(cpRoot)) { additionalRoots.add(cpRoot); // depends on control dependency: [if], data = [none] toProcess.add(cpRoot); // depends on control dependency: [if], data = [none] processed.add(cpRoot); // depends on control dependency: [if], data = [none] } } } return additionalRoots; } }
public class class_name { private void handleResponse(@NonNull Uri uri) { if (AuthUtils.isAuthorizationCodePresent(uri)) { onCodeReceived(uri); } else { handleAccessTokenResponse(uri); } } }
public class class_name { private void handleResponse(@NonNull Uri uri) { if (AuthUtils.isAuthorizationCodePresent(uri)) { onCodeReceived(uri); // depends on control dependency: [if], data = [none] } else { handleAccessTokenResponse(uri); // depends on control dependency: [if], data = [none] } } }
public class class_name { public int activeCount() { int result; // Snapshot sub-group data so we don't hold this lock // while our children are computing. int ngroupsSnapshot; ThreadGroup[] groupsSnapshot; synchronized (this) { if (destroyed) { return 0; } result = nthreads; ngroupsSnapshot = ngroups; if (groups != null) { groupsSnapshot = Arrays.copyOf(groups, ngroupsSnapshot); } else { groupsSnapshot = null; } } for (int i = 0 ; i < ngroupsSnapshot ; i++) { result += groupsSnapshot[i].activeCount(); } return result; } }
public class class_name { public int activeCount() { int result; // Snapshot sub-group data so we don't hold this lock // while our children are computing. int ngroupsSnapshot; ThreadGroup[] groupsSnapshot; synchronized (this) { if (destroyed) { return 0; // depends on control dependency: [if], data = [none] } result = nthreads; ngroupsSnapshot = ngroups; if (groups != null) { groupsSnapshot = Arrays.copyOf(groups, ngroupsSnapshot); // depends on control dependency: [if], data = [(groups] } else { groupsSnapshot = null; // depends on control dependency: [if], data = [none] } } for (int i = 0 ; i < ngroupsSnapshot ; i++) { result += groupsSnapshot[i].activeCount(); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { public void marshall(PutConfigRuleRequest putConfigRuleRequest, ProtocolMarshaller protocolMarshaller) { if (putConfigRuleRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putConfigRuleRequest.getConfigRule(), CONFIGRULE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PutConfigRuleRequest putConfigRuleRequest, ProtocolMarshaller protocolMarshaller) { if (putConfigRuleRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putConfigRuleRequest.getConfigRule(), CONFIGRULE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Object create(ActionParameter argument, Context context, ParameterFactories engine) { if (argument.getRawType().equals(Context.class)) { return context; } // Check whether we have a ParameterFactory that can handle the creation. Set<Class> handled = engine.getTypesHandledByFactories(); if (handled.contains(argument.getRawType())) { return engine.newInstance(context, argument.getRawType()); } if (argument.getRawType().equals(Request.class)) { return context.request(); } if (argument.getRawType().equals(SessionCookie.class)) { return context.session(); } if (argument.getRawType().equals(FlashCookie.class)) { return context.flash(); } if (argument.getRawType().equals(Cookie.class)) { if (!Strings.isNullOrEmpty(argument.getName())) { return context.cookie(argument.getName()); } else { throw new IllegalArgumentException("Missing cookie's name set in the @HttpParameter annotation"); } } if (argument.getRawType().equals(Route.class)) { return context.route(); } if (argument.getRawType().equals(BufferedReader.class) || argument.getRawType().equals(Reader.class)) { try { return context.reader(); } catch (IOException e) { throw new IllegalArgumentException("Cannot inject the reader object in the @HttpParameter injected " + "parameter", e); } } // Ran out of possibilities based on the type, check for the request scope and then HTTP headers if (Strings.isNullOrEmpty(argument.getName())) { throw new IllegalArgumentException("Cannot inject the value of a HTTP header and request scope value in " + "the @HttpParameter - header's name not defined"); } else { final Object requestScopeValue = context.request().data().get(argument.getName()); if (requestScopeValue != null) { return requestScopeValue; } else { if (context.header(argument.getName()) != null || argument.getDefaultValue() != null) { return engine.convertValues(context.headers(argument.getName()), argument.getRawType(), argument.getGenericType(), argument.getDefaultValue()); } else { // No value. if (List.class.isAssignableFrom(argument.getRawType())) { return Collections.emptyList(); } if (Set.class.isAssignableFrom(argument.getRawType())) { return Collections.emptySet(); } if (Collections.class.isAssignableFrom(argument.getRawType())) { return Collections.emptyList(); } return null; } } } } }
public class class_name { @Override public Object create(ActionParameter argument, Context context, ParameterFactories engine) { if (argument.getRawType().equals(Context.class)) { return context; // depends on control dependency: [if], data = [none] } // Check whether we have a ParameterFactory that can handle the creation. Set<Class> handled = engine.getTypesHandledByFactories(); if (handled.contains(argument.getRawType())) { return engine.newInstance(context, argument.getRawType()); // depends on control dependency: [if], data = [none] } if (argument.getRawType().equals(Request.class)) { return context.request(); // depends on control dependency: [if], data = [none] } if (argument.getRawType().equals(SessionCookie.class)) { return context.session(); // depends on control dependency: [if], data = [none] } if (argument.getRawType().equals(FlashCookie.class)) { return context.flash(); // depends on control dependency: [if], data = [none] } if (argument.getRawType().equals(Cookie.class)) { if (!Strings.isNullOrEmpty(argument.getName())) { return context.cookie(argument.getName()); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Missing cookie's name set in the @HttpParameter annotation"); } } if (argument.getRawType().equals(Route.class)) { return context.route(); // depends on control dependency: [if], data = [none] } if (argument.getRawType().equals(BufferedReader.class) || argument.getRawType().equals(Reader.class)) { try { return context.reader(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IllegalArgumentException("Cannot inject the reader object in the @HttpParameter injected " + "parameter", e); } // depends on control dependency: [catch], data = [none] } // Ran out of possibilities based on the type, check for the request scope and then HTTP headers if (Strings.isNullOrEmpty(argument.getName())) { throw new IllegalArgumentException("Cannot inject the value of a HTTP header and request scope value in " + "the @HttpParameter - header's name not defined"); } else { final Object requestScopeValue = context.request().data().get(argument.getName()); if (requestScopeValue != null) { return requestScopeValue; // depends on control dependency: [if], data = [none] } else { if (context.header(argument.getName()) != null || argument.getDefaultValue() != null) { return engine.convertValues(context.headers(argument.getName()), argument.getRawType(), argument.getGenericType(), argument.getDefaultValue()); // depends on control dependency: [if], data = [none] } else { // No value. if (List.class.isAssignableFrom(argument.getRawType())) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } if (Set.class.isAssignableFrom(argument.getRawType())) { return Collections.emptySet(); // depends on control dependency: [if], data = [none] } if (Collections.class.isAssignableFrom(argument.getRawType())) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @SuppressWarnings("unchecked") public Method findAdaptMethod(Class from, Class to) { Method[] methods = mAdaptMethods; List<Method> candidates = new ArrayList<Method>(methods.length); for (int i=methods.length; --i>=0; ) { Method method = methods[i]; if (to.isAssignableFrom(method.getReturnType()) && method.getParameterTypes()[0].isAssignableFrom(from)) { candidates.add(method); } } reduceCandidates(candidates, to); if (candidates.size() == 0) { return null; } return candidates.get(0); } }
public class class_name { @SuppressWarnings("unchecked") public Method findAdaptMethod(Class from, Class to) { Method[] methods = mAdaptMethods; List<Method> candidates = new ArrayList<Method>(methods.length); for (int i=methods.length; --i>=0; ) { Method method = methods[i]; if (to.isAssignableFrom(method.getReturnType()) && method.getParameterTypes()[0].isAssignableFrom(from)) { candidates.add(method); // depends on control dependency: [if], data = [none] } } reduceCandidates(candidates, to); if (candidates.size() == 0) { return null; // depends on control dependency: [if], data = [none] } return candidates.get(0); } }
public class class_name { public RamResourceCore getChild(String name, boolean caseSensitive) { if (children == null) return null; RamResourceCore child; for (int i = children.size() - 1; i >= 0; i--) { child = (RamResourceCore) children.get(i); if (child != null && (caseSensitive ? child.getName().equals(name) : child.getName().equalsIgnoreCase(name))) return child; } return null; } }
public class class_name { public RamResourceCore getChild(String name, boolean caseSensitive) { if (children == null) return null; RamResourceCore child; for (int i = children.size() - 1; i >= 0; i--) { child = (RamResourceCore) children.get(i); // depends on control dependency: [for], data = [i] if (child != null && (caseSensitive ? child.getName().equals(name) : child.getName().equalsIgnoreCase(name))) return child; } return null; } }
public class class_name { protected static ActivityManager.MemoryInfo getMemInfo(Context ctx) { try { ActivityManager actManager = (ActivityManager) ctx.getSystemService(ACTIVITY_SERVICE); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); actManager.getMemoryInfo(memInfo); return memInfo; } catch (Exception e) { Log.e(TAG, "Error getting MemoryInfo.", e); return null; } } }
public class class_name { protected static ActivityManager.MemoryInfo getMemInfo(Context ctx) { try { ActivityManager actManager = (ActivityManager) ctx.getSystemService(ACTIVITY_SERVICE); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); actManager.getMemoryInfo(memInfo); // depends on control dependency: [try], data = [none] return memInfo; // depends on control dependency: [try], data = [none] } catch (Exception e) { Log.e(TAG, "Error getting MemoryInfo.", e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String getPatternName(OptionalIdentifiedDefinition camelNode) { // we should grab the annotation instead XmlRootElement root = camelNode.getClass().getAnnotation(XmlRootElement.class); if (root != null) { return root.name(); } String simpleName = Strings.stripSuffix(camelNode.getClass().getSimpleName(), "Definition"); return Introspector.decapitalize(simpleName); } }
public class class_name { public static String getPatternName(OptionalIdentifiedDefinition camelNode) { // we should grab the annotation instead XmlRootElement root = camelNode.getClass().getAnnotation(XmlRootElement.class); if (root != null) { return root.name(); // depends on control dependency: [if], data = [none] } String simpleName = Strings.stripSuffix(camelNode.getClass().getSimpleName(), "Definition"); return Introspector.decapitalize(simpleName); } }
public class class_name { public boolean rename(GeoPackageMetadata metadata, String newName) { boolean renamed = rename(metadata.getName(), newName); if (renamed) { metadata.setName(newName); } return renamed; } }
public class class_name { public boolean rename(GeoPackageMetadata metadata, String newName) { boolean renamed = rename(metadata.getName(), newName); if (renamed) { metadata.setName(newName); // depends on control dependency: [if], data = [none] } return renamed; } }
public class class_name { public static byte[] getBytes(String text) { byte[] bytes = new byte[] {}; try { bytes = text.getBytes("utf-8"); } catch (UnsupportedEncodingException e) { } return bytes; } }
public class class_name { public static byte[] getBytes(String text) { byte[] bytes = new byte[] {}; try { bytes = text.getBytes("utf-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { } // depends on control dependency: [catch], data = [none] return bytes; } }
public class class_name { public static int getSystemProperty (String key, int defval) { String valstr = System.getProperty(key); int value = defval; if (valstr != null) { try { value = Integer.parseInt(valstr); } catch (NumberFormatException nfe) { log.warning("'" + key + "' must be a numeric value", "value", valstr, "error", nfe); } } return value; } }
public class class_name { public static int getSystemProperty (String key, int defval) { String valstr = System.getProperty(key); int value = defval; if (valstr != null) { try { value = Integer.parseInt(valstr); // depends on control dependency: [try], data = [none] } catch (NumberFormatException nfe) { log.warning("'" + key + "' must be a numeric value", "value", valstr, "error", nfe); } // depends on control dependency: [catch], data = [none] } return value; } }
public class class_name { private Coordinate[] getOrderedNodes( Coordinate c, Coordinate coordinate1, Coordinate coordinate2, Coordinate coordinate3 ) { double d = distance3d(c, coordinate1, null); Coordinate nearest = coordinate1; Coordinate c2 = coordinate2; Coordinate c3 = coordinate3; double d2 = distance3d(c, coordinate2, null); if (d2 < d) { nearest = coordinate2; d = d2; c2 = coordinate1; c3 = coordinate3; } double d3 = distance3d(c, coordinate3, null); if (d3 < d) { nearest = coordinate3; c2 = coordinate1; c3 = coordinate2; } return new Coordinate[]{nearest, c2, c3}; } }
public class class_name { private Coordinate[] getOrderedNodes( Coordinate c, Coordinate coordinate1, Coordinate coordinate2, Coordinate coordinate3 ) { double d = distance3d(c, coordinate1, null); Coordinate nearest = coordinate1; Coordinate c2 = coordinate2; Coordinate c3 = coordinate3; double d2 = distance3d(c, coordinate2, null); if (d2 < d) { nearest = coordinate2; // depends on control dependency: [if], data = [none] d = d2; // depends on control dependency: [if], data = [none] c2 = coordinate1; // depends on control dependency: [if], data = [none] c3 = coordinate3; // depends on control dependency: [if], data = [none] } double d3 = distance3d(c, coordinate3, null); if (d3 < d) { nearest = coordinate3; // depends on control dependency: [if], data = [none] c2 = coordinate1; // depends on control dependency: [if], data = [none] c3 = coordinate2; // depends on control dependency: [if], data = [none] } return new Coordinate[]{nearest, c2, c3}; } }
public class class_name { public Task poll(long timeout, TimeUnit unit) throws InterruptedException { lock.lockInterruptibly(); try { // wait for the set to be not empty timeout = unit.toNanos(timeout); while (this.dormant.size() == 0) { _logger.trace("Task set empty; waiting for new task to be added"); if (timeout > 0) { // "notEmpty" is notified whenever a task is added to the set timeout = notEmpty.awaitNanos(timeout); } else { return null; } } // wait until the next task is not blocked while (this.blocked(this.dormant.get(0))) { _logger.trace("Next task blocked; waiting for other tasks to finish"); if (timeout > 0) { // "unblocked" is notified whenever a task is finished or a new task is // added to the set. We wait on that before checking if this task is still // blocked. timeout = unblocked.awaitNanos(timeout); } else { return null; // a timeout occurred } } TaskContainer container = this.dormant.remove(0); this.enabled.add(container); if (_logger.isDebugEnabled()) { _logger.debug("Enabling command: " + container.getCommand()); _logger.debug("Dormant task set: " + this.dormant); } return container; } finally { lock.unlock(); } } }
public class class_name { public Task poll(long timeout, TimeUnit unit) throws InterruptedException { lock.lockInterruptibly(); try { // wait for the set to be not empty timeout = unit.toNanos(timeout); while (this.dormant.size() == 0) { _logger.trace("Task set empty; waiting for new task to be added"); // depends on control dependency: [while], data = [none] if (timeout > 0) { // "notEmpty" is notified whenever a task is added to the set timeout = notEmpty.awaitNanos(timeout); // depends on control dependency: [if], data = [(timeout] } else { return null; // depends on control dependency: [if], data = [none] } } // wait until the next task is not blocked while (this.blocked(this.dormant.get(0))) { _logger.trace("Next task blocked; waiting for other tasks to finish"); // depends on control dependency: [while], data = [none] if (timeout > 0) { // "unblocked" is notified whenever a task is finished or a new task is // added to the set. We wait on that before checking if this task is still // blocked. timeout = unblocked.awaitNanos(timeout); // depends on control dependency: [if], data = [(timeout] } else { return null; // a timeout occurred // depends on control dependency: [if], data = [none] } } TaskContainer container = this.dormant.remove(0); this.enabled.add(container); if (_logger.isDebugEnabled()) { _logger.debug("Enabling command: " + container.getCommand()); // depends on control dependency: [if], data = [none] _logger.debug("Dormant task set: " + this.dormant); // depends on control dependency: [if], data = [none] } return container; } finally { lock.unlock(); } } }
public class class_name { protected ProxettaMethodBuilder applyProxy(final MethodSignatureVisitor msign) { List<ProxyAspectData> aspectList = matchMethodPointcuts(msign); if (aspectList == null) { // no pointcuts on this method, return return null; } int access = msign.getAccessFlags(); if ((access & ACC_ABSTRACT) != 0) { throw new ProxettaException("Unable to process abstract method: " + msign); } wd.proxyApplied = true; return new ProxettaMethodBuilder(msign, wd, aspectList); } }
public class class_name { protected ProxettaMethodBuilder applyProxy(final MethodSignatureVisitor msign) { List<ProxyAspectData> aspectList = matchMethodPointcuts(msign); if (aspectList == null) { // no pointcuts on this method, return return null; // depends on control dependency: [if], data = [none] } int access = msign.getAccessFlags(); if ((access & ACC_ABSTRACT) != 0) { throw new ProxettaException("Unable to process abstract method: " + msign); } wd.proxyApplied = true; return new ProxettaMethodBuilder(msign, wd, aspectList); } }
public class class_name { private void closeSessionWrapper(SessionConnectionWrapper sessionWrapper, String logText) { try { sessionWrapper.close(); } catch (SQLException e) { //ignore exception. The connection will automatically be removed from the pool. logInfo(logText, e); } } }
public class class_name { private void closeSessionWrapper(SessionConnectionWrapper sessionWrapper, String logText) { try { sessionWrapper.close(); // depends on control dependency: [try], data = [none] } catch (SQLException e) { //ignore exception. The connection will automatically be removed from the pool. logInfo(logText, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void endPrefixMapping(String prefix) throws SAXException { if (directivesOnly) { String uri = pageInfo.getURI(prefix); if (!JSP_URI.equals(uri)) { return; } } pageInfo.popPrefixMapping(prefix); } }
public class class_name { public void endPrefixMapping(String prefix) throws SAXException { if (directivesOnly) { String uri = pageInfo.getURI(prefix); if (!JSP_URI.equals(uri)) { return; // depends on control dependency: [if], data = [none] } } pageInfo.popPrefixMapping(prefix); } }
public class class_name { public void evaluateAnalogies(Matrix projection) { try { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String analogy = sc.next(); if (!isAnalogyFormat(analogy,true)) { System.err.println("\"" + analogy + "\" not in proper format."); continue; } double cosineVal = computeCosineSimilarity(analogy, projection); //does the actual cosine value calculations and comparisons System.out.println(analogy + " = " + cosineVal); } sc.close(); } catch (Exception e) { System.err.println("Could not read file."); } } }
public class class_name { public void evaluateAnalogies(Matrix projection) { try { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String analogy = sc.next(); if (!isAnalogyFormat(analogy,true)) { System.err.println("\"" + analogy + "\" not in proper format."); // depends on control dependency: [if], data = [none] continue; } double cosineVal = computeCosineSimilarity(analogy, projection); //does the actual cosine value calculations and comparisons System.out.println(analogy + " = " + cosineVal); // depends on control dependency: [while], data = [none] } sc.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.err.println("Could not read file."); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected int countEvents(Collection<Event> existingEvents, Event triggeringEvent, DetectionPoint configuredDetectionPoint) { int count = 0; long intervalInMillis = configuredDetectionPoint.getThreshold().getInterval().toMillis(); //grab the startTime to begin counting from based on the current time - interval DateTime startTime = DateUtils.getCurrentTimestamp().minusMillis((int)intervalInMillis); //count events after most recent attack. DateTime mostRecentAttackTime = findMostRecentAttackTime(triggeringEvent, configuredDetectionPoint); for (Event event : existingEvents) { DateTime eventTimestamp = DateUtils.fromString(event.getTimestamp()); //ensure only events that have occurred since the last attack are considered if (eventTimestamp.isAfter(mostRecentAttackTime)) { if (intervalInMillis > 0) { if (DateUtils.fromString(event.getTimestamp()).isAfter(startTime)) { //only increment when event occurs within specified interval count++; } } else { //no interval - all events considered count++; } } } return count; } }
public class class_name { protected int countEvents(Collection<Event> existingEvents, Event triggeringEvent, DetectionPoint configuredDetectionPoint) { int count = 0; long intervalInMillis = configuredDetectionPoint.getThreshold().getInterval().toMillis(); //grab the startTime to begin counting from based on the current time - interval DateTime startTime = DateUtils.getCurrentTimestamp().minusMillis((int)intervalInMillis); //count events after most recent attack. DateTime mostRecentAttackTime = findMostRecentAttackTime(triggeringEvent, configuredDetectionPoint); for (Event event : existingEvents) { DateTime eventTimestamp = DateUtils.fromString(event.getTimestamp()); //ensure only events that have occurred since the last attack are considered if (eventTimestamp.isAfter(mostRecentAttackTime)) { if (intervalInMillis > 0) { if (DateUtils.fromString(event.getTimestamp()).isAfter(startTime)) { //only increment when event occurs within specified interval count++; // depends on control dependency: [if], data = [none] } } else { //no interval - all events considered count++; // depends on control dependency: [if], data = [none] } } } return count; } }
public class class_name { public void setIconRegular(boolean _iconRegular) { if (_iconRegular) { AddResourcesListener.setFontAwesomeVersion(5, this); } getStateHelper().put(PropertyKeys.iconRegular, _iconRegular); } }
public class class_name { public void setIconRegular(boolean _iconRegular) { if (_iconRegular) { AddResourcesListener.setFontAwesomeVersion(5, this); // depends on control dependency: [if], data = [none] } getStateHelper().put(PropertyKeys.iconRegular, _iconRegular); } }
public class class_name { public void report(final ThresholdLogSpan span) { if (isOverThreshold(span)) { if (!overThresholdQueue.offer(span)) { LOGGER.debug("Could not enqueue span {} for over threshold reporting, discarding.", span); } } } }
public class class_name { public void report(final ThresholdLogSpan span) { if (isOverThreshold(span)) { if (!overThresholdQueue.offer(span)) { LOGGER.debug("Could not enqueue span {} for over threshold reporting, discarding.", span); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static void remove(AnalyzedTokenReadings readings, Pattern pattern) { List<AnalyzedToken> analyzedTokens = readings.getReadings(); for (int j = analyzedTokens.size()-1; j>=0; j--) { AnalyzedToken analyzedToken = analyzedTokens.get(j); if( ! JLanguageTool.SENTENCE_END_TAGNAME.equals(analyzedToken.getPOSTag()) && ! PosTagHelper.hasPosTag(analyzedToken, pattern) ) { readings.removeReading(analyzedToken); } } } }
public class class_name { private static void remove(AnalyzedTokenReadings readings, Pattern pattern) { List<AnalyzedToken> analyzedTokens = readings.getReadings(); for (int j = analyzedTokens.size()-1; j>=0; j--) { AnalyzedToken analyzedToken = analyzedTokens.get(j); if( ! JLanguageTool.SENTENCE_END_TAGNAME.equals(analyzedToken.getPOSTag()) && ! PosTagHelper.hasPosTag(analyzedToken, pattern) ) { readings.removeReading(analyzedToken); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException { String path = getRelativePath(req); // Check if webdav is set to read only if (m_readOnly) { resp.setStatus(HttpServletResponse.SC_FORBIDDEN); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_WEBDAV_READ_ONLY_0)); } return; } // Check if resource is locked if (isLocked(req)) { resp.setStatus(CmsWebdavStatus.SC_LOCKED); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ITEM_LOCKED_1, path)); } return; } boolean exists = m_session.exists(path); boolean result = true; // Temp. content file used to support partial PUT File contentFile = null; CmsWebdavRange range = parseContentRange(req, resp); InputStream resourceInputStream = null; // Append data specified in ranges to existing content for this // resource - create a temp. file on the local filesystem to // perform this operation // Assume just one range is specified for now if (range != null) { contentFile = executePartialPut(req, range, path); resourceInputStream = new FileInputStream(contentFile); } else { resourceInputStream = req.getInputStream(); } try { // FIXME: Add attributes(from Apache Tomcat) if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_SAVE_ITEM_0)); } m_session.save(path, resourceInputStream, exists); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_REPOSITORY_ERROR_2, "PUT", path), e); } result = false; resp.setStatus(HttpServletResponse.SC_CONFLICT); } // Bugzilla 40326: at this point content file should be safe to delete // as it's no longer referenced. Let's not rely on deleteOnExit because // it's a memory leak, as noted in this Bugzilla issue. if (contentFile != null) { try { contentFile.delete(); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_DELETE_TEMP_FILE_0), e); } } } if (result) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_SAVE_SUCCESS_0)); } if (exists) { resp.setStatus(HttpServletResponse.SC_NO_CONTENT); } else { resp.setStatus(HttpServletResponse.SC_CREATED); } } } }
public class class_name { @Override protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws IOException { String path = getRelativePath(req); // Check if webdav is set to read only if (m_readOnly) { resp.setStatus(HttpServletResponse.SC_FORBIDDEN); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_WEBDAV_READ_ONLY_0)); // depends on control dependency: [if], data = [none] } return; } // Check if resource is locked if (isLocked(req)) { resp.setStatus(CmsWebdavStatus.SC_LOCKED); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ITEM_LOCKED_1, path)); // depends on control dependency: [if], data = [none] } return; } boolean exists = m_session.exists(path); boolean result = true; // Temp. content file used to support partial PUT File contentFile = null; CmsWebdavRange range = parseContentRange(req, resp); InputStream resourceInputStream = null; // Append data specified in ranges to existing content for this // resource - create a temp. file on the local filesystem to // perform this operation // Assume just one range is specified for now if (range != null) { contentFile = executePartialPut(req, range, path); resourceInputStream = new FileInputStream(contentFile); } else { resourceInputStream = req.getInputStream(); } try { // FIXME: Add attributes(from Apache Tomcat) if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_SAVE_ITEM_0)); } m_session.save(path, resourceInputStream, exists); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_REPOSITORY_ERROR_2, "PUT", path), e); } result = false; resp.setStatus(HttpServletResponse.SC_CONFLICT); } // Bugzilla 40326: at this point content file should be safe to delete // as it's no longer referenced. Let's not rely on deleteOnExit because // it's a memory leak, as noted in this Bugzilla issue. if (contentFile != null) { try { contentFile.delete(); } catch (Exception e) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_DELETE_TEMP_FILE_0), e); } } } if (result) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_SAVE_SUCCESS_0)); } if (exists) { resp.setStatus(HttpServletResponse.SC_NO_CONTENT); } else { resp.setStatus(HttpServletResponse.SC_CREATED); } } } }
public class class_name { @Override public void run() { m_taskQueue.offer(this); // check if previous task is running for more than threshold SiteTasker task = m_taskQueue.peek(); long currentTime = System.nanoTime(); long headOfQueueOfferTime; if (task != null) { headOfQueueOfferTime = task.getQueueOfferTime(); } else { headOfQueueOfferTime = currentTime; } if (headOfQueueOfferTime != m_previousTaskTimestamp) { m_previousTaskTimestamp = headOfQueueOfferTime; m_previousTaskPeekTime = currentTime; } else if (currentTime - m_previousTaskPeekTime >= m_procedureLogThreshold) { long waitTime = (currentTime - m_previousTaskPeekTime)/1_000_000_000L; // in seconds if (m_logger.isDebugEnabled()) { String taskInfo = (task == null) ? "" : " Task Info: " + task.getTaskInfo(); m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.DEBUG, null, TICK_MESSAGE + taskInfo, waitTime, m_partitionId); } else { m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.INFO, null, TICK_MESSAGE, waitTime, m_partitionId); } } } }
public class class_name { @Override public void run() { m_taskQueue.offer(this); // check if previous task is running for more than threshold SiteTasker task = m_taskQueue.peek(); long currentTime = System.nanoTime(); long headOfQueueOfferTime; if (task != null) { headOfQueueOfferTime = task.getQueueOfferTime(); // depends on control dependency: [if], data = [none] } else { headOfQueueOfferTime = currentTime; // depends on control dependency: [if], data = [none] } if (headOfQueueOfferTime != m_previousTaskTimestamp) { m_previousTaskTimestamp = headOfQueueOfferTime; // depends on control dependency: [if], data = [none] m_previousTaskPeekTime = currentTime; // depends on control dependency: [if], data = [none] } else if (currentTime - m_previousTaskPeekTime >= m_procedureLogThreshold) { long waitTime = (currentTime - m_previousTaskPeekTime)/1_000_000_000L; // in seconds if (m_logger.isDebugEnabled()) { String taskInfo = (task == null) ? "" : " Task Info: " + task.getTaskInfo(); m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.DEBUG, null, TICK_MESSAGE + taskInfo, waitTime, m_partitionId); // depends on control dependency: [if], data = [none] } else { m_logger.rateLimitedLog(SUPPRESS_INTERVAL, Level.INFO, null, TICK_MESSAGE, waitTime, m_partitionId); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public PlainTimestamp plus( long amount, ClockUnit unit ) { if (unit == null) { throw new NullPointerException("Missing unit."); } else if (amount == 0) { return this; } try { return CLOCK_UNIT_RULE_MAP.get(unit).addTo(this, amount); } catch (IllegalArgumentException iae) { ArithmeticException ex = new ArithmeticException("Result beyond boundaries of time axis."); ex.initCause(iae); throw ex; } } }
public class class_name { public PlainTimestamp plus( long amount, ClockUnit unit ) { if (unit == null) { throw new NullPointerException("Missing unit."); } else if (amount == 0) { return this; // depends on control dependency: [if], data = [none] } try { return CLOCK_UNIT_RULE_MAP.get(unit).addTo(this, amount); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException iae) { ArithmeticException ex = new ArithmeticException("Result beyond boundaries of time axis."); ex.initCause(iae); throw ex; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private HtmlContainer getOrCreateLayerContainer(Layer layer) { if (layerContainers.containsKey(layer)) { return layerContainers.get(layer); } HtmlContainer layerContainer = new HtmlGroup(); layerContainer.asWidget().getElement().setId(layer.getId()); layersModelContainer.add(layerContainer); layerContainers.put(layer, layerContainer); return layerContainer; } }
public class class_name { private HtmlContainer getOrCreateLayerContainer(Layer layer) { if (layerContainers.containsKey(layer)) { return layerContainers.get(layer); // depends on control dependency: [if], data = [none] } HtmlContainer layerContainer = new HtmlGroup(); layerContainer.asWidget().getElement().setId(layer.getId()); layersModelContainer.add(layerContainer); layerContainers.put(layer, layerContainer); return layerContainer; } }
public class class_name { protected static String replaceShorthand(char c, Map<String, String> headers, TimeZone timeZone, boolean needRounding, int unit, int roundDown, boolean useLocalTimestamp, long ts) { String timestampHeader = null; try { if (!useLocalTimestamp) { timestampHeader = headers.get("timestamp"); Preconditions.checkNotNull(timestampHeader, "Expected timestamp in " + "the Flume event headers, but it was null"); ts = Long.valueOf(timestampHeader); } else { timestampHeader = String.valueOf(ts); } } catch (NumberFormatException e) { throw new RuntimeException("Flume wasn't able to parse timestamp header" + " in the event to resolve time based bucketing. Please check that" + " you're correctly populating timestamp header (for example using" + " TimestampInterceptor source interceptor).", e); } if (needRounding) { ts = roundDown(roundDown, unit, ts, timeZone); } // It's a date String formatString = ""; switch (c) { case '%': return "%"; case 'a': formatString = "EEE"; break; case 'A': formatString = "EEEE"; break; case 'b': formatString = "MMM"; break; case 'B': formatString = "MMMM"; break; case 'c': formatString = "EEE MMM d HH:mm:ss yyyy"; break; case 'd': formatString = "dd"; break; case 'e': formatString = "d"; break; case 'D': formatString = "MM/dd/yy"; break; case 'H': formatString = "HH"; break; case 'I': formatString = "hh"; break; case 'j': formatString = "DDD"; break; case 'k': formatString = "H"; break; case 'l': formatString = "h"; break; case 'm': formatString = "MM"; break; case 'M': formatString = "mm"; break; case 'n': formatString = "M"; break; case 'p': formatString = "a"; break; case 's': return "" + (ts / 1000); case 'S': formatString = "ss"; break; case 't': // This is different from unix date (which would insert a tab character // here) return timestampHeader; case 'y': formatString = "yy"; break; case 'Y': formatString = "yyyy"; break; case 'z': formatString = "ZZZ"; break; default: // LOG.warn("Unrecognized escape in event format string: %" + c); return ""; } SimpleDateFormat format = getSimpleDateFormat(formatString); if (timeZone != null) { format.setTimeZone(timeZone); } else { format.setTimeZone(TimeZone.getDefault()); } Date date = new Date(ts); return format.format(date); } }
public class class_name { protected static String replaceShorthand(char c, Map<String, String> headers, TimeZone timeZone, boolean needRounding, int unit, int roundDown, boolean useLocalTimestamp, long ts) { String timestampHeader = null; try { if (!useLocalTimestamp) { timestampHeader = headers.get("timestamp"); // depends on control dependency: [if], data = [none] Preconditions.checkNotNull(timestampHeader, "Expected timestamp in " + "the Flume event headers, but it was null"); // depends on control dependency: [if], data = [none] ts = Long.valueOf(timestampHeader); // depends on control dependency: [if], data = [none] } else { timestampHeader = String.valueOf(ts); // depends on control dependency: [if], data = [none] } } catch (NumberFormatException e) { throw new RuntimeException("Flume wasn't able to parse timestamp header" + " in the event to resolve time based bucketing. Please check that" + " you're correctly populating timestamp header (for example using" + " TimestampInterceptor source interceptor).", e); } if (needRounding) { ts = roundDown(roundDown, unit, ts, timeZone); } // It's a date String formatString = ""; switch (c) { case '%': return "%"; case 'a': formatString = "EEE"; break; case 'A': formatString = "EEEE"; break; case 'b': formatString = "MMM"; break; case 'B': formatString = "MMMM"; break; case 'c': formatString = "EEE MMM d HH:mm:ss yyyy"; break; case 'd': formatString = "dd"; break; case 'e': formatString = "d"; break; case 'D': formatString = "MM/dd/yy"; break; case 'H': formatString = "HH"; break; case 'I': formatString = "hh"; break; case 'j': formatString = "DDD"; break; case 'k': formatString = "H"; break; case 'l': formatString = "h"; break; case 'm': formatString = "MM"; break; case 'M': formatString = "mm"; break; case 'n': formatString = "M"; break; case 'p': formatString = "a"; break; case 's': return "" + (ts / 1000); case 'S': formatString = "ss"; break; case 't': // This is different from unix date (which would insert a tab character // here) return timestampHeader; case 'y': formatString = "yy"; break; case 'Y': formatString = "yyyy"; break; case 'z': formatString = "ZZZ"; break; default: // LOG.warn("Unrecognized escape in event format string: %" + c); return ""; } // depends on control dependency: [catch], data = [none] SimpleDateFormat format = getSimpleDateFormat(formatString); if (timeZone != null) { format.setTimeZone(timeZone); // depends on control dependency: [if], data = [(timeZone] } else { format.setTimeZone(TimeZone.getDefault()); // depends on control dependency: [if], data = [none] } Date date = new Date(ts); return format.format(date); } }
public class class_name { public boolean isTypeMatch(String commandId, Class targetType) { Assert.notNull(commandId, "commandId"); Assert.notNull(targetType, "targetType"); Class commandType = getType(commandId); if (commandType == null) { return false; } else { return ClassUtils.isAssignable(targetType, commandType); } } }
public class class_name { public boolean isTypeMatch(String commandId, Class targetType) { Assert.notNull(commandId, "commandId"); Assert.notNull(targetType, "targetType"); Class commandType = getType(commandId); if (commandType == null) { return false; // depends on control dependency: [if], data = [none] } else { return ClassUtils.isAssignable(targetType, commandType); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int page(String page, int maxValue) { if (StringUtils.isBlank(page)) { return DEFAULT_MIN_PAGE; } int parseInt = NumUtils.intVal(page); return parseInt <= 0 ? DEFAULT_MIN_PAGE : (parseInt > maxValue ? maxValue : parseInt); } }
public class class_name { public static int page(String page, int maxValue) { if (StringUtils.isBlank(page)) { return DEFAULT_MIN_PAGE; // depends on control dependency: [if], data = [none] } int parseInt = NumUtils.intVal(page); return parseInt <= 0 ? DEFAULT_MIN_PAGE : (parseInt > maxValue ? maxValue : parseInt); } }
public class class_name { @Override public void delete() { final FedoraResource description = getDescription(); if (description != null) { description.delete(); } super.delete(); } }
public class class_name { @Override public void delete() { final FedoraResource description = getDescription(); if (description != null) { description.delete(); // depends on control dependency: [if], data = [none] } super.delete(); } }
public class class_name { public void putInvalidHaltsOnRoads(BusItineraryHalt... restrictionList) { // CAUTION: The connections must be buffered to avoid ConcurrentModificationException on this.invalidHalts final List<Triplet<BusItineraryHalt, Integer, Double>> connectableHalts = new ArrayList<>(); for (final BusItineraryHalt halt : this.invalidHalts) { final BusStop stop = halt.getBusStop(); if (stop != null && (restrictionList == null || restrictionList.length == 0 || ArrayUtil.contains(halt, restrictionList))) { final Point2d position = stop.getPosition2D(); if (position != null) { RoadSegment nearestSegment = null; double smallerDistance = Double.POSITIVE_INFINITY; int nearestSegmentIndex = -1; for (int i = 0; i < this.roadSegments.getRoadSegmentCount(); ++i) { final RoadSegment segment = this.roadSegments.getRoadSegmentAt(i); assert segment != null; final double distance = segment.distance(position); if (distance < smallerDistance) { smallerDistance = distance; nearestSegment = segment; nearestSegmentIndex = i; } } if (nearestSegment != null) { final Point1d pos = nearestSegment.getNearestPosition(position); if (pos != null) { assert nearestSegmentIndex >= 0; connectableHalts.add(new Triplet<>( halt, Integer.valueOf(nearestSegmentIndex), Double.valueOf(pos.getCurvilineCoordinate()))); } } } } } BusItineraryHalt halt; boolean shapeChanged = false; for (final Triplet<BusItineraryHalt, Integer, Double> triplet : connectableHalts) { halt = triplet.getA(); halt.setRoadSegmentIndex(triplet.getB().intValue()); halt.setPositionOnSegment(triplet.getC().doubleValue()); halt.checkPrimitiveValidity(); shapeChanged = true; } if (shapeChanged) { fireShapeChanged(new BusChangeEvent(this, BusChangeEventType.ITINERARY_CHANGED, null, -1, "shape", //$NON-NLS-1$ null, null)); } checkPrimitiveValidity(); } }
public class class_name { public void putInvalidHaltsOnRoads(BusItineraryHalt... restrictionList) { // CAUTION: The connections must be buffered to avoid ConcurrentModificationException on this.invalidHalts final List<Triplet<BusItineraryHalt, Integer, Double>> connectableHalts = new ArrayList<>(); for (final BusItineraryHalt halt : this.invalidHalts) { final BusStop stop = halt.getBusStop(); if (stop != null && (restrictionList == null || restrictionList.length == 0 || ArrayUtil.contains(halt, restrictionList))) { final Point2d position = stop.getPosition2D(); if (position != null) { RoadSegment nearestSegment = null; double smallerDistance = Double.POSITIVE_INFINITY; int nearestSegmentIndex = -1; for (int i = 0; i < this.roadSegments.getRoadSegmentCount(); ++i) { final RoadSegment segment = this.roadSegments.getRoadSegmentAt(i); assert segment != null; final double distance = segment.distance(position); if (distance < smallerDistance) { smallerDistance = distance; // depends on control dependency: [if], data = [none] nearestSegment = segment; // depends on control dependency: [if], data = [none] nearestSegmentIndex = i; // depends on control dependency: [if], data = [none] } } if (nearestSegment != null) { final Point1d pos = nearestSegment.getNearestPosition(position); if (pos != null) { assert nearestSegmentIndex >= 0; connectableHalts.add(new Triplet<>( halt, Integer.valueOf(nearestSegmentIndex), Double.valueOf(pos.getCurvilineCoordinate()))); // depends on control dependency: [if], data = [none] } } } } } BusItineraryHalt halt; boolean shapeChanged = false; for (final Triplet<BusItineraryHalt, Integer, Double> triplet : connectableHalts) { halt = triplet.getA(); // depends on control dependency: [for], data = [triplet] halt.setRoadSegmentIndex(triplet.getB().intValue()); // depends on control dependency: [for], data = [triplet] halt.setPositionOnSegment(triplet.getC().doubleValue()); // depends on control dependency: [for], data = [triplet] halt.checkPrimitiveValidity(); // depends on control dependency: [for], data = [none] shapeChanged = true; // depends on control dependency: [for], data = [none] } if (shapeChanged) { fireShapeChanged(new BusChangeEvent(this, BusChangeEventType.ITINERARY_CHANGED, null, -1, "shape", //$NON-NLS-1$ null, null)); // depends on control dependency: [if], data = [none] } checkPrimitiveValidity(); } }
public class class_name { private String getValueTypeDotString() { PlanNodeType pnt = getPlanNodeType(); if (isInline()) { return "fontcolor=\"white\" style=\"filled\" fillcolor=\"red\""; } if (pnt == PlanNodeType.SEND || pnt == PlanNodeType.RECEIVE || pnt == PlanNodeType.MERGERECEIVE) { return "fontcolor=\"white\" style=\"filled\" fillcolor=\"black\""; } return ""; } }
public class class_name { private String getValueTypeDotString() { PlanNodeType pnt = getPlanNodeType(); if (isInline()) { return "fontcolor=\"white\" style=\"filled\" fillcolor=\"red\""; // depends on control dependency: [if], data = [none] } if (pnt == PlanNodeType.SEND || pnt == PlanNodeType.RECEIVE || pnt == PlanNodeType.MERGERECEIVE) { return "fontcolor=\"white\" style=\"filled\" fillcolor=\"black\""; // depends on control dependency: [if], data = [none] } return ""; } }
public class class_name { public void getValue(String[] valueDestination) { if ( valueDestination.length < value.size()) { Log.e(TAG, "X3D MFString ArrayIndexOutOfBoundsException"); Log.e(TAG, "array size " + valueDestination.length + " < MFString value.size = " + size() ); } else { for (int i = 0; i < valueDestination.length; i++) { valueDestination[i] = get1Value(i); } } } }
public class class_name { public void getValue(String[] valueDestination) { if ( valueDestination.length < value.size()) { Log.e(TAG, "X3D MFString ArrayIndexOutOfBoundsException"); // depends on control dependency: [if], data = [none] Log.e(TAG, "array size " + valueDestination.length + " < MFString value.size = " + size() ); // depends on control dependency: [if], data = [none] } else { for (int i = 0; i < valueDestination.length; i++) { valueDestination[i] = get1Value(i); // depends on control dependency: [for], data = [i] } } } }
public class class_name { private Object setAutoIncrementValue(FieldDescriptor fd, Object obj) { PersistentField f = fd.getPersistentField(); try { // lookup SeqMan for a value matching db column an Object result = m_broker.serviceSequenceManager().getUniqueValue(fd); // reflect autoincrement value back into object f.set(obj, result); return result; } catch(MetadataException e) { throw new PersistenceBrokerException( "Error while trying to autoincrement field " + f.getDeclaringClass() + "#" + f.getName(), e); } catch(SequenceManagerException e) { throw new PersistenceBrokerException("Could not get key value", e); } } }
public class class_name { private Object setAutoIncrementValue(FieldDescriptor fd, Object obj) { PersistentField f = fd.getPersistentField(); try { // lookup SeqMan for a value matching db column an Object result = m_broker.serviceSequenceManager().getUniqueValue(fd); // reflect autoincrement value back into object f.set(obj, result); // depends on control dependency: [try], data = [none] return result; // depends on control dependency: [try], data = [none] } catch(MetadataException e) { throw new PersistenceBrokerException( "Error while trying to autoincrement field " + f.getDeclaringClass() + "#" + f.getName(), e); } // depends on control dependency: [catch], data = [none] catch(SequenceManagerException e) { throw new PersistenceBrokerException("Could not get key value", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public List<? extends SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) { if (checkConformance(t, args)) { @SuppressWarnings("unchecked") List<VM> vms = (List<VM>) params[0].transform(this, t, args.get(0)); @SuppressWarnings("unchecked") Collection<Collection<Node>> nss = (Collection<Collection<Node>>) params[1].transform(this, t, args.get(1)); return vms != null && nss != null ? Collections.singletonList(new Among(vms, nss)) : Collections.emptyList(); } return Collections.emptyList(); } }
public class class_name { @Override public List<? extends SatConstraint> buildConstraint(BtrPlaceTree t, List<BtrpOperand> args) { if (checkConformance(t, args)) { @SuppressWarnings("unchecked") List<VM> vms = (List<VM>) params[0].transform(this, t, args.get(0)); @SuppressWarnings("unchecked") Collection<Collection<Node>> nss = (Collection<Collection<Node>>) params[1].transform(this, t, args.get(1)); return vms != null && nss != null ? Collections.singletonList(new Among(vms, nss)) : Collections.emptyList(); // depends on control dependency: [if], data = [none] } return Collections.emptyList(); } }
public class class_name { public static boolean nameEquals( final XMLStreamReader reader, final String namespace, final String localName) { if (!reader.getLocalName().equals(localName)) { return false; } if (namespace == null) { return true; } final String namespaceURI = reader.getNamespaceURI(); if (namespaceURI == null) { return StringUtils.isEmpty(namespace); } return namespaceURI.equals(StringUtils.defaultString(namespace)); } }
public class class_name { public static boolean nameEquals( final XMLStreamReader reader, final String namespace, final String localName) { if (!reader.getLocalName().equals(localName)) { return false; // depends on control dependency: [if], data = [none] } if (namespace == null) { return true; // depends on control dependency: [if], data = [none] } final String namespaceURI = reader.getNamespaceURI(); if (namespaceURI == null) { return StringUtils.isEmpty(namespace); // depends on control dependency: [if], data = [none] } return namespaceURI.equals(StringUtils.defaultString(namespace)); } }
public class class_name { public boolean createResource(String resource, InputStream is, boolean overwrite) throws Exception { boolean res = true; if (!overwrite) { try { if (queryProperties(resource) != null) { res = false; } } catch (WebDavException e) { if (e.getErrorCode() != IResponse.SC_NOT_FOUND) { throw e; } } } IResponse response = null; try { if (res) { ILocator locator = WebDAVFactory.locatorFactory.newLocator(resource); response = client.put(locator, createContext(), is); if (response.getStatusCode() != IResponse.SC_OK && response.getStatusCode() != IResponse.SC_CREATED) { throw new WebDavException(response); } } } finally { if (response != null) { response.close(); } } return res; } }
public class class_name { public boolean createResource(String resource, InputStream is, boolean overwrite) throws Exception { boolean res = true; if (!overwrite) { try { if (queryProperties(resource) != null) { res = false; // depends on control dependency: [if], data = [none] } } catch (WebDavException e) { if (e.getErrorCode() != IResponse.SC_NOT_FOUND) { throw e; } } // depends on control dependency: [catch], data = [none] } IResponse response = null; try { if (res) { ILocator locator = WebDAVFactory.locatorFactory.newLocator(resource); response = client.put(locator, createContext(), is); // depends on control dependency: [if], data = [none] if (response.getStatusCode() != IResponse.SC_OK && response.getStatusCode() != IResponse.SC_CREATED) { throw new WebDavException(response); } } } finally { if (response != null) { response.close(); // depends on control dependency: [if], data = [none] } } return res; } }
public class class_name { public String getAuthority() { String userInfo = getUserInfo(); StringBuilder auth = new StringBuilder(); if(!"*".equals(userInfo)) { auth.append(userInfo).append("@"); } auth.append('@').append(host).append(':').append(port); return auth.toString(); } }
public class class_name { public String getAuthority() { String userInfo = getUserInfo(); StringBuilder auth = new StringBuilder(); if(!"*".equals(userInfo)) { auth.append(userInfo).append("@"); // depends on control dependency: [if], data = [none] } auth.append('@').append(host).append(':').append(port); return auth.toString(); } }
public class class_name { public boolean setPropertyValue(String propName, String value) { if (OVERRIDE_ACTIVE) { return true; } System.setProperty(propName, value); return true; } }
public class class_name { public boolean setPropertyValue(String propName, String value) { if (OVERRIDE_ACTIVE) { return true; // depends on control dependency: [if], data = [none] } System.setProperty(propName, value); return true; } }
public class class_name { @Override public void saveChanges() { BatchOperation saveChangeOperation = new BatchOperation(this); try (BatchCommand command = saveChangeOperation.createRequest()) { if (command == null) { return; } if (noTracking) { throw new IllegalStateException("Cannot execute saveChanges when entity tracking is disabled in session."); } _requestExecutor.execute(command, sessionInfo); updateSessionAfterSaveChanges(command.getResult()); saveChangeOperation.setResult(command.getResult()); } } }
public class class_name { @Override public void saveChanges() { BatchOperation saveChangeOperation = new BatchOperation(this); try (BatchCommand command = saveChangeOperation.createRequest()) { if (command == null) { return; // depends on control dependency: [if], data = [none] } if (noTracking) { throw new IllegalStateException("Cannot execute saveChanges when entity tracking is disabled in session."); } _requestExecutor.execute(command, sessionInfo); updateSessionAfterSaveChanges(command.getResult()); saveChangeOperation.setResult(command.getResult()); } } }
public class class_name { private void sortByLocation() { this.sresList.setComparator(new ViewerComparator() { @Override public int compare(Viewer viewer, Object e1, Object e2) { if ((e1 instanceof ISREInstall) && (e2 instanceof ISREInstall)) { final ISREInstall left = (ISREInstall) e1; final ISREInstall right = (ISREInstall) e2; return left.getLocation().compareToIgnoreCase(right.getLocation()); } return super.compare(viewer, e1, e2); } @Override public boolean isSorterProperty(Object element, String property) { return true; } }); this.sortColumn = Column.LOCATION; } }
public class class_name { private void sortByLocation() { this.sresList.setComparator(new ViewerComparator() { @Override public int compare(Viewer viewer, Object e1, Object e2) { if ((e1 instanceof ISREInstall) && (e2 instanceof ISREInstall)) { final ISREInstall left = (ISREInstall) e1; final ISREInstall right = (ISREInstall) e2; return left.getLocation().compareToIgnoreCase(right.getLocation()); // depends on control dependency: [if], data = [none] } return super.compare(viewer, e1, e2); } @Override public boolean isSorterProperty(Object element, String property) { return true; } }); this.sortColumn = Column.LOCATION; } }
public class class_name { private void setBatchSize(Object value) { if (value instanceof Integer) { this.couchDBClient.setBatchSize((Integer) value); } else if (value instanceof String) { this.couchDBClient.setBatchSize(Integer.valueOf((String) value)); } } }
public class class_name { private void setBatchSize(Object value) { if (value instanceof Integer) { this.couchDBClient.setBatchSize((Integer) value); // depends on control dependency: [if], data = [none] } else if (value instanceof String) { this.couchDBClient.setBatchSize(Integer.valueOf((String) value)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ListPipelineExecutionsResult withPipelineExecutionSummaries(PipelineExecutionSummary... pipelineExecutionSummaries) { if (this.pipelineExecutionSummaries == null) { setPipelineExecutionSummaries(new java.util.ArrayList<PipelineExecutionSummary>(pipelineExecutionSummaries.length)); } for (PipelineExecutionSummary ele : pipelineExecutionSummaries) { this.pipelineExecutionSummaries.add(ele); } return this; } }
public class class_name { public ListPipelineExecutionsResult withPipelineExecutionSummaries(PipelineExecutionSummary... pipelineExecutionSummaries) { if (this.pipelineExecutionSummaries == null) { setPipelineExecutionSummaries(new java.util.ArrayList<PipelineExecutionSummary>(pipelineExecutionSummaries.length)); // depends on control dependency: [if], data = [none] } for (PipelineExecutionSummary ele : pipelineExecutionSummaries) { this.pipelineExecutionSummaries.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private Set<String> readAparCsvFromArchiveInstall(File installLocation, CommandConsole console) throws ZipException, IOException { // Archive means the CSV will be in a zip within the zip, will need to iterate the content of the install ZIP to find files that match the right pattern ZipFile installZipFile = new ZipFile(installLocation); Enumeration<? extends ZipEntry> zipEntries = installZipFile.entries(); Pattern pattern = Pattern.compile(APAR_FIX_PACK_ZIP_LOCATION_IN_ARCHIVE + "/" + APAR_FIX_PACK_ZIP_FILENAME_PATTERN); /* * Read each file that matches the pattern, note we need to iterate through the archive install location because there might not be a ZIP Entry for the folder containing * the apar IDs */ Set<String> aparIds = new HashSet<String>(); List<IFixInfo> ifixes = new ArrayList<IFixInfo>(); ProductInfo info = null; while (zipEntries.hasMoreElements()) { ZipEntry entry = zipEntries.nextElement(); String entryName = entry.getName(); if (pattern.matcher(entryName).matches()) { // Have a matching zip file so find the CSV file within it ZipInputStream aparZipFileInputStream = new ZipInputStream(installZipFile.getInputStream(entry)); ZipEntry aparCsvEntry = null; do { aparCsvEntry = aparZipFileInputStream.getNextEntry(); } while (aparCsvEntry != null && !APAR_CSV_ENTRY_NAME.equals(aparCsvEntry.getName())); // Null is invalid, if the zip file exists then it should contain this file if (aparCsvEntry == null) { throw new IllegalArgumentException(getMessage("compare.no.csv.entry", installLocation.getAbsolutePath(), entryName, APAR_CSV_ENTRY_NAME)); } String csv = readLine(aparZipFileInputStream); aparIds.addAll(convertCsvToSet(csv)); } else if (entryName.startsWith("wlp/lib/fixes/")) { IFixInfo ifix = IFixUtils.parseIFix(installZipFile.getInputStream(entry), entryName, console); if (ifix != null) { ifixes.add(ifix); } } else if (entryName.startsWith("wlp/lib/versions/") && entryName.endsWith(".properties")) { try { ProductInfo pi = ProductInfo.parseProductInfo(new InputStreamReader(installZipFile.getInputStream(entry), "UTF-8"), null); if (pi != null && "com.ibm.websphere.appserver".equals(pi.getId())) { info = pi; } } catch (ProductInfoParseException e) { // ignore this and move on, it probably wasn't a product info file. } } } installZipFile.close(); Version v = null; if (info == null) { console.printErrorMessage(getMessage("compare.no.was.properties.found")); } else { try { v = convertVersion(info); } catch (VersionParsingException e) { console.printErrorMessage(e.getMessage()); } } for (IFixInfo fix : ifixes) { try { if (v == null || isIFixApplicable(v, fix)) { Resolves resolves = fix.getResolves(); if (resolves != null) { List<Problem> problems = resolves.getProblems(); if (problems != null) { for (Problem problem : resolves.getProblems()) { aparIds.add(problem.getDisplayId()); } } else { console.printErrorMessage(getMessage("compare.no.apar", fix.getId())); } } else { console.printErrorMessage(getMessage("compare.no.apar", fix.getId())); } } } catch (VersionParsingException e) { console.printErrorMessage(e.getMessage()); } } // Read the csv entry return aparIds; } }
public class class_name { private Set<String> readAparCsvFromArchiveInstall(File installLocation, CommandConsole console) throws ZipException, IOException { // Archive means the CSV will be in a zip within the zip, will need to iterate the content of the install ZIP to find files that match the right pattern ZipFile installZipFile = new ZipFile(installLocation); Enumeration<? extends ZipEntry> zipEntries = installZipFile.entries(); Pattern pattern = Pattern.compile(APAR_FIX_PACK_ZIP_LOCATION_IN_ARCHIVE + "/" + APAR_FIX_PACK_ZIP_FILENAME_PATTERN); /* * Read each file that matches the pattern, note we need to iterate through the archive install location because there might not be a ZIP Entry for the folder containing * the apar IDs */ Set<String> aparIds = new HashSet<String>(); List<IFixInfo> ifixes = new ArrayList<IFixInfo>(); ProductInfo info = null; while (zipEntries.hasMoreElements()) { ZipEntry entry = zipEntries.nextElement(); String entryName = entry.getName(); if (pattern.matcher(entryName).matches()) { // Have a matching zip file so find the CSV file within it ZipInputStream aparZipFileInputStream = new ZipInputStream(installZipFile.getInputStream(entry)); ZipEntry aparCsvEntry = null; do { aparCsvEntry = aparZipFileInputStream.getNextEntry(); } while (aparCsvEntry != null && !APAR_CSV_ENTRY_NAME.equals(aparCsvEntry.getName())); // Null is invalid, if the zip file exists then it should contain this file if (aparCsvEntry == null) { throw new IllegalArgumentException(getMessage("compare.no.csv.entry", installLocation.getAbsolutePath(), entryName, APAR_CSV_ENTRY_NAME)); } String csv = readLine(aparZipFileInputStream); aparIds.addAll(convertCsvToSet(csv)); } else if (entryName.startsWith("wlp/lib/fixes/")) { IFixInfo ifix = IFixUtils.parseIFix(installZipFile.getInputStream(entry), entryName, console); if (ifix != null) { ifixes.add(ifix); // depends on control dependency: [if], data = [(ifix] } } else if (entryName.startsWith("wlp/lib/versions/") && entryName.endsWith(".properties")) { try { ProductInfo pi = ProductInfo.parseProductInfo(new InputStreamReader(installZipFile.getInputStream(entry), "UTF-8"), null); if (pi != null && "com.ibm.websphere.appserver".equals(pi.getId())) { info = pi; // depends on control dependency: [if], data = [none] } } catch (ProductInfoParseException e) { // ignore this and move on, it probably wasn't a product info file. } // depends on control dependency: [catch], data = [none] } } installZipFile.close(); Version v = null; if (info == null) { console.printErrorMessage(getMessage("compare.no.was.properties.found")); } else { try { v = convertVersion(info); } catch (VersionParsingException e) { console.printErrorMessage(e.getMessage()); } } for (IFixInfo fix : ifixes) { try { if (v == null || isIFixApplicable(v, fix)) { Resolves resolves = fix.getResolves(); if (resolves != null) { List<Problem> problems = resolves.getProblems(); if (problems != null) { for (Problem problem : resolves.getProblems()) { aparIds.add(problem.getDisplayId()); } } else { console.printErrorMessage(getMessage("compare.no.apar", fix.getId())); } } else { console.printErrorMessage(getMessage("compare.no.apar", fix.getId())); } } } catch (VersionParsingException e) { console.printErrorMessage(e.getMessage()); } } // Read the csv entry return aparIds; } }
public class class_name { public void marshall(UpdateAgentRequest updateAgentRequest, ProtocolMarshaller protocolMarshaller) { if (updateAgentRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateAgentRequest.getAgentArn(), AGENTARN_BINDING); protocolMarshaller.marshall(updateAgentRequest.getName(), NAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateAgentRequest updateAgentRequest, ProtocolMarshaller protocolMarshaller) { if (updateAgentRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateAgentRequest.getAgentArn(), AGENTARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateAgentRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void setHeaders(Map<String, String> headers) { if (headers == null || headers.isEmpty()) { this._headers = null; } else { if (this._headers == null) { this._headers = new HashMap<String, String>(headers); } else { // we want to replace what we had with the new headers this._headers.clear(); this._headers.putAll(headers); } } } }
public class class_name { @Override public void setHeaders(Map<String, String> headers) { if (headers == null || headers.isEmpty()) { this._headers = null; // depends on control dependency: [if], data = [none] } else { if (this._headers == null) { this._headers = new HashMap<String, String>(headers); // depends on control dependency: [if], data = [none] } else { // we want to replace what we had with the new headers this._headers.clear(); // depends on control dependency: [if], data = [none] this._headers.putAll(headers); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Object lookup(Identity oid) { Object ret = null; if (oid != null) { ObjectCache cache = getCache(oid, null, METHOD_LOOKUP); if (cache != null) { ret = cache.lookup(oid); } } return ret; } }
public class class_name { public Object lookup(Identity oid) { Object ret = null; if (oid != null) { ObjectCache cache = getCache(oid, null, METHOD_LOOKUP); if (cache != null) { ret = cache.lookup(oid); // depends on control dependency: [if], data = [none] } } return ret; } }
public class class_name { @Nullable public static StackTraceElement findCallerOf(Class<?> target, Throwable throwable, int skip) { checkNotNull(target, "target"); checkNotNull(throwable, "throwable"); if (skip < 0) { throw new IllegalArgumentException("skip count cannot be negative: " + skip); } // Getting the full stack trace is expensive, so avoid it where possible. StackTraceElement[] stack = (stackGetter != null) ? null : throwable.getStackTrace(); // Note: To avoid having to reflect the getStackTraceDepth() method as well, we assume that we // will find the caller on the stack and simply catch an exception if we fail (which should // hardly ever happen). boolean foundCaller = false; try { for (int index = skip; ; index++) { StackTraceElement element = (stackGetter != null) ? stackGetter.getStackTraceElement(throwable, index) : stack[index]; if (target.getName().equals(element.getClassName())) { foundCaller = true; } else if (foundCaller) { return element; } } } catch (Exception e) { // This should only happen is the caller was not found on the stack (getting exceptions from // the stack trace method should never happen) and it should only be an // IndexOutOfBoundsException, however we don't want _anything_ to be thrown from here. // TODO(dbeaumont): Change to only catch IndexOutOfBoundsException and test _everything_. return null; } } }
public class class_name { @Nullable public static StackTraceElement findCallerOf(Class<?> target, Throwable throwable, int skip) { checkNotNull(target, "target"); checkNotNull(throwable, "throwable"); if (skip < 0) { throw new IllegalArgumentException("skip count cannot be negative: " + skip); } // Getting the full stack trace is expensive, so avoid it where possible. StackTraceElement[] stack = (stackGetter != null) ? null : throwable.getStackTrace(); // Note: To avoid having to reflect the getStackTraceDepth() method as well, we assume that we // will find the caller on the stack and simply catch an exception if we fail (which should // hardly ever happen). boolean foundCaller = false; try { for (int index = skip; ; index++) { StackTraceElement element = (stackGetter != null) ? stackGetter.getStackTraceElement(throwable, index) : stack[index]; if (target.getName().equals(element.getClassName())) { foundCaller = true; // depends on control dependency: [if], data = [none] } else if (foundCaller) { return element; // depends on control dependency: [if], data = [none] } } } catch (Exception e) { // This should only happen is the caller was not found on the stack (getting exceptions from // the stack trace method should never happen) and it should only be an // IndexOutOfBoundsException, however we don't want _anything_ to be thrown from here. // TODO(dbeaumont): Change to only catch IndexOutOfBoundsException and test _everything_. return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void rebuildModifiedBundles() { List<JoinableResourceBundle> bundlesToRebuild = rsHandler.getBundlesToRebuild(); for (JoinableResourceBundle bundle : bundlesToRebuild) { ResourceBundlePathsIterator bundlePaths = this.getBundlePaths(bundle.getId(), new NoCommentCallbackHandler(), Collections.EMPTY_MAP); while (bundlePaths.hasNext()){ BundlePath bundlePath = bundlePaths.next(); cacheMgr.remove(TEXT_CACHE_PREFIX + bundlePath.getPath()); cacheMgr.remove(ZIP_CACHE_PREFIX + bundlePath.getPath()); } } rsHandler.rebuildModifiedBundles(); } }
public class class_name { @Override public void rebuildModifiedBundles() { List<JoinableResourceBundle> bundlesToRebuild = rsHandler.getBundlesToRebuild(); for (JoinableResourceBundle bundle : bundlesToRebuild) { ResourceBundlePathsIterator bundlePaths = this.getBundlePaths(bundle.getId(), new NoCommentCallbackHandler(), Collections.EMPTY_MAP); while (bundlePaths.hasNext()){ BundlePath bundlePath = bundlePaths.next(); cacheMgr.remove(TEXT_CACHE_PREFIX + bundlePath.getPath()); // depends on control dependency: [while], data = [none] cacheMgr.remove(ZIP_CACHE_PREFIX + bundlePath.getPath()); // depends on control dependency: [while], data = [none] } } rsHandler.rebuildModifiedBundles(); } }
public class class_name { @Override public void publish(Event event) { // Check state if (status.get() == STATUS_STOPPED) { return; } // Connected if (event instanceof ConnectedEvent) { if (status.compareAndSet(STATUS_CONNECTING, STATUS_CONNECTED)) { // Redis connection is Ok logger.info("Redis get-set connection are estabilished."); } return; } // Disconnected if (event instanceof DisconnectedEvent) { int s = status.getAndSet(STATUS_DISCONNECTED); if (s != STATUS_DISCONNECTED) { logger.info("Redis get-set connection aborted."); reconnect(); } } } }
public class class_name { @Override public void publish(Event event) { // Check state if (status.get() == STATUS_STOPPED) { return; // depends on control dependency: [if], data = [none] } // Connected if (event instanceof ConnectedEvent) { if (status.compareAndSet(STATUS_CONNECTING, STATUS_CONNECTED)) { // Redis connection is Ok logger.info("Redis get-set connection are estabilished."); // depends on control dependency: [if], data = [none] } return; // depends on control dependency: [if], data = [none] } // Disconnected if (event instanceof DisconnectedEvent) { int s = status.getAndSet(STATUS_DISCONNECTED); if (s != STATUS_DISCONNECTED) { logger.info("Redis get-set connection aborted."); // depends on control dependency: [if], data = [none] reconnect(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public String asString(Object object) { // at this point object is a Date Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); calendar.setTime((Date) object); StringBuilder builder = new StringBuilder(); int year = calendar.get(Calendar.YEAR); if (calendar.get(Calendar.ERA) == 0) { // https://en.wikipedia.org/wiki/ISO_8601 // by convention 1 BC is labeled +0000, 2 BC is labeled −0001, ... if (year > 1) { builder.append('-'); } --year; } builder.append(String.format("%04d", year)); builder.append('-'); builder.append(String.format("%02d", calendar.get(Calendar.MONTH) + 1)); builder.append('-'); builder.append(String.format("%02d", calendar.get(Calendar.DATE))); builder.append('T'); builder.append(String.format("%02d", calendar.get(Calendar.HOUR_OF_DAY))); builder.append(':'); builder.append(String.format("%02d", calendar.get(Calendar.MINUTE))); builder.append(':'); builder.append(String.format("%02d", calendar.get(Calendar.SECOND))); builder.append('Z'); return builder.toString(); } }
public class class_name { @Override public String asString(Object object) { // at this point object is a Date Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); calendar.setTime((Date) object); StringBuilder builder = new StringBuilder(); int year = calendar.get(Calendar.YEAR); if (calendar.get(Calendar.ERA) == 0) { // https://en.wikipedia.org/wiki/ISO_8601 // by convention 1 BC is labeled +0000, 2 BC is labeled −0001, ... if (year > 1) { builder.append('-'); // depends on control dependency: [if], data = [none] } --year; // depends on control dependency: [if], data = [none] } builder.append(String.format("%04d", year)); builder.append('-'); builder.append(String.format("%02d", calendar.get(Calendar.MONTH) + 1)); builder.append('-'); builder.append(String.format("%02d", calendar.get(Calendar.DATE))); builder.append('T'); builder.append(String.format("%02d", calendar.get(Calendar.HOUR_OF_DAY))); builder.append(':'); builder.append(String.format("%02d", calendar.get(Calendar.MINUTE))); builder.append(':'); builder.append(String.format("%02d", calendar.get(Calendar.SECOND))); builder.append('Z'); return builder.toString(); } }
public class class_name { public void startOnInit(Result<I> result) { DeployFactory2<I> builder = builder(); if (builder == null) { result.ok(null); return; } if (! _lifecycle.toInit()) { result.ok(get()); return; } _strategy.startOnInit(this, result); } }
public class class_name { public void startOnInit(Result<I> result) { DeployFactory2<I> builder = builder(); if (builder == null) { result.ok(null); // depends on control dependency: [if], data = [null)] return; // depends on control dependency: [if], data = [none] } if (! _lifecycle.toInit()) { result.ok(get()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } _strategy.startOnInit(this, result); } }
public class class_name { public boolean isForwarded() { Iterator<A_CmsListDialog> i = m_wps.iterator(); while (i.hasNext()) { A_CmsListDialog wp = i.next(); if (wp.isForwarded()) { return true; } } return false; } }
public class class_name { public boolean isForwarded() { Iterator<A_CmsListDialog> i = m_wps.iterator(); while (i.hasNext()) { A_CmsListDialog wp = i.next(); if (wp.isForwarded()) { return true; // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { private void handleRelease() { float speed = Math.max(dragHelper.getDragSpeed(), animationSpeed); if (getTopMargin() > initialMargin || (dragHelper.getDragSpeed() > animationSpeed && dragHelper.getDragDistance() > 0) || (getDeviceType(getContext()) == DeviceType.TABLET && isMaximized() && getTopMargin() > minMargin)) { animateHideView(parentHeight - getTopMargin(), speed, new DecelerateInterpolator(), true); } else { animateShowView(-(getTopMargin() - minMargin), speed, new DecelerateInterpolator()); } } }
public class class_name { private void handleRelease() { float speed = Math.max(dragHelper.getDragSpeed(), animationSpeed); if (getTopMargin() > initialMargin || (dragHelper.getDragSpeed() > animationSpeed && dragHelper.getDragDistance() > 0) || (getDeviceType(getContext()) == DeviceType.TABLET && isMaximized() && getTopMargin() > minMargin)) { animateHideView(parentHeight - getTopMargin(), speed, new DecelerateInterpolator(), true); // depends on control dependency: [if], data = [none] } else { animateShowView(-(getTopMargin() - minMargin), speed, new DecelerateInterpolator()); // depends on control dependency: [if], data = [(getTopMargin()] } } }
public class class_name { @PostMapping(value = "/attributeMapping/semanticsearch", consumes = APPLICATION_JSON_VALUE) @ResponseBody public List<ExplainedAttributeDto> getSemanticSearchAttributeMapping( @RequestBody Map<String, String> requestBody) { String mappingProjectId = requestBody.get("mappingProjectId"); String target = requestBody.get("target"); String source = requestBody.get("source"); String targetAttributeName = requestBody.get("targetAttribute"); String searchTermsString = requestBody.get("searchTerms"); Set<String> searchTerms = new HashSet<>(); if (StringUtils.isNotBlank(searchTermsString)) { searchTerms.addAll( Sets.newHashSet(searchTermsString.toLowerCase().split("\\s+or\\s+")) .stream() .filter(StringUtils::isNotBlank) .map(String::trim) .collect(Collectors.toSet())); } MappingProject project = mappingService.getMappingProject(mappingProjectId); MappingTarget mappingTarget = project.getMappingTarget(target); EntityMapping entityMapping = mappingTarget.getMappingForSource(source); Attribute targetAttribute = entityMapping.getTargetEntityType().getAttribute(targetAttributeName); AttributeSearchResults attributeSearchResults = semanticSearchService.findAttributes( entityMapping.getSourceEntityType(), entityMapping.getTargetEntityType(), targetAttribute, searchTerms); // If no relevant attributes are found, return all source attributes if (attributeSearchResults.getHits().iterator().hasNext()) { return stream(entityMapping.getSourceEntityType().getAtomicAttributes()) .filter(attribute -> attribute.getDataType() != COMPOUND) .map(ExplainedAttributeDto::create) .collect(toList()); } return stream(attributeSearchResults.getHits()) .map(Hit::getResult) .map(this::toExplainedAttributeDto) .collect(toList()); } }
public class class_name { @PostMapping(value = "/attributeMapping/semanticsearch", consumes = APPLICATION_JSON_VALUE) @ResponseBody public List<ExplainedAttributeDto> getSemanticSearchAttributeMapping( @RequestBody Map<String, String> requestBody) { String mappingProjectId = requestBody.get("mappingProjectId"); String target = requestBody.get("target"); String source = requestBody.get("source"); String targetAttributeName = requestBody.get("targetAttribute"); String searchTermsString = requestBody.get("searchTerms"); Set<String> searchTerms = new HashSet<>(); if (StringUtils.isNotBlank(searchTermsString)) { searchTerms.addAll( Sets.newHashSet(searchTermsString.toLowerCase().split("\\s+or\\s+")) .stream() .filter(StringUtils::isNotBlank) .map(String::trim) .collect(Collectors.toSet())); // depends on control dependency: [if], data = [none] } MappingProject project = mappingService.getMappingProject(mappingProjectId); MappingTarget mappingTarget = project.getMappingTarget(target); EntityMapping entityMapping = mappingTarget.getMappingForSource(source); Attribute targetAttribute = entityMapping.getTargetEntityType().getAttribute(targetAttributeName); AttributeSearchResults attributeSearchResults = semanticSearchService.findAttributes( entityMapping.getSourceEntityType(), entityMapping.getTargetEntityType(), targetAttribute, searchTerms); // If no relevant attributes are found, return all source attributes if (attributeSearchResults.getHits().iterator().hasNext()) { return stream(entityMapping.getSourceEntityType().getAtomicAttributes()) .filter(attribute -> attribute.getDataType() != COMPOUND) .map(ExplainedAttributeDto::create) .collect(toList()); // depends on control dependency: [if], data = [none] } return stream(attributeSearchResults.getHits()) .map(Hit::getResult) .map(this::toExplainedAttributeDto) .collect(toList()); } }
public class class_name { public static Geometry reverse(Geometry geometry) { if (geometry == null) { return null; } if (geometry instanceof MultiPoint) { return reverseMultiPoint((MultiPoint) geometry); } return geometry.reverse(); } }
public class class_name { public static Geometry reverse(Geometry geometry) { if (geometry == null) { return null; // depends on control dependency: [if], data = [none] } if (geometry instanceof MultiPoint) { return reverseMultiPoint((MultiPoint) geometry); // depends on control dependency: [if], data = [none] } return geometry.reverse(); } }
public class class_name { public Form createFormContainer(Form formParam) { if(formParam != null && this.serviceTicket != null) { formParam.setServiceTicket(this.serviceTicket); } return new Form(this.putJson( formParam, WS.Path.FormContainer.Version1.formContainerCreate())); } }
public class class_name { public Form createFormContainer(Form formParam) { if(formParam != null && this.serviceTicket != null) { formParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none] } return new Form(this.putJson( formParam, WS.Path.FormContainer.Version1.formContainerCreate())); } }
public class class_name { public static ReseedingSecureRandom create(SecureRandom seeder) { try { return new ReseedingSecureRandom(seeder, SecureRandom.getInstance("SHA1PRNG"), 1 << 30, 55); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("SHA1PRNG must exist in every Java platform implementation.", e); } } }
public class class_name { public static ReseedingSecureRandom create(SecureRandom seeder) { try { return new ReseedingSecureRandom(seeder, SecureRandom.getInstance("SHA1PRNG"), 1 << 30, 55); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("SHA1PRNG must exist in every Java platform implementation.", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public UrlStringBuilder addPath(String... elements) { Validate.noNullElements(elements, "elements cannot be null"); for (final String element : elements) { this.path.add(element); } return this; } }
public class class_name { public UrlStringBuilder addPath(String... elements) { Validate.noNullElements(elements, "elements cannot be null"); for (final String element : elements) { this.path.add(element); // depends on control dependency: [for], data = [element] } return this; } }
public class class_name { @Override public Collection<Realm> getRealms() { ArrayList<Realm> rss = new ArrayList<Realm>(); Set<String> keys = new HashSet<String>(this.realmNameToRealmSet.keySet()); for (String key : keys) { RealmSet rs = this.realmNameToRealmSet.get(key); rss.addAll(rs.values()); } return rss; } }
public class class_name { @Override public Collection<Realm> getRealms() { ArrayList<Realm> rss = new ArrayList<Realm>(); Set<String> keys = new HashSet<String>(this.realmNameToRealmSet.keySet()); for (String key : keys) { RealmSet rs = this.realmNameToRealmSet.get(key); rss.addAll(rs.values()); // depends on control dependency: [for], data = [none] } return rss; } }
public class class_name { public boolean shrink(int maxCapacity) { if (maxCapacity >= array.length) { return false; } array = Arrays.copyOf(array, maxCapacity); return true; } }
public class class_name { public boolean shrink(int maxCapacity) { if (maxCapacity >= array.length) { return false; // depends on control dependency: [if], data = [none] } array = Arrays.copyOf(array, maxCapacity); return true; } }
public class class_name { public void setArgs(java.util.Collection<String> args) { if (args == null) { this.args = null; return; } this.args = new com.amazonaws.internal.SdkInternalList<String>(args); } }
public class class_name { public void setArgs(java.util.Collection<String> args) { if (args == null) { this.args = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.args = new com.amazonaws.internal.SdkInternalList<String>(args); } }
public class class_name { private void getSymmetryAxes(List<Axis> symmAxes, Matrix4d prior, int level, int firstRepeat) { if(level >= getNumLevels() ) { return; } Axis elem = axes.get(level); Matrix4d elemOp = elem.getOperator(); // Current axis: // elementary maps B -> A // prior maps I -> A and J -> B // want J -> I = J -> B -> A <- I= inv(prior) * elementary * prior Matrix4d currAxisOp = new Matrix4d(prior); currAxisOp.invert(); currAxisOp.mul(elemOp); currAxisOp.mul(prior); Axis currAxis = new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat); symmAxes.add(currAxis); //Remember that all degrees are at least 2 getSymmetryAxes(symmAxes,prior,level+1,firstRepeat); //New prior is elementary^d*prior Matrix4d newPrior = new Matrix4d(elemOp); newPrior.mul(prior); int childSize = getNumRepeats(level+1); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize); for(int d=2;d<elem.getOrder();d++) { newPrior.mul(elemOp,newPrior); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize*d); } } }
public class class_name { private void getSymmetryAxes(List<Axis> symmAxes, Matrix4d prior, int level, int firstRepeat) { if(level >= getNumLevels() ) { return; // depends on control dependency: [if], data = [none] } Axis elem = axes.get(level); Matrix4d elemOp = elem.getOperator(); // Current axis: // elementary maps B -> A // prior maps I -> A and J -> B // want J -> I = J -> B -> A <- I= inv(prior) * elementary * prior Matrix4d currAxisOp = new Matrix4d(prior); currAxisOp.invert(); currAxisOp.mul(elemOp); currAxisOp.mul(prior); Axis currAxis = new Axis(currAxisOp,elem.getOrder(),elem.getSymmType(),level,firstRepeat); symmAxes.add(currAxis); //Remember that all degrees are at least 2 getSymmetryAxes(symmAxes,prior,level+1,firstRepeat); //New prior is elementary^d*prior Matrix4d newPrior = new Matrix4d(elemOp); newPrior.mul(prior); int childSize = getNumRepeats(level+1); getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize); for(int d=2;d<elem.getOrder();d++) { newPrior.mul(elemOp,newPrior); // depends on control dependency: [for], data = [none] getSymmetryAxes(symmAxes,newPrior,level+1,firstRepeat+childSize*d); // depends on control dependency: [for], data = [d] } } }
public class class_name { public void execute( EnforcerRuleHelper helper ) throws EnforcerRuleException { EnforcerRuleUtils utils = new EnforcerRuleUtils( helper ); MavenProject project; try { project = (MavenProject) helper.evaluate( "${project}" ); List<Model> models = utils.getModelsRecursively( project.getGroupId(), project.getArtifactId(), project.getVersion(), new File( project.getBasedir(), "pom.xml" ) ); List<Model> badModels = new ArrayList<Model>(); StringBuffer newMsg = new StringBuffer(); newMsg.append( "Some poms have repositories defined:\n" ); for ( Model model : models ) { if ( banRepositories ) { @SuppressWarnings( "unchecked" ) List<Repository> repos = model.getRepositories(); if ( repos != null && !repos.isEmpty() ) { List<String> bannedRepos = findBannedRepositories( repos, allowedRepositories, allowSnapshotRepositories ); if ( !bannedRepos.isEmpty() ) { badModels.add( model ); newMsg.append( model.getGroupId() + ":" + model.getArtifactId() + " version:" + model.getVersion() + " has repositories " + bannedRepos ); } } } if ( banPluginRepositories ) { @SuppressWarnings( "unchecked" ) List<Repository> repos = model.getPluginRepositories(); if ( repos != null && !repos.isEmpty() ) { List<String> bannedRepos = findBannedRepositories( repos, allowedPluginRepositories, allowSnapshotPluginRepositories ); if ( !bannedRepos.isEmpty() ) { badModels.add( model ); newMsg.append( model.getGroupId() + ":" + model.getArtifactId() + " version:" + model.getVersion() + " has plugin repositories " + bannedRepos ); } } } } // if anything was found, log it then append the // optional message. if ( !badModels.isEmpty() ) { String message = getMessage(); if ( StringUtils.isNotEmpty( message ) ) { newMsg.append( message ); } throw new EnforcerRuleException( newMsg.toString() ); } } catch ( ExpressionEvaluationException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } catch ( ArtifactResolutionException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } catch ( ArtifactNotFoundException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } catch ( IOException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } catch ( XmlPullParserException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } } }
public class class_name { public void execute( EnforcerRuleHelper helper ) throws EnforcerRuleException { EnforcerRuleUtils utils = new EnforcerRuleUtils( helper ); MavenProject project; try { project = (MavenProject) helper.evaluate( "${project}" ); List<Model> models = utils.getModelsRecursively( project.getGroupId(), project.getArtifactId(), project.getVersion(), new File( project.getBasedir(), "pom.xml" ) ); List<Model> badModels = new ArrayList<Model>(); StringBuffer newMsg = new StringBuffer(); newMsg.append( "Some poms have repositories defined:\n" ); for ( Model model : models ) { if ( banRepositories ) { @SuppressWarnings( "unchecked" ) List<Repository> repos = model.getRepositories(); if ( repos != null && !repos.isEmpty() ) { List<String> bannedRepos = findBannedRepositories( repos, allowedRepositories, allowSnapshotRepositories ); if ( !bannedRepos.isEmpty() ) { badModels.add( model ); // depends on control dependency: [if], data = [none] newMsg.append( model.getGroupId() + ":" + model.getArtifactId() + " version:" + model.getVersion() + " has repositories " + bannedRepos ); // depends on control dependency: [if], data = [none] } } } if ( banPluginRepositories ) { @SuppressWarnings( "unchecked" ) List<Repository> repos = model.getPluginRepositories(); if ( repos != null && !repos.isEmpty() ) { List<String> bannedRepos = findBannedRepositories( repos, allowedPluginRepositories, allowSnapshotPluginRepositories ); if ( !bannedRepos.isEmpty() ) { badModels.add( model ); // depends on control dependency: [if], data = [none] newMsg.append( model.getGroupId() + ":" + model.getArtifactId() + " version:" + model.getVersion() + " has plugin repositories " + bannedRepos ); // depends on control dependency: [if], data = [none] } } } } // if anything was found, log it then append the // optional message. if ( !badModels.isEmpty() ) { String message = getMessage(); if ( StringUtils.isNotEmpty( message ) ) { newMsg.append( message ); } throw new EnforcerRuleException( newMsg.toString() ); } } catch ( ExpressionEvaluationException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } catch ( ArtifactResolutionException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } catch ( ArtifactNotFoundException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } catch ( IOException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } catch ( XmlPullParserException e ) { throw new EnforcerRuleException( e.getLocalizedMessage() ); } } }
public class class_name { public final void sinkEvents(Widget widget, Set<String> typeNames) { if (typeNames == null) { return; } int eventsToSink = 0; for (String typeName : typeNames) { int typeInt = Event.getTypeInt(typeName); if (typeInt < 0) { widget.sinkBitlessEvent(typeName); } else { typeInt = sinkEvent(widget, typeName); if (typeInt > 0) { eventsToSink |= typeInt; } } } if (eventsToSink > 0) { widget.sinkEvents(eventsToSink); } } }
public class class_name { public final void sinkEvents(Widget widget, Set<String> typeNames) { if (typeNames == null) { return; // depends on control dependency: [if], data = [none] } int eventsToSink = 0; for (String typeName : typeNames) { int typeInt = Event.getTypeInt(typeName); if (typeInt < 0) { widget.sinkBitlessEvent(typeName); // depends on control dependency: [if], data = [none] } else { typeInt = sinkEvent(widget, typeName); // depends on control dependency: [if], data = [none] if (typeInt > 0) { eventsToSink |= typeInt; // depends on control dependency: [if], data = [none] } } } if (eventsToSink > 0) { widget.sinkEvents(eventsToSink); // depends on control dependency: [if], data = [(eventsToSink] } } }
public class class_name { public HttpField remove(HttpHeader name) { HttpField removed = null; for (int i = _size; i-- > 0; ) { HttpField f = _fields[i]; if (f.getHeader() == name) { removed = f; System.arraycopy(_fields, i + 1, _fields, i, --_size - i); } } return removed; } }
public class class_name { public HttpField remove(HttpHeader name) { HttpField removed = null; for (int i = _size; i-- > 0; ) { HttpField f = _fields[i]; if (f.getHeader() == name) { removed = f; // depends on control dependency: [if], data = [none] System.arraycopy(_fields, i + 1, _fields, i, --_size - i); // depends on control dependency: [if], data = [none] } } return removed; } }
public class class_name { @Override public void serviceRequest(final Request request) { String triggerId = request.getParameter(WServlet.AJAX_TRIGGER_PARAM_NAME); AjaxOperation ajaxOperation = AjaxHelper.getCurrentOperation(); if (ajaxOperation == null) { throw new IllegalStateException( "No AJAX operation available for trigger " + triggerId + "."); } ComponentWithContext triggerWithContext = AjaxHelper.getCurrentTriggerAndContext(); if (triggerWithContext == null) { throw new IllegalStateException( "No component/context available for AJAX trigger " + triggerId + "."); } UIContext uic = UIContextHolder.getCurrent(); // Reset the focus for this new request. uic.setFocussed(null, null); // We've hit the action phase, so we do want focus on this app. uic.setFocusRequired(true); // Process trigger only if (isProcessTriggerOnly(triggerWithContext, ajaxOperation)) { // Get user context UIContext tuic = triggerWithContext.getContext(); UIContextHolder.pushContext(tuic); try { WComponent trigger = triggerWithContext.getComponent(); trigger.serviceRequest(request); // Manually invoke laters as the InvokeLaters in the service request is not run due to the trigger // having a "parent" tuic.doInvokeLaters(); } finally { UIContextHolder.popContext(); } } else if ("GET".equals(request.getMethod())) { // GET only supports the above scenarios throw new IllegalStateException( "GET is not supported for the AJAX trigger " + triggerId + "."); } else { // service the request super.serviceRequest(request); } } }
public class class_name { @Override public void serviceRequest(final Request request) { String triggerId = request.getParameter(WServlet.AJAX_TRIGGER_PARAM_NAME); AjaxOperation ajaxOperation = AjaxHelper.getCurrentOperation(); if (ajaxOperation == null) { throw new IllegalStateException( "No AJAX operation available for trigger " + triggerId + "."); } ComponentWithContext triggerWithContext = AjaxHelper.getCurrentTriggerAndContext(); if (triggerWithContext == null) { throw new IllegalStateException( "No component/context available for AJAX trigger " + triggerId + "."); } UIContext uic = UIContextHolder.getCurrent(); // Reset the focus for this new request. uic.setFocussed(null, null); // We've hit the action phase, so we do want focus on this app. uic.setFocusRequired(true); // Process trigger only if (isProcessTriggerOnly(triggerWithContext, ajaxOperation)) { // Get user context UIContext tuic = triggerWithContext.getContext(); UIContextHolder.pushContext(tuic); // depends on control dependency: [if], data = [none] try { WComponent trigger = triggerWithContext.getComponent(); trigger.serviceRequest(request); // Manually invoke laters as the InvokeLaters in the service request is not run due to the trigger // having a "parent" tuic.doInvokeLaters(); // depends on control dependency: [try], data = [none] } finally { UIContextHolder.popContext(); } } else if ("GET".equals(request.getMethod())) { // GET only supports the above scenarios throw new IllegalStateException( "GET is not supported for the AJAX trigger " + triggerId + "."); } else { // service the request super.serviceRequest(request); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected HttpClient getHttpClient(){ HttpClientBuilder builder = HttpClientBuilder.create(); if(proxyHost != null && proxyPort != 0) { HttpHost proxy = new HttpHost(proxyHost, proxyPort); DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy); builder.setRoutePlanner(routePlanner); } RequestConfig.Builder config = RequestConfig.custom() .setConnectTimeout(timeout) .setConnectionRequestTimeout(timeout) .setSocketTimeout(timeout); builder.setDefaultRequestConfig(config.build()); return builder.build(); } }
public class class_name { protected HttpClient getHttpClient(){ HttpClientBuilder builder = HttpClientBuilder.create(); if(proxyHost != null && proxyPort != 0) { HttpHost proxy = new HttpHost(proxyHost, proxyPort); DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy); builder.setRoutePlanner(routePlanner); // depends on control dependency: [if], data = [none] } RequestConfig.Builder config = RequestConfig.custom() .setConnectTimeout(timeout) .setConnectionRequestTimeout(timeout) .setSocketTimeout(timeout); builder.setDefaultRequestConfig(config.build()); return builder.build(); } }
public class class_name { static int hashCodeAsciiSafe(byte[] bytes, int startPos, int length) { int hash = HASH_CODE_ASCII_SEED; final int remainingBytes = length & 7; final int end = startPos + remainingBytes; for (int i = startPos - 8 + length; i >= end; i -= 8) { hash = PlatformDependent0.hashCodeAsciiCompute(getLongSafe(bytes, i), hash); } switch(remainingBytes) { case 7: return ((hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos])) * HASH_CODE_C2 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos + 1))) * HASH_CODE_C1 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos + 3)); case 6: return (hash * HASH_CODE_C1 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos))) * HASH_CODE_C2 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos + 2)); case 5: return (hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos])) * HASH_CODE_C2 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos + 1)); case 4: return hash * HASH_CODE_C1 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos)); case 3: return (hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos])) * HASH_CODE_C2 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos + 1)); case 2: return hash * HASH_CODE_C1 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos)); case 1: return hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos]); default: return hash; } } }
public class class_name { static int hashCodeAsciiSafe(byte[] bytes, int startPos, int length) { int hash = HASH_CODE_ASCII_SEED; final int remainingBytes = length & 7; final int end = startPos + remainingBytes; for (int i = startPos - 8 + length; i >= end; i -= 8) { hash = PlatformDependent0.hashCodeAsciiCompute(getLongSafe(bytes, i), hash); // depends on control dependency: [for], data = [i] } switch(remainingBytes) { case 7: return ((hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos])) * HASH_CODE_C2 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos + 1))) * HASH_CODE_C1 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos + 3)); case 6: return (hash * HASH_CODE_C1 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos))) * HASH_CODE_C2 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos + 2)); case 5: return (hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos])) * HASH_CODE_C2 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos + 1)); case 4: return hash * HASH_CODE_C1 + hashCodeAsciiSanitize(getIntSafe(bytes, startPos)); case 3: return (hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos])) * HASH_CODE_C2 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos + 1)); case 2: return hash * HASH_CODE_C1 + hashCodeAsciiSanitize(getShortSafe(bytes, startPos)); case 1: return hash * HASH_CODE_C1 + hashCodeAsciiSanitize(bytes[startPos]); default: return hash; } } }
public class class_name { public boolean isEmpty() { switch(size()) { case 0: return true; case 1: Element element = (Element) get(0); if (element.type() == Element.CHUNK && ((Chunk) element).isEmpty()) { return true; } return false; default: return false; } } }
public class class_name { public boolean isEmpty() { switch(size()) { case 0: return true; case 1: Element element = (Element) get(0); if (element.type() == Element.CHUNK && ((Chunk) element).isEmpty()) { return true; // depends on control dependency: [if], data = [none] } return false; default: return false; } } }
public class class_name { public static List<String> regexGroups(Pattern regex, String str) { if (str == null) { return null; } Matcher matcher = regex.matcher(str); if (!matcher.find()) { return null; } List<String> groups = new ArrayList<String>(); for (int index = 1; index <= matcher.groupCount(); index++) { groups.add(matcher.group(index)); } return groups; } }
public class class_name { public static List<String> regexGroups(Pattern regex, String str) { if (str == null) { return null; // depends on control dependency: [if], data = [none] } Matcher matcher = regex.matcher(str); if (!matcher.find()) { return null; // depends on control dependency: [if], data = [none] } List<String> groups = new ArrayList<String>(); for (int index = 1; index <= matcher.groupCount(); index++) { groups.add(matcher.group(index)); // depends on control dependency: [for], data = [index] } return groups; } }
public class class_name { protected KeyRecord getKeyRecord (int keyCode) { KeyRecord krec = _keys.get(keyCode); if (krec == null) { krec = new KeyRecord(); _keys.put(keyCode, krec); } return krec; } }
public class class_name { protected KeyRecord getKeyRecord (int keyCode) { KeyRecord krec = _keys.get(keyCode); if (krec == null) { krec = new KeyRecord(); // depends on control dependency: [if], data = [none] _keys.put(keyCode, krec); // depends on control dependency: [if], data = [none] } return krec; } }
public class class_name { private Transformer createTransformer(boolean indent) { try { Transformer result = this.transformerFactory.newTransformer(); if (indent) { result.setOutputProperty(OutputKeys.INDENT, "yes"); } return result; } catch (TransformerConfigurationException e) { throw new IllegalStateException("XML Transformer misconfigured!" + " Probably your JVM does not support the required JAXP version!", e); } } }
public class class_name { private Transformer createTransformer(boolean indent) { try { Transformer result = this.transformerFactory.newTransformer(); if (indent) { result.setOutputProperty(OutputKeys.INDENT, "yes"); // depends on control dependency: [if], data = [none] } return result; // depends on control dependency: [try], data = [none] } catch (TransformerConfigurationException e) { throw new IllegalStateException("XML Transformer misconfigured!" + " Probably your JVM does not support the required JAXP version!", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static RuntimeException multiple(Throwable... throwables) { CompositeException multiple = new CompositeException(); //noinspection ConstantConditions if (throwables != null) { for (Throwable t : throwables) { //this is ok, multiple is always a new non-singleton instance multiple.addSuppressed(t); } } return multiple; } }
public class class_name { public static RuntimeException multiple(Throwable... throwables) { CompositeException multiple = new CompositeException(); //noinspection ConstantConditions if (throwables != null) { for (Throwable t : throwables) { //this is ok, multiple is always a new non-singleton instance multiple.addSuppressed(t); // depends on control dependency: [for], data = [t] } } return multiple; } }
public class class_name { private static String extendRepeating(String e, String max) { String[] parts = e.split(","); for (int i = 0; i < parts.length; ++i) { if (parts[i].indexOf('-') == -1 && parts[i].indexOf('*') == -1) { int indSlash = parts[i].indexOf('/'); if (indSlash == 0) { parts[i] = "*" + parts[i]; } else if (indSlash > 0) { parts[i] = parts[i].substring(0, indSlash) + "-" + max + parts[i].substring(indSlash); } } } return concat(',', parts); } }
public class class_name { private static String extendRepeating(String e, String max) { String[] parts = e.split(","); for (int i = 0; i < parts.length; ++i) { if (parts[i].indexOf('-') == -1 && parts[i].indexOf('*') == -1) { int indSlash = parts[i].indexOf('/'); if (indSlash == 0) { parts[i] = "*" + parts[i]; // depends on control dependency: [if], data = [none] } else if (indSlash > 0) { parts[i] = parts[i].substring(0, indSlash) + "-" + max + parts[i].substring(indSlash); // depends on control dependency: [if], data = [(indSlash] } } } return concat(',', parts); } }
public class class_name { public boolean isConstraintError(SQLException e) { if (e != null) { String sqlstate = e.getSQLState(); if (sqlstate != null) { return sqlstate.startsWith(SQLSTATE_CONSTRAINT_VIOLATION_CLASS_CODE); } } return false; } }
public class class_name { public boolean isConstraintError(SQLException e) { if (e != null) { String sqlstate = e.getSQLState(); if (sqlstate != null) { return sqlstate.startsWith(SQLSTATE_CONSTRAINT_VIOLATION_CLASS_CODE); // depends on control dependency: [if], data = [none] } } return false; } }
public class class_name { public Set tokens() { if (tokenSet == null) { tokenSet = new AbstractSetView() { public long size() throws ObjectManagerException { return directory.size(); } // size(). public Iterator iterator() throws ObjectManagerException { final Iterator storeAreaIterator = directory.entrySet().iterator(); return new Iterator() { public boolean hasNext() throws ObjectManagerException { return storeAreaIterator.hasNext(); } // hasNext(). public Object next() throws ObjectManagerException { Directory.StoreArea storeArea = (Directory.StoreArea) storeAreaIterator.next(); Token token = new Token(AbstractSingleFileObjectStore.this, storeArea.identifier); return like(token); } // next(). public boolean hasNext(Transaction transaction) throws ObjectManagerException { throw new UnsupportedOperationException(); } // hasNext(). public Object next(Transaction transaction) throws ObjectManagerException { throw new UnsupportedOperationException(); } // next(). public Object remove(Transaction transaction) throws ObjectManagerException { throw new UnsupportedOperationException(); } // remove(). }; // new Iterator(). } // iterator(). }; // new AbstractSetView(). } // if (tokenSet == null). return tokenSet; } }
public class class_name { public Set tokens() { if (tokenSet == null) { tokenSet = new AbstractSetView() { public long size() throws ObjectManagerException { return directory.size(); } // size(). // depends on control dependency: [if], data = [none] public Iterator iterator() throws ObjectManagerException { final Iterator storeAreaIterator = directory.entrySet().iterator(); return new Iterator() { public boolean hasNext() throws ObjectManagerException { return storeAreaIterator.hasNext(); } // hasNext(). public Object next() throws ObjectManagerException { Directory.StoreArea storeArea = (Directory.StoreArea) storeAreaIterator.next(); Token token = new Token(AbstractSingleFileObjectStore.this, storeArea.identifier); return like(token); } // next(). public boolean hasNext(Transaction transaction) throws ObjectManagerException { throw new UnsupportedOperationException(); } // hasNext(). public Object next(Transaction transaction) throws ObjectManagerException { throw new UnsupportedOperationException(); } // next(). public Object remove(Transaction transaction) throws ObjectManagerException { throw new UnsupportedOperationException(); } // remove(). }; // new Iterator(). } // iterator(). }; // new AbstractSetView(). } // if (tokenSet == null). return tokenSet; } }
public class class_name { @Override public ExternalEventAggregationConfiguration exportData(String id) { final ExternalEventAggregationConfiguration externalData = new ExternalEventAggregationConfiguration(); // Copy interval configs final List<ExternalAggregatedIntervalConfig> aggregatedIntervalConfigs = externalData.getAggregatedIntervalConfigs(); for (final AggregatedIntervalConfig aggregatedIntervalConfig : this.aggregationManagementDao.getAggregatedIntervalConfigs()) { final ExternalAggregatedIntervalConfig externalIntervalConfig = new ExternalAggregatedIntervalConfig(); externalIntervalConfig.setAggregatorType( aggregatedIntervalConfig.getAggregatorType().getName()); final List<ExternalAggregationInterval> extIncludes = externalIntervalConfig.getIncludes(); for (final AggregationInterval interval : aggregatedIntervalConfig.getIncluded()) { extIncludes.add(convert(interval)); } Collections.sort(extIncludes, EnumNameComparator.INSTANCE); final List<ExternalAggregationInterval> extExcludes = externalIntervalConfig.getExcludes(); for (final AggregationInterval interval : aggregatedIntervalConfig.getExcluded()) { extExcludes.add(convert(interval)); } Collections.sort(extExcludes, EnumNameComparator.INSTANCE); aggregatedIntervalConfigs.add(externalIntervalConfig); } Collections.sort( aggregatedIntervalConfigs, ExternalAggregatedDimensionConfigComparator.INSTANCE); // Copy group configs final List<ExternalAggregatedGroupConfig> aggregatedGroupConfigs = externalData.getAggregatedGroupConfigs(); for (final AggregatedGroupConfig aggregatedGroupConfig : this.aggregationManagementDao.getAggregatedGroupConfigs()) { final ExternalAggregatedGroupConfig externalGroupConfig = new ExternalAggregatedGroupConfig(); externalGroupConfig.setAggregatorType( aggregatedGroupConfig.getAggregatorType().getName()); final List<ExternalAggregatedGroupMapping> extIncludes = externalGroupConfig.getIncludes(); for (final AggregatedGroupMapping Group : aggregatedGroupConfig.getIncluded()) { extIncludes.add(convert(Group)); } Collections.sort(extIncludes, ExternalAggregatedGroupMappingComparator.INSTANCE); final List<ExternalAggregatedGroupMapping> extExcludes = externalGroupConfig.getExcludes(); for (final AggregatedGroupMapping Group : aggregatedGroupConfig.getExcluded()) { extExcludes.add(convert(Group)); } Collections.sort(extExcludes, ExternalAggregatedGroupMappingComparator.INSTANCE); aggregatedGroupConfigs.add(externalGroupConfig); } Collections.sort( aggregatedGroupConfigs, ExternalAggregatedDimensionConfigComparator.INSTANCE); // Copy term details final List<ExternalTermDetail> externalTermDetails = externalData.getTermDetails(); for (final AcademicTermDetail academicTermDetail : this.aggregationManagementDao.getAcademicTermDetails()) { final ExternalTermDetail externalTermDetail = new ExternalTermDetail(); externalTermDetail.setName(academicTermDetail.getTermName()); externalTermDetail.setStart(academicTermDetail.getStart().toGregorianCalendar()); externalTermDetail.setEnd(academicTermDetail.getEnd().toGregorianCalendar()); externalTermDetails.add(externalTermDetail); } Collections.sort(externalTermDetails, ExternalTermDetailComparator.INSTANCE); // Copy quarter details final List<ExternalQuarterDetail> quarterDetails = externalData.getQuarterDetails(); for (final QuarterDetail quarterDetail : this.aggregationManagementDao.getQuartersDetails()) { final ExternalQuarterDetail externalQuarterDetail = new ExternalQuarterDetail(); externalQuarterDetail.setId(quarterDetail.getQuarterId()); externalQuarterDetail.setStart(quarterDetail.getStart().toString()); externalQuarterDetail.setEnd(quarterDetail.getEnd().toString()); quarterDetails.add(externalQuarterDetail); } Collections.sort(quarterDetails, ExternalQuarterDetailComparator.INSTANCE); return externalData; } }
public class class_name { @Override public ExternalEventAggregationConfiguration exportData(String id) { final ExternalEventAggregationConfiguration externalData = new ExternalEventAggregationConfiguration(); // Copy interval configs final List<ExternalAggregatedIntervalConfig> aggregatedIntervalConfigs = externalData.getAggregatedIntervalConfigs(); for (final AggregatedIntervalConfig aggregatedIntervalConfig : this.aggregationManagementDao.getAggregatedIntervalConfigs()) { final ExternalAggregatedIntervalConfig externalIntervalConfig = new ExternalAggregatedIntervalConfig(); externalIntervalConfig.setAggregatorType( aggregatedIntervalConfig.getAggregatorType().getName()); // depends on control dependency: [for], data = [none] final List<ExternalAggregationInterval> extIncludes = externalIntervalConfig.getIncludes(); for (final AggregationInterval interval : aggregatedIntervalConfig.getIncluded()) { extIncludes.add(convert(interval)); // depends on control dependency: [for], data = [interval] } Collections.sort(extIncludes, EnumNameComparator.INSTANCE); // depends on control dependency: [for], data = [none] final List<ExternalAggregationInterval> extExcludes = externalIntervalConfig.getExcludes(); for (final AggregationInterval interval : aggregatedIntervalConfig.getExcluded()) { extExcludes.add(convert(interval)); // depends on control dependency: [for], data = [interval] } Collections.sort(extExcludes, EnumNameComparator.INSTANCE); // depends on control dependency: [for], data = [none] aggregatedIntervalConfigs.add(externalIntervalConfig); // depends on control dependency: [for], data = [aggregatedIntervalConfig] } Collections.sort( aggregatedIntervalConfigs, ExternalAggregatedDimensionConfigComparator.INSTANCE); // Copy group configs final List<ExternalAggregatedGroupConfig> aggregatedGroupConfigs = externalData.getAggregatedGroupConfigs(); for (final AggregatedGroupConfig aggregatedGroupConfig : this.aggregationManagementDao.getAggregatedGroupConfigs()) { final ExternalAggregatedGroupConfig externalGroupConfig = new ExternalAggregatedGroupConfig(); externalGroupConfig.setAggregatorType( aggregatedGroupConfig.getAggregatorType().getName()); // depends on control dependency: [for], data = [none] final List<ExternalAggregatedGroupMapping> extIncludes = externalGroupConfig.getIncludes(); for (final AggregatedGroupMapping Group : aggregatedGroupConfig.getIncluded()) { extIncludes.add(convert(Group)); // depends on control dependency: [for], data = [Group] } Collections.sort(extIncludes, ExternalAggregatedGroupMappingComparator.INSTANCE); // depends on control dependency: [for], data = [none] final List<ExternalAggregatedGroupMapping> extExcludes = externalGroupConfig.getExcludes(); for (final AggregatedGroupMapping Group : aggregatedGroupConfig.getExcluded()) { extExcludes.add(convert(Group)); // depends on control dependency: [for], data = [Group] } Collections.sort(extExcludes, ExternalAggregatedGroupMappingComparator.INSTANCE); // depends on control dependency: [for], data = [none] aggregatedGroupConfigs.add(externalGroupConfig); // depends on control dependency: [for], data = [aggregatedGroupConfig] } Collections.sort( aggregatedGroupConfigs, ExternalAggregatedDimensionConfigComparator.INSTANCE); // Copy term details final List<ExternalTermDetail> externalTermDetails = externalData.getTermDetails(); for (final AcademicTermDetail academicTermDetail : this.aggregationManagementDao.getAcademicTermDetails()) { final ExternalTermDetail externalTermDetail = new ExternalTermDetail(); externalTermDetail.setName(academicTermDetail.getTermName()); // depends on control dependency: [for], data = [academicTermDetail] externalTermDetail.setStart(academicTermDetail.getStart().toGregorianCalendar()); // depends on control dependency: [for], data = [academicTermDetail] externalTermDetail.setEnd(academicTermDetail.getEnd().toGregorianCalendar()); // depends on control dependency: [for], data = [academicTermDetail] externalTermDetails.add(externalTermDetail); // depends on control dependency: [for], data = [none] } Collections.sort(externalTermDetails, ExternalTermDetailComparator.INSTANCE); // Copy quarter details final List<ExternalQuarterDetail> quarterDetails = externalData.getQuarterDetails(); for (final QuarterDetail quarterDetail : this.aggregationManagementDao.getQuartersDetails()) { final ExternalQuarterDetail externalQuarterDetail = new ExternalQuarterDetail(); externalQuarterDetail.setId(quarterDetail.getQuarterId()); // depends on control dependency: [for], data = [quarterDetail] externalQuarterDetail.setStart(quarterDetail.getStart().toString()); // depends on control dependency: [for], data = [quarterDetail] externalQuarterDetail.setEnd(quarterDetail.getEnd().toString()); // depends on control dependency: [for], data = [quarterDetail] quarterDetails.add(externalQuarterDetail); // depends on control dependency: [for], data = [quarterDetail] } Collections.sort(quarterDetails, ExternalQuarterDetailComparator.INSTANCE); return externalData; } }
public class class_name { @SuppressWarnings("unchecked") @Override protected void performValidation(String path, Object value, List<ValidationResult> results) { String name = path != null ? path : "value"; value = ObjectReader.getValue(value); super.performValidation(path, value, results); if (value == null) return; if (value instanceof List<?>) { List<Object> list = (List<Object>) value; int index = 0; for (Object element : list) { String elementPath = path == null || path.length() == 0 ? Integer.toString(index) : path + "." + index; performTypeValidation(elementPath, _valueType, element, results); index++; } } else if (value.getClass().isArray()) { int length = Array.getLength(value); for (int index = 0; index < length; index++) { Object element = Array.get(value, index); String elementPath = path == null || path.length() == 0 ? Integer.toString(index) : path + "." + index; performTypeValidation(elementPath, _valueType, element, results); index++; } } else { results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_ISNOT_ARRAY", name + " type must be List or Array", "List", value.getClass())); } } }
public class class_name { @SuppressWarnings("unchecked") @Override protected void performValidation(String path, Object value, List<ValidationResult> results) { String name = path != null ? path : "value"; value = ObjectReader.getValue(value); super.performValidation(path, value, results); if (value == null) return; if (value instanceof List<?>) { List<Object> list = (List<Object>) value; int index = 0; for (Object element : list) { String elementPath = path == null || path.length() == 0 ? Integer.toString(index) : path + "." + index; performTypeValidation(elementPath, _valueType, element, results); // depends on control dependency: [for], data = [element] index++; // depends on control dependency: [for], data = [none] } } else if (value.getClass().isArray()) { int length = Array.getLength(value); for (int index = 0; index < length; index++) { Object element = Array.get(value, index); String elementPath = path == null || path.length() == 0 ? Integer.toString(index) : path + "." + index; performTypeValidation(elementPath, _valueType, element, results); // depends on control dependency: [for], data = [none] index++; // depends on control dependency: [for], data = [index] } } else { results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_ISNOT_ARRAY", name + " type must be List or Array", "List", value.getClass())); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void addPoller(PollRunnable task, long delay, TimeUnit timeUnit) { ScheduledExecutorService service = executor.get(); if (service != null) { service.scheduleWithFixedDelay(task, 0, delay, timeUnit); } else { throw new IllegalStateException( "you must start the scheduler before tasks can be submitted"); } } }
public class class_name { public void addPoller(PollRunnable task, long delay, TimeUnit timeUnit) { ScheduledExecutorService service = executor.get(); if (service != null) { service.scheduleWithFixedDelay(task, 0, delay, timeUnit); // depends on control dependency: [if], data = [none] } else { throw new IllegalStateException( "you must start the scheduler before tasks can be submitted"); } } }
public class class_name { protected void addObserver (Object obs) { if (_observers == null) { _observers = ObserverList.newFastUnsafe(); } _observers.add(obs); } }
public class class_name { protected void addObserver (Object obs) { if (_observers == null) { _observers = ObserverList.newFastUnsafe(); // depends on control dependency: [if], data = [none] } _observers.add(obs); } }
public class class_name { public CreateIdentityPoolResult withCognitoIdentityProviders(CognitoIdentityProvider... cognitoIdentityProviders) { if (this.cognitoIdentityProviders == null) { setCognitoIdentityProviders(new java.util.ArrayList<CognitoIdentityProvider>(cognitoIdentityProviders.length)); } for (CognitoIdentityProvider ele : cognitoIdentityProviders) { this.cognitoIdentityProviders.add(ele); } return this; } }
public class class_name { public CreateIdentityPoolResult withCognitoIdentityProviders(CognitoIdentityProvider... cognitoIdentityProviders) { if (this.cognitoIdentityProviders == null) { setCognitoIdentityProviders(new java.util.ArrayList<CognitoIdentityProvider>(cognitoIdentityProviders.length)); // depends on control dependency: [if], data = [none] } for (CognitoIdentityProvider ele : cognitoIdentityProviders) { this.cognitoIdentityProviders.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public List<ClassDoc> implementingclasses(ClassDoc cd) { List<ClassDoc> result = get(implementingclasses, cd); List<ClassDoc> subinterfaces = allSubs(cd, false); //If class x implements a subinterface of cd, then it follows //that class x implements cd. Iterator<ClassDoc> implementingClassesIter, subInterfacesIter = subinterfaces.listIterator(); ClassDoc c; while(subInterfacesIter.hasNext()){ implementingClassesIter = implementingclasses( subInterfacesIter.next()).listIterator(); while(implementingClassesIter.hasNext()){ c = implementingClassesIter.next(); if(! result.contains(c)){ result.add(c); } } } Collections.sort(result); return result; } }
public class class_name { public List<ClassDoc> implementingclasses(ClassDoc cd) { List<ClassDoc> result = get(implementingclasses, cd); List<ClassDoc> subinterfaces = allSubs(cd, false); //If class x implements a subinterface of cd, then it follows //that class x implements cd. Iterator<ClassDoc> implementingClassesIter, subInterfacesIter = subinterfaces.listIterator(); ClassDoc c; while(subInterfacesIter.hasNext()){ implementingClassesIter = implementingclasses( subInterfacesIter.next()).listIterator(); // depends on control dependency: [while], data = [none] while(implementingClassesIter.hasNext()){ c = implementingClassesIter.next(); // depends on control dependency: [while], data = [none] if(! result.contains(c)){ result.add(c); // depends on control dependency: [if], data = [none] } } } Collections.sort(result); return result; } }
public class class_name { @Override public void add(final int arg0, final Object arg1) { eagerlyLoadDataCollection(); List dataList = (List) dataCollection; if(dataList == null) { dataList = new ArrayList(); } if (arg1 != null && !dataList.contains(arg1)) { dataList.add(arg0, arg1); } } }
public class class_name { @Override public void add(final int arg0, final Object arg1) { eagerlyLoadDataCollection(); List dataList = (List) dataCollection; if(dataList == null) { dataList = new ArrayList(); // depends on control dependency: [if], data = [none] } if (arg1 != null && !dataList.contains(arg1)) { dataList.add(arg0, arg1); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected final Color getComponentColor(JComponent c, String property, Color defaultColor, float saturationOffset, float brightnessOffset, int alphaOffset) { Color color = null; if (c != null) { // handle some special cases for performance if ("background".equals(property)) { color = c.getBackground(); } else if ("foreground".equals(property)) { color = c.getForeground(); } else if (c instanceof JList && "selectionForeground".equals(property)) { color = ((JList) c).getSelectionForeground(); } else if (c instanceof JList && "selectionBackground".equals(property)) { color = ((JList) c).getSelectionBackground(); } else if (c instanceof JTable && "selectionForeground".equals(property)) { color = ((JTable) c).getSelectionForeground(); } else if (c instanceof JTable && "selectionBackground".equals(property)) { color = ((JTable) c).getSelectionBackground(); } else { String s = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1); try { Method method = c.getClass().getMethod(s); color = (Color) method.invoke(c); } catch (Exception e) { // don't do anything, it just didn't work, that's all. // This could be a normal occurance if you use a property // name referring to a key in clientProperties instead of // a real property } if (color == null) { Object value = c.getClientProperty(property); if (value instanceof Color) { color = (Color) value; } } } } // we return the defaultColor if the color found is null, or if // it is a UIResource. This is done because the color for the // ENABLED state is set on the component, but you don't want to use // that color for the over state. So we only respect the color // specified for the property if it was set by the user, as opposed // to set by us. if (color == null || color instanceof UIResource) { return defaultColor; } else if (saturationOffset != 0 || brightnessOffset != 0 || alphaOffset != 0) { float[] tmp = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); tmp[1] = clamp(tmp[1] + saturationOffset); tmp[2] = clamp(tmp[2] + brightnessOffset); int alpha = clamp(color.getAlpha() + alphaOffset); return new Color((Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24)); } else { return color; } } }
public class class_name { protected final Color getComponentColor(JComponent c, String property, Color defaultColor, float saturationOffset, float brightnessOffset, int alphaOffset) { Color color = null; if (c != null) { // handle some special cases for performance if ("background".equals(property)) { color = c.getBackground(); // depends on control dependency: [if], data = [none] } else if ("foreground".equals(property)) { color = c.getForeground(); // depends on control dependency: [if], data = [none] } else if (c instanceof JList && "selectionForeground".equals(property)) { color = ((JList) c).getSelectionForeground(); // depends on control dependency: [if], data = [none] } else if (c instanceof JList && "selectionBackground".equals(property)) { color = ((JList) c).getSelectionBackground(); // depends on control dependency: [if], data = [none] } else if (c instanceof JTable && "selectionForeground".equals(property)) { color = ((JTable) c).getSelectionForeground(); // depends on control dependency: [if], data = [none] } else if (c instanceof JTable && "selectionBackground".equals(property)) { color = ((JTable) c).getSelectionBackground(); // depends on control dependency: [if], data = [none] } else { String s = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1); try { Method method = c.getClass().getMethod(s); color = (Color) method.invoke(c); // depends on control dependency: [try], data = [none] } catch (Exception e) { // don't do anything, it just didn't work, that's all. // This could be a normal occurance if you use a property // name referring to a key in clientProperties instead of // a real property } // depends on control dependency: [catch], data = [none] if (color == null) { Object value = c.getClientProperty(property); if (value instanceof Color) { color = (Color) value; // depends on control dependency: [if], data = [none] } } } } // we return the defaultColor if the color found is null, or if // it is a UIResource. This is done because the color for the // ENABLED state is set on the component, but you don't want to use // that color for the over state. So we only respect the color // specified for the property if it was set by the user, as opposed // to set by us. if (color == null || color instanceof UIResource) { return defaultColor; // depends on control dependency: [if], data = [none] } else if (saturationOffset != 0 || brightnessOffset != 0 || alphaOffset != 0) { float[] tmp = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); tmp[1] = clamp(tmp[1] + saturationOffset); // depends on control dependency: [if], data = [none] tmp[2] = clamp(tmp[2] + brightnessOffset); // depends on control dependency: [if], data = [none] int alpha = clamp(color.getAlpha() + alphaOffset); return new Color((Color.HSBtoRGB(tmp[0], tmp[1], tmp[2]) & 0xFFFFFF) | (alpha << 24)); // depends on control dependency: [if], data = [none] } else { return color; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void replaceFirst(StringBuffer haystack, String needle, String newNeedle) { int idx = haystack.indexOf(needle); if (idx != -1) { haystack.replace(idx, idx + needle.length(), newNeedle); } } }
public class class_name { public static void replaceFirst(StringBuffer haystack, String needle, String newNeedle) { int idx = haystack.indexOf(needle); if (idx != -1) { haystack.replace(idx, idx + needle.length(), newNeedle); // depends on control dependency: [if], data = [(idx] } } }
public class class_name { @SuppressWarnings("unchecked") public static <ReturnType> Collection<ReturnType> query(Query queryObj, RegionFunctionContext rfc, Object... params) throws FunctionDomainException, TypeMismatchException, NameResolutionException, QueryInvocationTargetException { SelectResults<ReturnType> selectResults; // Execute Query locally. Returns results set. if (rfc == null || JvmRegionFunctionContext.class.isAssignableFrom(rfc.getClass())) { if(params == null || params.length == 0) { selectResults = (SelectResults<ReturnType>) queryObj.execute(); } else { selectResults = (SelectResults<ReturnType>) queryObj.execute(params); } if (selectResults == null || selectResults.isEmpty()) return null; ArrayList<ReturnType> results = new ArrayList<ReturnType>(selectResults.size()); results.addAll(selectResults.asList()); return results; } else { if(params == null || params.length == 0) { selectResults = (SelectResults<ReturnType>) queryObj.execute(rfc); } else { selectResults = (SelectResults<ReturnType>) queryObj.execute(rfc,params); } if (selectResults == null || selectResults.isEmpty()) return null; return selectResults; } } }
public class class_name { @SuppressWarnings("unchecked") public static <ReturnType> Collection<ReturnType> query(Query queryObj, RegionFunctionContext rfc, Object... params) throws FunctionDomainException, TypeMismatchException, NameResolutionException, QueryInvocationTargetException { SelectResults<ReturnType> selectResults; // Execute Query locally. Returns results set. if (rfc == null || JvmRegionFunctionContext.class.isAssignableFrom(rfc.getClass())) { if(params == null || params.length == 0) { selectResults = (SelectResults<ReturnType>) queryObj.execute(); // depends on control dependency: [if], data = [none] } else { selectResults = (SelectResults<ReturnType>) queryObj.execute(params); // depends on control dependency: [if], data = [(params] } if (selectResults == null || selectResults.isEmpty()) return null; ArrayList<ReturnType> results = new ArrayList<ReturnType>(selectResults.size()); results.addAll(selectResults.asList()); return results; } else { if(params == null || params.length == 0) { selectResults = (SelectResults<ReturnType>) queryObj.execute(rfc); // depends on control dependency: [if], data = [none] } else { selectResults = (SelectResults<ReturnType>) queryObj.execute(rfc,params); // depends on control dependency: [if], data = [none] } if (selectResults == null || selectResults.isEmpty()) return null; return selectResults; } } }
public class class_name { public static boolean isProjectSource(Resource r) { try { String file = r.getURL().getFile(); return isProjectSource(file) || file.endsWith("GrailsPlugin.groovy"); } catch (IOException e) { return false; } } }
public class class_name { public static boolean isProjectSource(Resource r) { try { String file = r.getURL().getFile(); return isProjectSource(file) || file.endsWith("GrailsPlugin.groovy"); // depends on control dependency: [try], data = [none] } catch (IOException e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public boolean toBoolean(Object val) { if (val == null) { controlNullOperand(); return false; } else if (val instanceof Boolean) { return (Boolean) val; } else if (val instanceof Number) { double number = toDouble(val); return !Double.isNaN(number) && number != 0.d; } else if (val instanceof String) { String strval = val.toString(); return strval.length() > 0 && !"false".equals(strval); } else if (val instanceof Collection) { return CollectionUtils.isNotEmpty((Collection) val); } return true; } }
public class class_name { @Override public boolean toBoolean(Object val) { if (val == null) { controlNullOperand(); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } else if (val instanceof Boolean) { return (Boolean) val; // depends on control dependency: [if], data = [none] } else if (val instanceof Number) { double number = toDouble(val); return !Double.isNaN(number) && number != 0.d; // depends on control dependency: [if], data = [none] } else if (val instanceof String) { String strval = val.toString(); return strval.length() > 0 && !"false".equals(strval); // depends on control dependency: [if], data = [none] } else if (val instanceof Collection) { return CollectionUtils.isNotEmpty((Collection) val); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public static UserGroupInformation setupProxyUser(Properties jobProps, String tokenFile, Logger log) { UserGroupInformation proxyUser = null; if (!HadoopSecureWrapperUtils.shouldProxy(jobProps)) { log.info("submitting job as original submitter, not proxying"); return proxyUser; } // set up hadoop related configurations final Configuration conf = new Configuration(); UserGroupInformation.setConfiguration(conf); boolean securityEnabled = UserGroupInformation.isSecurityEnabled(); // setting up proxy user if required try { String userToProxy = null; userToProxy = jobProps.getProperty(HadoopSecurityManager.USER_TO_PROXY); if (securityEnabled) { proxyUser = HadoopSecureWrapperUtils.createSecurityEnabledProxyUser( userToProxy, tokenFile, log); log.info("security enabled, proxying as user " + userToProxy); } else { proxyUser = UserGroupInformation.createRemoteUser(userToProxy); log.info("security not enabled, proxying as user " + userToProxy); } } catch (IOException e) { log.error("HadoopSecureWrapperUtils.setupProxyUser threw an IOException", e); } return proxyUser; } }
public class class_name { public static UserGroupInformation setupProxyUser(Properties jobProps, String tokenFile, Logger log) { UserGroupInformation proxyUser = null; if (!HadoopSecureWrapperUtils.shouldProxy(jobProps)) { log.info("submitting job as original submitter, not proxying"); // depends on control dependency: [if], data = [none] return proxyUser; // depends on control dependency: [if], data = [none] } // set up hadoop related configurations final Configuration conf = new Configuration(); UserGroupInformation.setConfiguration(conf); boolean securityEnabled = UserGroupInformation.isSecurityEnabled(); // setting up proxy user if required try { String userToProxy = null; userToProxy = jobProps.getProperty(HadoopSecurityManager.USER_TO_PROXY); // depends on control dependency: [try], data = [none] if (securityEnabled) { proxyUser = HadoopSecureWrapperUtils.createSecurityEnabledProxyUser( userToProxy, tokenFile, log); // depends on control dependency: [if], data = [none] log.info("security enabled, proxying as user " + userToProxy); // depends on control dependency: [if], data = [none] } else { proxyUser = UserGroupInformation.createRemoteUser(userToProxy); // depends on control dependency: [if], data = [none] log.info("security not enabled, proxying as user " + userToProxy); // depends on control dependency: [if], data = [none] } } catch (IOException e) { log.error("HadoopSecureWrapperUtils.setupProxyUser threw an IOException", e); } // depends on control dependency: [catch], data = [none] return proxyUser; } }
public class class_name { private void processActivities(Storepoint phoenixProject) { final AlphanumComparator comparator = new AlphanumComparator(); List<Activity> activities = phoenixProject.getActivities().getActivity(); Collections.sort(activities, new Comparator<Activity>() { @Override public int compare(Activity o1, Activity o2) { Map<UUID, UUID> codes1 = getActivityCodes(o1); Map<UUID, UUID> codes2 = getActivityCodes(o2); for (UUID code : m_codeSequence) { UUID codeValue1 = codes1.get(code); UUID codeValue2 = codes2.get(code); if (codeValue1 == null || codeValue2 == null) { if (codeValue1 == null && codeValue2 == null) { continue; } if (codeValue1 == null) { return -1; } if (codeValue2 == null) { return 1; } } if (!codeValue1.equals(codeValue2)) { Integer sequence1 = m_activityCodeSequence.get(codeValue1); Integer sequence2 = m_activityCodeSequence.get(codeValue2); return NumberHelper.compare(sequence1, sequence2); } } return comparator.compare(o1.getId(), o2.getId()); } }); for (Activity activity : activities) { processActivity(activity); } } }
public class class_name { private void processActivities(Storepoint phoenixProject) { final AlphanumComparator comparator = new AlphanumComparator(); List<Activity> activities = phoenixProject.getActivities().getActivity(); Collections.sort(activities, new Comparator<Activity>() { @Override public int compare(Activity o1, Activity o2) { Map<UUID, UUID> codes1 = getActivityCodes(o1); Map<UUID, UUID> codes2 = getActivityCodes(o2); for (UUID code : m_codeSequence) { UUID codeValue1 = codes1.get(code); UUID codeValue2 = codes2.get(code); if (codeValue1 == null || codeValue2 == null) { if (codeValue1 == null && codeValue2 == null) { continue; } if (codeValue1 == null) { return -1; // depends on control dependency: [if], data = [none] } if (codeValue2 == null) { return 1; // depends on control dependency: [if], data = [none] } } if (!codeValue1.equals(codeValue2)) { Integer sequence1 = m_activityCodeSequence.get(codeValue1); Integer sequence2 = m_activityCodeSequence.get(codeValue2); return NumberHelper.compare(sequence1, sequence2); // depends on control dependency: [if], data = [none] } } return comparator.compare(o1.getId(), o2.getId()); } }); for (Activity activity : activities) { processActivity(activity); // depends on control dependency: [for], data = [activity] } } }
public class class_name { public void drawEmbedded(float x,float y,float width,float height) { init(); if (corners == null) { GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(x, y, 0); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(x, y + height, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); GL.glVertex3f(x + width, y + height, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); GL.glVertex3f(x + width, y, 0); } else { corners[TOP_LEFT].bind(); GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(x, y, 0); corners[BOTTOM_LEFT].bind(); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(x, y + height, 0); corners[BOTTOM_RIGHT].bind(); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); GL.glVertex3f(x + width, y + height, 0); corners[TOP_RIGHT].bind(); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); GL.glVertex3f(x + width, y, 0); } } }
public class class_name { public void drawEmbedded(float x,float y,float width,float height) { init(); if (corners == null) { GL.glTexCoord2f(textureOffsetX, textureOffsetY); // depends on control dependency: [if], data = [none] GL.glVertex3f(x, y, 0); // depends on control dependency: [if], data = [none] GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); // depends on control dependency: [if], data = [none] GL.glVertex3f(x, y + height, 0); // depends on control dependency: [if], data = [none] GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); // depends on control dependency: [if], data = [none] GL.glVertex3f(x + width, y + height, 0); // depends on control dependency: [if], data = [none] GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); // depends on control dependency: [if], data = [none] GL.glVertex3f(x + width, y, 0); // depends on control dependency: [if], data = [none] } else { corners[TOP_LEFT].bind(); // depends on control dependency: [if], data = [none] GL.glTexCoord2f(textureOffsetX, textureOffsetY); // depends on control dependency: [if], data = [none] GL.glVertex3f(x, y, 0); // depends on control dependency: [if], data = [none] corners[BOTTOM_LEFT].bind(); // depends on control dependency: [if], data = [none] GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); // depends on control dependency: [if], data = [none] GL.glVertex3f(x, y + height, 0); // depends on control dependency: [if], data = [none] corners[BOTTOM_RIGHT].bind(); // depends on control dependency: [if], data = [none] GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); // depends on control dependency: [if], data = [none] GL.glVertex3f(x + width, y + height, 0); // depends on control dependency: [if], data = [none] corners[TOP_RIGHT].bind(); // depends on control dependency: [if], data = [none] GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); // depends on control dependency: [if], data = [none] GL.glVertex3f(x + width, y, 0); // depends on control dependency: [if], data = [none] } } }
public class class_name { public short getRequstURIPath(String prefix, short defvalue) { String val = getRequstURIPath(prefix, null); try { return val == null ? defvalue : Short.parseShort(val); } catch (NumberFormatException e) { return defvalue; } } }
public class class_name { public short getRequstURIPath(String prefix, short defvalue) { String val = getRequstURIPath(prefix, null); try { return val == null ? defvalue : Short.parseShort(val); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { return defvalue; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static String createResource( CmsObject cmsObject, String newLink, Locale locale, String sitePath, String modelFileName, String mode, String postCreateHandler) { String[] newLinkParts = newLink.split("\\|"); String rootPath = newLinkParts[1]; String typeName = newLinkParts[2]; CmsFile modelFile = null; if (StringUtils.equalsIgnoreCase(mode, CmsEditorConstants.MODE_COPY)) { try { modelFile = cmsObject.readFile(sitePath); } catch (CmsException e) { LOG.warn( "The resource at path" + sitePath + "could not be read. Thus it can not be used as model file.", e); } } CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(cmsObject, rootPath); CmsResourceTypeConfig typeConfig = adeConfig.getResourceType(typeName); CmsResource newElement = null; try { CmsObject cmsClone = cmsObject; if ((locale != null) && !cmsObject.getRequestContext().getLocale().equals(locale)) { // in case the content locale does not match the request context locale, use a clone cms with the appropriate locale cmsClone = OpenCms.initCmsObject(cmsObject); cmsClone.getRequestContext().setLocale(locale); } newElement = typeConfig.createNewElement(cmsClone, modelFile, rootPath); CmsPair<String, String> handlerParameter = I_CmsCollectorPostCreateHandler.splitClassAndConfig( postCreateHandler); I_CmsCollectorPostCreateHandler handler = A_CmsResourceCollector.getPostCreateHandler( handlerParameter.getFirst()); handler.onCreate(cmsClone, cmsClone.readFile(newElement), modelFile != null, handlerParameter.getSecond()); } catch (CmsException e) { LOG.error("Could not create resource.", e); } return newElement == null ? null : cmsObject.getSitePath(newElement); } }
public class class_name { public static String createResource( CmsObject cmsObject, String newLink, Locale locale, String sitePath, String modelFileName, String mode, String postCreateHandler) { String[] newLinkParts = newLink.split("\\|"); String rootPath = newLinkParts[1]; String typeName = newLinkParts[2]; CmsFile modelFile = null; if (StringUtils.equalsIgnoreCase(mode, CmsEditorConstants.MODE_COPY)) { try { modelFile = cmsObject.readFile(sitePath); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.warn( "The resource at path" + sitePath + "could not be read. Thus it can not be used as model file.", e); } // depends on control dependency: [catch], data = [none] } CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(cmsObject, rootPath); CmsResourceTypeConfig typeConfig = adeConfig.getResourceType(typeName); CmsResource newElement = null; try { CmsObject cmsClone = cmsObject; if ((locale != null) && !cmsObject.getRequestContext().getLocale().equals(locale)) { // in case the content locale does not match the request context locale, use a clone cms with the appropriate locale cmsClone = OpenCms.initCmsObject(cmsObject); // depends on control dependency: [if], data = [none] cmsClone.getRequestContext().setLocale(locale); // depends on control dependency: [if], data = [none] } newElement = typeConfig.createNewElement(cmsClone, modelFile, rootPath); // depends on control dependency: [try], data = [none] CmsPair<String, String> handlerParameter = I_CmsCollectorPostCreateHandler.splitClassAndConfig( postCreateHandler); I_CmsCollectorPostCreateHandler handler = A_CmsResourceCollector.getPostCreateHandler( handlerParameter.getFirst()); handler.onCreate(cmsClone, cmsClone.readFile(newElement), modelFile != null, handlerParameter.getSecond()); // depends on control dependency: [try], data = [none] } catch (CmsException e) { LOG.error("Could not create resource.", e); } // depends on control dependency: [catch], data = [none] return newElement == null ? null : cmsObject.getSitePath(newElement); } }
public class class_name { public static void divide(DMatrixD1 a , double alpha) { final int size = a.getNumElements(); for( int i = 0; i < size; i++ ) { a.data[i] /= alpha; } } }
public class class_name { public static void divide(DMatrixD1 a , double alpha) { final int size = a.getNumElements(); for( int i = 0; i < size; i++ ) { a.data[i] /= alpha; // depends on control dependency: [for], data = [i] } } }
public class class_name { public void log(Log log) { log.info("Counters: " + size()); for(Group group: this) { log.info(" " + group.getDisplayName()); for (Counter counter: group) { log.info(" " + counter.getDisplayName() + "=" + counter.getCounter()); } } } }
public class class_name { public void log(Log log) { log.info("Counters: " + size()); for(Group group: this) { log.info(" " + group.getDisplayName()); // depends on control dependency: [for], data = [group] for (Counter counter: group) { log.info(" " + counter.getDisplayName() + "=" + counter.getCounter()); // depends on control dependency: [for], data = [counter] } } } }
public class class_name { @Override public VirtualConnectionFactory getOutboundVCFactory() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "getOutboundVCFactory"); } // Handle case where existing vcf has been destroyed. if (vcf != null) { OutboundVirtualConnectionFactoryImpl outboundVCF = (OutboundVirtualConnectionFactoryImpl) vcf; if (outboundVCF.getRefCount() == 0) { // VCF has been destroyed. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found destroyed vcf, nulling it out to build another"); } vcf = null; } } // Check to see if a vcf already exists. if (vcf == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Existing vcf not available. Build one."); } // Determine if the outbound chain already exists. if (outboundChainData != null) { // The outbound chain has already been created. Use its name. try { vcf = framework.getOutboundVCFactory(outboundChainData.getName()); } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception while getting VCFactory: " + e); } vcf = null; } } else { // The outbound chain data does NOT exist. try { // This method will end up calling setOutboundVCFactory to assign // a valid value to vcf. // This method will also call setOutboundChainData. this.framework.prepareEndPoint(this); } catch (ChannelFrameworkException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception while preparing CFEndPoint: " + e); } this.vcf = null; } } } else { OutboundVirtualConnectionFactoryImpl outboundVCF = (OutboundVirtualConnectionFactoryImpl) vcf; outboundVCF.incrementRefCount(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found an existing VCF, updating the ref count to " + outboundVCF.getRefCount()); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getOutboundVCFactory"); } return vcf; } }
public class class_name { @Override public VirtualConnectionFactory getOutboundVCFactory() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "getOutboundVCFactory"); // depends on control dependency: [if], data = [none] } // Handle case where existing vcf has been destroyed. if (vcf != null) { OutboundVirtualConnectionFactoryImpl outboundVCF = (OutboundVirtualConnectionFactoryImpl) vcf; if (outboundVCF.getRefCount() == 0) { // VCF has been destroyed. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found destroyed vcf, nulling it out to build another"); // depends on control dependency: [if], data = [none] } vcf = null; // depends on control dependency: [if], data = [none] } } // Check to see if a vcf already exists. if (vcf == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Existing vcf not available. Build one."); // depends on control dependency: [if], data = [none] } // Determine if the outbound chain already exists. if (outboundChainData != null) { // The outbound chain has already been created. Use its name. try { vcf = framework.getOutboundVCFactory(outboundChainData.getName()); // depends on control dependency: [try], data = [none] } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception while getting VCFactory: " + e); // depends on control dependency: [if], data = [none] } vcf = null; } // depends on control dependency: [catch], data = [none] } else { // The outbound chain data does NOT exist. try { // This method will end up calling setOutboundVCFactory to assign // a valid value to vcf. // This method will also call setOutboundChainData. this.framework.prepareEndPoint(this); // depends on control dependency: [try], data = [none] } catch (ChannelFrameworkException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception while preparing CFEndPoint: " + e); // depends on control dependency: [if], data = [none] } this.vcf = null; } // depends on control dependency: [catch], data = [none] } } else { OutboundVirtualConnectionFactoryImpl outboundVCF = (OutboundVirtualConnectionFactoryImpl) vcf; outboundVCF.incrementRefCount(); // depends on control dependency: [if], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Found an existing VCF, updating the ref count to " + outboundVCF.getRefCount()); // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getOutboundVCFactory"); // depends on control dependency: [if], data = [none] } return vcf; } }
public class class_name { private void copyResources(File outputDirectory) throws IOException { copyClasspathResource(outputDirectory, "reportng.css", "reportng.css"); copyClasspathResource(outputDirectory, "reportng.js", "reportng.js"); // If there is a custom stylesheet, copy that. File customStylesheet = META.getStylesheetPath(); if (customStylesheet != null) { if (customStylesheet.exists()) { copyFile(outputDirectory, customStylesheet, CUSTOM_STYLE_FILE); } else { // If not found, try to read the file as a resource on the classpath // useful when reportng is called by a jarred up library InputStream stream = ClassLoader.getSystemClassLoader().getResourceAsStream(customStylesheet.getPath()); if (stream != null) { copyStream(outputDirectory, stream, CUSTOM_STYLE_FILE); } } } } }
public class class_name { private void copyResources(File outputDirectory) throws IOException { copyClasspathResource(outputDirectory, "reportng.css", "reportng.css"); copyClasspathResource(outputDirectory, "reportng.js", "reportng.js"); // If there is a custom stylesheet, copy that. File customStylesheet = META.getStylesheetPath(); if (customStylesheet != null) { if (customStylesheet.exists()) { copyFile(outputDirectory, customStylesheet, CUSTOM_STYLE_FILE); } else { // If not found, try to read the file as a resource on the classpath // useful when reportng is called by a jarred up library InputStream stream = ClassLoader.getSystemClassLoader().getResourceAsStream(customStylesheet.getPath()); if (stream != null) { copyStream(outputDirectory, stream, CUSTOM_STYLE_FILE); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static <T> Collection<T> intersect(Collection<T> first, Collection<T> second) { E.checkNotNull(first, "first"); E.checkNotNull(second, "second"); HashSet<T> results = null; if (first instanceof HashSet) { @SuppressWarnings("unchecked") HashSet<T> clone = (HashSet<T>) ((HashSet<T>) first).clone(); results = clone; } else { results = new HashSet<>(first); } results.retainAll(second); return results; } }
public class class_name { public static <T> Collection<T> intersect(Collection<T> first, Collection<T> second) { E.checkNotNull(first, "first"); E.checkNotNull(second, "second"); HashSet<T> results = null; if (first instanceof HashSet) { @SuppressWarnings("unchecked") HashSet<T> clone = (HashSet<T>) ((HashSet<T>) first).clone(); results = clone; // depends on control dependency: [if], data = [none] } else { results = new HashSet<>(first); // depends on control dependency: [if], data = [none] } results.retainAll(second); return results; } }