code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private void overrideAbstractMethods() throws IOException { for (final ExecutableElement method : El.getEffectiveMethods(superClass)) { if (method.getModifiers().contains(Modifier.ABSTRACT)) { if ( method.getAnnotation(Terminal.class) != null || method.getAnnotation(Rule.class) != null || method.getAnnotation(Rules.class) != null ) { implementedAbstractMethods.add(method); MethodCompiler mc = new MethodCompiler() { @Override protected void implement() throws IOException { TypeMirror returnType = method.getReturnType(); List<? extends VariableElement> params = method.getParameters(); if (returnType.getKind() != TypeKind.VOID && params.size() == 1) { nameArgument(ARG, 1); try { convert(ARG, returnType); } catch (IllegalConversionException ex) { throw new IOException("bad conversion with "+method, ex); } treturn(); } else { if (returnType.getKind() == TypeKind.VOID && params.size() == 0) { treturn(); } else { throw new IllegalArgumentException("cannot implement abstract method "+method); } } } }; subClass.overrideMethod(mc, method, Modifier.PROTECTED); } } } } }
public class class_name { private void overrideAbstractMethods() throws IOException { for (final ExecutableElement method : El.getEffectiveMethods(superClass)) { if (method.getModifiers().contains(Modifier.ABSTRACT)) { if ( method.getAnnotation(Terminal.class) != null || method.getAnnotation(Rule.class) != null || method.getAnnotation(Rules.class) != null ) { implementedAbstractMethods.add(method); // depends on control dependency: [if], data = [none] MethodCompiler mc = new MethodCompiler() { @Override protected void implement() throws IOException { TypeMirror returnType = method.getReturnType(); List<? extends VariableElement> params = method.getParameters(); if (returnType.getKind() != TypeKind.VOID && params.size() == 1) { nameArgument(ARG, 1); try { convert(ARG, returnType); // depends on control dependency: [try], data = [none] } catch (IllegalConversionException ex) { throw new IOException("bad conversion with "+method, ex); } // depends on control dependency: [catch], data = [none] treturn(); } else { if (returnType.getKind() == TypeKind.VOID && params.size() == 0) { treturn(); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("cannot implement abstract method "+method); } } } }; subClass.overrideMethod(mc, method, Modifier.PROTECTED); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public void getMaxBranching(CompleteGraph graph, int root, int[] invertedMaxBranching) { // Number of nodes. int numNodes = graph.getNumberOfNodes(); // Branching. SparseGraph maxBranching = new SparseGraph(); /* * Weighted edges used to allow weight modification and avoid any impact * in the original graph. */ SimpleWeightedEdge[][] edges = new SimpleWeightedEdge[numNodes][numNodes]; // Disjoint sets for the strongly connected components (SCC). DisjointSets sPartition = new DisjointSets(numNodes); // Disjoint sets for the weakly connected components (WCC). DisjointSets wPartition = new DisjointSets(numNodes); /* * Priority queues for each strongly connected component. In the * beginning, each SCC is composed by exactly one node. */ ArrayList<PriorityQueue<SimpleWeightedEdge>> incomingEdges = new ArrayList<PriorityQueue<SimpleWeightedEdge>>( numNodes); // Unique incoming edges for each SCC. Initially, no SCC has such edge. SimpleWeightedEdge[] enter = new SimpleWeightedEdge[numNodes]; /* * List of root components, i.e., SCCs that have no incoming edges * (enter[scc] == null). In the beginning, every SCC is a root * component. */ LinkedList<Integer> rootComponents = new LinkedList<Integer>(); // Root node of each root component. int[] min = new int[numNodes]; for (int node = 0; node < numNodes; ++node) { // Every SCC is a root component. rootComponents.add(node); /* * The head of its root component is its only node. This array is * called min in Tarjan's paper. */ min[node] = node; // Create a priority queue for each SCC. PriorityQueue<SimpleWeightedEdge> sccPriorityQueue = new PriorityQueue<SimpleWeightedEdge>(); incomingEdges.add(sccPriorityQueue); // No incoming edge is considered (nor created) for the root node. if (node != root) { /* * Create and add all incoming edges of <code>node</code> to its * SCC priority queue. */ for (int from = 0; from < numNodes; ++from) { if (from == node) // Skip autocycle edges. continue; // Create an weighted edge and add it to the priority queue. edges[from][node] = new SimpleWeightedEdge(from, node, graph.getEdgeWeight(from, node)); sccPriorityQueue.add(edges[from][node]); } } } // Root component with no available incoming edges. LinkedList<Integer> doneRootComponents = new LinkedList<Integer>(); while (!rootComponents.isEmpty()) { // Get some arbitrary root component. int sccTo = rootComponents.pop(); // Maximum edge entering the root component 'sccTo'. SimpleWeightedEdge maxInEdge = incomingEdges.get(sccTo).poll(); if (maxInEdge == null) { // No edge left to consider in this component. doneRootComponents.add(sccTo); continue; } // SCC component of edge 'e' from node: e = (from, to). int sccFrom = sPartition.find(maxInEdge.from); if (sccFrom == sccTo) { // Skip, for now, this component. rootComponents.add(sccTo); continue; } // Include the selected edge in the current branching. maxBranching.addEdge(maxInEdge.from, maxInEdge.to); // SCC component of edge 'e' from node, where e = (from, to). int wssFrom = wPartition.find(maxInEdge.from); // SCC component of edge 'e' to node, where e = (from, to). int wssTo = wPartition.find(maxInEdge.to); // Edge connects two weakly connected components. if (wssFrom != wssTo) { wPartition.union(wssFrom, wssTo); enter[sccTo] = maxInEdge; continue; } /* * Edge is within the same WCC, thus it inclusion will create a new * SCC by uniting some old SCCs (the ones on the path from e.to to * e.from). */ double minEdgeWeight = Double.POSITIVE_INFINITY; int minScc = -1; SimpleWeightedEdge tmpEdge = maxInEdge; while (tmpEdge != null) { if (tmpEdge.weight < minEdgeWeight) { minEdgeWeight = tmpEdge.weight; minScc = sPartition.find(tmpEdge.to); } tmpEdge = enter[sPartition.find(tmpEdge.from)]; } // Increment incoming edges weight. double inc = minEdgeWeight - maxInEdge.weight; for (SimpleWeightedEdge e : incomingEdges.get(sccTo)) e.weight += inc; // Set the head of the current SCC. min[sccTo] = min[minScc]; // Include all used SCCs in the current SCC. tmpEdge = enter[sccFrom]; while (tmpEdge != null) { /* * Increment incoming edges weight and include them in the * current SCC priority queue. */ int tmpSccTo = sPartition.find(tmpEdge.to); inc = minEdgeWeight - tmpEdge.weight; for (SimpleWeightedEdge e : incomingEdges.get(tmpSccTo)) { e.weight += inc; incomingEdges.get(sccTo).add(e); } // Remove the priority queue of this SCC. incomingEdges.set(tmpSccTo, null); sPartition.union(sccTo, tmpSccTo); // Next edge. tmpEdge = enter[sPartition.find(tmpEdge.from)]; } // Include the new SCC to be considered in the future. rootComponents.add(sccTo); } // Invert the maximum branching. boolean[] visited = new boolean[numNodes]; for (int scc : doneRootComponents) invertMaximumBranching(min[scc], maxBranching, visited, invertedMaxBranching); } /** * Walk through the given branching from <code>node</code> and store the * inverted branching in <code>invertedMaxBranching</code>. * * In fact, the given branching can include cycles. But it is only necessary * to disconsider the last edges of each cycle to get the real branching. * Thus, we use the array <code>visited</code>. * * @param node * @param branching * @param visited * @param invertedMaxBranching */ private void invertMaximumBranching(int node, SparseGraph branching, boolean[] visited, int[] invertedMaxBranching) { visited[node] = true; Set<Integer> toNodes = branching.getOutEdges(node); if (toNodes == null) return; for (int to : toNodes) { if (visited[to]) continue; invertedMaxBranching[to] = node; invertMaximumBranching(to, branching, visited, invertedMaxBranching); } } }
public class class_name { public void getMaxBranching(CompleteGraph graph, int root, int[] invertedMaxBranching) { // Number of nodes. int numNodes = graph.getNumberOfNodes(); // Branching. SparseGraph maxBranching = new SparseGraph(); /* * Weighted edges used to allow weight modification and avoid any impact * in the original graph. */ SimpleWeightedEdge[][] edges = new SimpleWeightedEdge[numNodes][numNodes]; // Disjoint sets for the strongly connected components (SCC). DisjointSets sPartition = new DisjointSets(numNodes); // Disjoint sets for the weakly connected components (WCC). DisjointSets wPartition = new DisjointSets(numNodes); /* * Priority queues for each strongly connected component. In the * beginning, each SCC is composed by exactly one node. */ ArrayList<PriorityQueue<SimpleWeightedEdge>> incomingEdges = new ArrayList<PriorityQueue<SimpleWeightedEdge>>( numNodes); // Unique incoming edges for each SCC. Initially, no SCC has such edge. SimpleWeightedEdge[] enter = new SimpleWeightedEdge[numNodes]; /* * List of root components, i.e., SCCs that have no incoming edges * (enter[scc] == null). In the beginning, every SCC is a root * component. */ LinkedList<Integer> rootComponents = new LinkedList<Integer>(); // Root node of each root component. int[] min = new int[numNodes]; for (int node = 0; node < numNodes; ++node) { // Every SCC is a root component. rootComponents.add(node); // depends on control dependency: [for], data = [node] /* * The head of its root component is its only node. This array is * called min in Tarjan's paper. */ min[node] = node; // depends on control dependency: [for], data = [node] // Create a priority queue for each SCC. PriorityQueue<SimpleWeightedEdge> sccPriorityQueue = new PriorityQueue<SimpleWeightedEdge>(); incomingEdges.add(sccPriorityQueue); // depends on control dependency: [for], data = [none] // No incoming edge is considered (nor created) for the root node. if (node != root) { /* * Create and add all incoming edges of <code>node</code> to its * SCC priority queue. */ for (int from = 0; from < numNodes; ++from) { if (from == node) // Skip autocycle edges. continue; // Create an weighted edge and add it to the priority queue. edges[from][node] = new SimpleWeightedEdge(from, node, graph.getEdgeWeight(from, node)); // depends on control dependency: [for], data = [from] sccPriorityQueue.add(edges[from][node]); // depends on control dependency: [for], data = [from] } } } // Root component with no available incoming edges. LinkedList<Integer> doneRootComponents = new LinkedList<Integer>(); while (!rootComponents.isEmpty()) { // Get some arbitrary root component. int sccTo = rootComponents.pop(); // Maximum edge entering the root component 'sccTo'. SimpleWeightedEdge maxInEdge = incomingEdges.get(sccTo).poll(); if (maxInEdge == null) { // No edge left to consider in this component. doneRootComponents.add(sccTo); // depends on control dependency: [if], data = [none] continue; } // SCC component of edge 'e' from node: e = (from, to). int sccFrom = sPartition.find(maxInEdge.from); if (sccFrom == sccTo) { // Skip, for now, this component. rootComponents.add(sccTo); // depends on control dependency: [if], data = [sccTo)] continue; } // Include the selected edge in the current branching. maxBranching.addEdge(maxInEdge.from, maxInEdge.to); // depends on control dependency: [while], data = [none] // SCC component of edge 'e' from node, where e = (from, to). int wssFrom = wPartition.find(maxInEdge.from); // SCC component of edge 'e' to node, where e = (from, to). int wssTo = wPartition.find(maxInEdge.to); // Edge connects two weakly connected components. if (wssFrom != wssTo) { wPartition.union(wssFrom, wssTo); // depends on control dependency: [if], data = [(wssFrom] enter[sccTo] = maxInEdge; // depends on control dependency: [if], data = [none] continue; } /* * Edge is within the same WCC, thus it inclusion will create a new * SCC by uniting some old SCCs (the ones on the path from e.to to * e.from). */ double minEdgeWeight = Double.POSITIVE_INFINITY; int minScc = -1; SimpleWeightedEdge tmpEdge = maxInEdge; while (tmpEdge != null) { if (tmpEdge.weight < minEdgeWeight) { minEdgeWeight = tmpEdge.weight; // depends on control dependency: [if], data = [none] minScc = sPartition.find(tmpEdge.to); // depends on control dependency: [if], data = [none] } tmpEdge = enter[sPartition.find(tmpEdge.from)]; // depends on control dependency: [while], data = [(tmpEdge] } // Increment incoming edges weight. double inc = minEdgeWeight - maxInEdge.weight; for (SimpleWeightedEdge e : incomingEdges.get(sccTo)) e.weight += inc; // Set the head of the current SCC. min[sccTo] = min[minScc]; // depends on control dependency: [while], data = [none] // Include all used SCCs in the current SCC. tmpEdge = enter[sccFrom]; // depends on control dependency: [while], data = [none] while (tmpEdge != null) { /* * Increment incoming edges weight and include them in the * current SCC priority queue. */ int tmpSccTo = sPartition.find(tmpEdge.to); inc = minEdgeWeight - tmpEdge.weight; // depends on control dependency: [while], data = [none] for (SimpleWeightedEdge e : incomingEdges.get(tmpSccTo)) { e.weight += inc; // depends on control dependency: [for], data = [e] incomingEdges.get(sccTo).add(e); // depends on control dependency: [for], data = [e] } // Remove the priority queue of this SCC. incomingEdges.set(tmpSccTo, null); // depends on control dependency: [while], data = [null)] sPartition.union(sccTo, tmpSccTo); // depends on control dependency: [while], data = [none] // Next edge. tmpEdge = enter[sPartition.find(tmpEdge.from)]; // depends on control dependency: [while], data = [(tmpEdge] } // Include the new SCC to be considered in the future. rootComponents.add(sccTo); // depends on control dependency: [while], data = [none] } // Invert the maximum branching. boolean[] visited = new boolean[numNodes]; for (int scc : doneRootComponents) invertMaximumBranching(min[scc], maxBranching, visited, invertedMaxBranching); } /** * Walk through the given branching from <code>node</code> and store the * inverted branching in <code>invertedMaxBranching</code>. * * In fact, the given branching can include cycles. But it is only necessary * to disconsider the last edges of each cycle to get the real branching. * Thus, we use the array <code>visited</code>. * * @param node * @param branching * @param visited * @param invertedMaxBranching */ private void invertMaximumBranching(int node, SparseGraph branching, boolean[] visited, int[] invertedMaxBranching) { visited[node] = true; Set<Integer> toNodes = branching.getOutEdges(node); if (toNodes == null) return; for (int to : toNodes) { if (visited[to]) continue; invertedMaxBranching[to] = node; // depends on control dependency: [for], data = [to] invertMaximumBranching(to, branching, visited, invertedMaxBranching); // depends on control dependency: [for], data = [to] } } }
public class class_name { protected final String baseToRules(boolean escapeUnprintable) { // The base class implementation of toRules munges the ID into // the correct format. That is: foo => ::foo // KEEP in sync with rbt_pars if (escapeUnprintable) { StringBuffer rulesSource = new StringBuffer(); String id = getID(); for (int i=0; i<id.length();) { int c = UTF16.charAt(id, i); if (!Utility.escapeUnprintable(rulesSource, c)) { UTF16.append(rulesSource, c); } i += UTF16.getCharCount(c); } rulesSource.insert(0, "::"); rulesSource.append(ID_DELIM); return rulesSource.toString(); } return "::" + getID() + ID_DELIM; } }
public class class_name { protected final String baseToRules(boolean escapeUnprintable) { // The base class implementation of toRules munges the ID into // the correct format. That is: foo => ::foo // KEEP in sync with rbt_pars if (escapeUnprintable) { StringBuffer rulesSource = new StringBuffer(); String id = getID(); for (int i=0; i<id.length();) { int c = UTF16.charAt(id, i); if (!Utility.escapeUnprintable(rulesSource, c)) { UTF16.append(rulesSource, c); // depends on control dependency: [if], data = [none] } i += UTF16.getCharCount(c); // depends on control dependency: [for], data = [i] } rulesSource.insert(0, "::"); // depends on control dependency: [if], data = [none] rulesSource.append(ID_DELIM); // depends on control dependency: [if], data = [none] return rulesSource.toString(); // depends on control dependency: [if], data = [none] } return "::" + getID() + ID_DELIM; } }
public class class_name { public void setLocaleValues(java.util.Collection<Locale> localeValues) { if (localeValues == null) { this.localeValues = null; return; } this.localeValues = new java.util.ArrayList<Locale>(localeValues); } }
public class class_name { public void setLocaleValues(java.util.Collection<Locale> localeValues) { if (localeValues == null) { this.localeValues = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.localeValues = new java.util.ArrayList<Locale>(localeValues); } }
public class class_name { public void marshall(ResourcePolicy resourcePolicy, ProtocolMarshaller protocolMarshaller) { if (resourcePolicy == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourcePolicy.getPolicyName(), POLICYNAME_BINDING); protocolMarshaller.marshall(resourcePolicy.getPolicyDocument(), POLICYDOCUMENT_BINDING); protocolMarshaller.marshall(resourcePolicy.getLastUpdatedTime(), LASTUPDATEDTIME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ResourcePolicy resourcePolicy, ProtocolMarshaller protocolMarshaller) { if (resourcePolicy == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourcePolicy.getPolicyName(), POLICYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourcePolicy.getPolicyDocument(), POLICYDOCUMENT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourcePolicy.getLastUpdatedTime(), LASTUPDATEDTIME_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 int getIntHeader(String arg0) { try { collaborator.preInvoke(componentMetaData); return request.getIntHeader(arg0); } finally { collaborator.postInvoke(); } } }
public class class_name { @Override public int getIntHeader(String arg0) { try { collaborator.preInvoke(componentMetaData); // depends on control dependency: [try], data = [none] return request.getIntHeader(arg0); // depends on control dependency: [try], data = [none] } finally { collaborator.postInvoke(); } } }
public class class_name { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); Class[] params = method.getParameterTypes(); // equals and hashCode are special cased if (methodName.equals("equals") && params.length == 1 && params[0].equals(Object.class)) { Object value = args[0]; if (value == null || !Proxy.isProxyClass(value.getClass())) return new Boolean(false); BurlapProxy handler = (BurlapProxy) Proxy.getInvocationHandler(value); return new Boolean(_url.equals(handler.getURL())); } else if (methodName.equals("hashCode") && params.length == 0) return new Integer(_url.hashCode()); else if (methodName.equals("getBurlapType")) return proxy.getClass().getInterfaces()[0].getName(); else if (methodName.equals("getBurlapURL")) return _url.toString(); else if (methodName.equals("toString") && params.length == 0) return getClass().getSimpleName() + "[" + _url + "]"; InputStream is = null; URLConnection conn = null; HttpURLConnection httpConn = null; try { conn = _factory.openConnection(_url); httpConn = (HttpURLConnection) conn; httpConn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "text/xml"); OutputStream os; try { os = conn.getOutputStream(); } catch (Exception e) { throw new BurlapRuntimeException(e); } BurlapOutput out = _factory.getBurlapOutput(os); if (!_factory.isOverloadEnabled()) { } else if (args != null) methodName = methodName + "__" + args.length; else methodName = methodName + "__0"; if (log.isLoggable(Level.FINE)) log.fine(this + " calling " + methodName + " (" + method + ")"); out.call(methodName, args); try { os.flush(); } catch (Exception e) { throw new BurlapRuntimeException(e); } if (conn instanceof HttpURLConnection) { httpConn = (HttpURLConnection) conn; int code = 500; try { code = httpConn.getResponseCode(); } catch (Exception e) { } if (code != 200) { StringBuffer sb = new StringBuffer(); int ch; try { is = httpConn.getInputStream(); if (is != null) { while ((ch = is.read()) >= 0) sb.append((char) ch); is.close(); } is = httpConn.getErrorStream(); if (is != null) { while ((ch = is.read()) >= 0) sb.append((char) ch); } } catch (FileNotFoundException e) { throw new BurlapRuntimeException(code + ": " + String.valueOf(e)); } catch (IOException e) { } if (is != null) is.close(); throw new BurlapProtocolException(code + ": " + sb.toString()); } } is = conn.getInputStream(); AbstractBurlapInput in = _factory.getBurlapInput(is); return in.readReply(method.getReturnType()); } catch (BurlapProtocolException e) { throw new BurlapRuntimeException(e); } finally { try { if (is != null) is.close(); } catch (IOException e) { } if (httpConn != null) httpConn.disconnect(); } } }
public class class_name { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); Class[] params = method.getParameterTypes(); // equals and hashCode are special cased if (methodName.equals("equals") && params.length == 1 && params[0].equals(Object.class)) { Object value = args[0]; if (value == null || !Proxy.isProxyClass(value.getClass())) return new Boolean(false); BurlapProxy handler = (BurlapProxy) Proxy.getInvocationHandler(value); return new Boolean(_url.equals(handler.getURL())); } else if (methodName.equals("hashCode") && params.length == 0) return new Integer(_url.hashCode()); else if (methodName.equals("getBurlapType")) return proxy.getClass().getInterfaces()[0].getName(); else if (methodName.equals("getBurlapURL")) return _url.toString(); else if (methodName.equals("toString") && params.length == 0) return getClass().getSimpleName() + "[" + _url + "]"; InputStream is = null; URLConnection conn = null; HttpURLConnection httpConn = null; try { conn = _factory.openConnection(_url); httpConn = (HttpURLConnection) conn; httpConn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "text/xml"); OutputStream os; try { os = conn.getOutputStream(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new BurlapRuntimeException(e); } // depends on control dependency: [catch], data = [none] BurlapOutput out = _factory.getBurlapOutput(os); if (!_factory.isOverloadEnabled()) { } else if (args != null) methodName = methodName + "__" + args.length; else methodName = methodName + "__0"; if (log.isLoggable(Level.FINE)) log.fine(this + " calling " + methodName + " (" + method + ")"); out.call(methodName, args); try { os.flush(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new BurlapRuntimeException(e); } // depends on control dependency: [catch], data = [none] if (conn instanceof HttpURLConnection) { httpConn = (HttpURLConnection) conn; // depends on control dependency: [if], data = [none] int code = 500; try { code = httpConn.getResponseCode(); // depends on control dependency: [try], data = [none] } catch (Exception e) { } // depends on control dependency: [catch], data = [none] if (code != 200) { StringBuffer sb = new StringBuffer(); int ch; try { is = httpConn.getInputStream(); // depends on control dependency: [try], data = [none] if (is != null) { while ((ch = is.read()) >= 0) sb.append((char) ch); is.close(); // depends on control dependency: [if], data = [none] } is = httpConn.getErrorStream(); // depends on control dependency: [try], data = [none] if (is != null) { while ((ch = is.read()) >= 0) sb.append((char) ch); } } catch (FileNotFoundException e) { throw new BurlapRuntimeException(code + ": " + String.valueOf(e)); } catch (IOException e) { // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] if (is != null) is.close(); throw new BurlapProtocolException(code + ": " + sb.toString()); } } is = conn.getInputStream(); AbstractBurlapInput in = _factory.getBurlapInput(is); return in.readReply(method.getReturnType()); } catch (BurlapProtocolException e) { throw new BurlapRuntimeException(e); } finally { try { if (is != null) is.close(); } catch (IOException e) { } // depends on control dependency: [catch], data = [none] if (httpConn != null) httpConn.disconnect(); } } }
public class class_name { public static Period getPeriod(Config config, String path) { try { return config.getPeriod(path); } catch (ConfigException.Missing | ConfigException.WrongType | ConfigException.BadValue e) { if (e instanceof ConfigException.WrongType || e instanceof ConfigException.BadValue) { LOGGER.warn(e.getMessage(), e); } return null; } } }
public class class_name { public static Period getPeriod(Config config, String path) { try { return config.getPeriod(path); // depends on control dependency: [try], data = [none] } catch (ConfigException.Missing | ConfigException.WrongType | ConfigException.BadValue e) { if (e instanceof ConfigException.WrongType || e instanceof ConfigException.BadValue) { LOGGER.warn(e.getMessage(), e); // depends on control dependency: [if], data = [none] } return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected synchronized CmsAliasImportResult importAlias( CmsObject cms, String siteRoot, String aliasPath, String vfsPath, CmsAliasMode mode) throws CmsException { CmsResource resource; Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(siteRoot); resource = cms.readResource(vfsPath); } catch (CmsException e) { return new CmsAliasImportResult( CmsAliasImportStatus.aliasImportError, messageImportCantReadResource(locale, vfsPath), aliasPath, vfsPath, mode); } finally { cms.getRequestContext().setSiteRoot(originalSiteRoot); } if (!CmsAlias.ALIAS_PATTERN.matcher(aliasPath).matches()) { return new CmsAliasImportResult( CmsAliasImportStatus.aliasImportError, messageImportInvalidAliasPath(locale, aliasPath), aliasPath, vfsPath, mode); } List<CmsAlias> maybeAlias = getAliasesForPath(cms, siteRoot, aliasPath); if (maybeAlias.isEmpty()) { CmsAlias newAlias = new CmsAlias(resource.getStructureId(), siteRoot, aliasPath, mode); m_securityManager.addAlias(cms.getRequestContext(), newAlias); touch(cms, resource); return new CmsAliasImportResult( CmsAliasImportStatus.aliasNew, messageImportOk(locale), aliasPath, vfsPath, mode); } else { CmsAlias existingAlias = maybeAlias.get(0); CmsAliasFilter deleteFilter = new CmsAliasFilter( siteRoot, existingAlias.getAliasPath(), existingAlias.getStructureId()); m_securityManager.deleteAliases(cms.getRequestContext(), deleteFilter); CmsAlias newAlias = new CmsAlias(resource.getStructureId(), siteRoot, aliasPath, mode); m_securityManager.addAlias(cms.getRequestContext(), newAlias); touch(cms, resource); return new CmsAliasImportResult( CmsAliasImportStatus.aliasChanged, messageImportUpdate(locale), aliasPath, vfsPath, mode); } } }
public class class_name { protected synchronized CmsAliasImportResult importAlias( CmsObject cms, String siteRoot, String aliasPath, String vfsPath, CmsAliasMode mode) throws CmsException { CmsResource resource; Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(siteRoot); // depends on control dependency: [try], data = [none] resource = cms.readResource(vfsPath); // depends on control dependency: [try], data = [none] } catch (CmsException e) { return new CmsAliasImportResult( CmsAliasImportStatus.aliasImportError, messageImportCantReadResource(locale, vfsPath), aliasPath, vfsPath, mode); } finally { // depends on control dependency: [catch], data = [none] cms.getRequestContext().setSiteRoot(originalSiteRoot); } if (!CmsAlias.ALIAS_PATTERN.matcher(aliasPath).matches()) { return new CmsAliasImportResult( CmsAliasImportStatus.aliasImportError, messageImportInvalidAliasPath(locale, aliasPath), aliasPath, vfsPath, mode); // depends on control dependency: [if], data = [none] } List<CmsAlias> maybeAlias = getAliasesForPath(cms, siteRoot, aliasPath); if (maybeAlias.isEmpty()) { CmsAlias newAlias = new CmsAlias(resource.getStructureId(), siteRoot, aliasPath, mode); m_securityManager.addAlias(cms.getRequestContext(), newAlias); // depends on control dependency: [if], data = [none] touch(cms, resource); // depends on control dependency: [if], data = [none] return new CmsAliasImportResult( CmsAliasImportStatus.aliasNew, messageImportOk(locale), aliasPath, vfsPath, mode); // depends on control dependency: [if], data = [none] } else { CmsAlias existingAlias = maybeAlias.get(0); CmsAliasFilter deleteFilter = new CmsAliasFilter( siteRoot, existingAlias.getAliasPath(), existingAlias.getStructureId()); m_securityManager.deleteAliases(cms.getRequestContext(), deleteFilter); // depends on control dependency: [if], data = [none] CmsAlias newAlias = new CmsAlias(resource.getStructureId(), siteRoot, aliasPath, mode); m_securityManager.addAlias(cms.getRequestContext(), newAlias); // depends on control dependency: [if], data = [none] touch(cms, resource); // depends on control dependency: [if], data = [none] return new CmsAliasImportResult( CmsAliasImportStatus.aliasChanged, messageImportUpdate(locale), aliasPath, vfsPath, mode); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void notifyStartBundlingProcess() { for (BundlingProcessLifeCycleListener listener : lifeCycleListeners) { listener.beforeBundlingProcess(); } processingBundle.set(true); synchronized (processingBundle) { processingBundle.notifyAll(); } } }
public class class_name { protected void notifyStartBundlingProcess() { for (BundlingProcessLifeCycleListener listener : lifeCycleListeners) { listener.beforeBundlingProcess(); // depends on control dependency: [for], data = [listener] } processingBundle.set(true); synchronized (processingBundle) { processingBundle.notifyAll(); } } }
public class class_name { private static boolean validParameter(final TableParameter tp) { if (tp.getNamespace() == null) { return false; } if (tp.getValue() == null) { return false; } return true; } }
public class class_name { private static boolean validParameter(final TableParameter tp) { if (tp.getNamespace() == null) { return false; // depends on control dependency: [if], data = [none] } if (tp.getValue() == null) { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public void unsubscribe(final String tagName, final MFPPushResponseListener<String> listener) { if (isAbleToSubscribe()) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(deviceId, tagName); if (path == DEVICE_ID_NULL) { listener.onFailure(new MFPPushException("The device is not registered yet. Please register device before calling subscriptions API")); return; } logger.debug("MFPPush:unsubscribe() - The tag unsubscription path is: " + path); MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.DELETE, clientSecret); invoker.setResponseListener(new ResponseListener() { @Override public void onSuccess(Response response) { logger.info("MFPPush:unsubscribe() - Tag unsubscription successful. The response is: " + response.toString()); listener.onSuccess(tagName); } @Override public void onFailure(Response response, Throwable throwable, JSONObject jsonObject) { //Error while Unsubscribing to tags. logger.error("MFPPush: Error while Unsubscribing to tags"); listener.onFailure(getException(response,throwable,jsonObject)); } }); invoker.execute(); } } }
public class class_name { public void unsubscribe(final String tagName, final MFPPushResponseListener<String> listener) { if (isAbleToSubscribe()) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(deviceId, tagName); if (path == DEVICE_ID_NULL) { listener.onFailure(new MFPPushException("The device is not registered yet. Please register device before calling subscriptions API")); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } logger.debug("MFPPush:unsubscribe() - The tag unsubscription path is: " + path); // depends on control dependency: [if], data = [none] MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.DELETE, clientSecret); invoker.setResponseListener(new ResponseListener() { @Override public void onSuccess(Response response) { logger.info("MFPPush:unsubscribe() - Tag unsubscription successful. The response is: " + response.toString()); listener.onSuccess(tagName); } @Override public void onFailure(Response response, Throwable throwable, JSONObject jsonObject) { //Error while Unsubscribing to tags. logger.error("MFPPush: Error while Unsubscribing to tags"); listener.onFailure(getException(response,throwable,jsonObject)); } }); // depends on control dependency: [if], data = [none] invoker.execute(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static SkippableIterator and2by2(final SkippableIterator bitmap1, final SkippableIterator bitmap2) { return new SkippableIterator() { boolean hasvalue = false; int currentword = 0; @Override public boolean hasValue() { return this.hasvalue; } public SkippableIterator init() { movetonext(); return this; } public void movetonext() { this.hasvalue = false; if (bitmap1.hasValue() && bitmap2.hasValue()) { while (true) { if (bitmap1.getCurrentWordOffset() < bitmap2 .getCurrentWordOffset()) { bitmap1.advanceUntil(bitmap2.getCurrentWordOffset()); if (!bitmap1.hasValue()) { return; } } else if (bitmap1.getCurrentWordOffset() > bitmap2 .getCurrentWordOffset()) { bitmap2.advanceUntil(bitmap1.getCurrentWordOffset()); if (!bitmap2.hasValue()) { return; } } else { this.currentword = bitmap1.getCurrentWord() & bitmap2.getCurrentWord(); if (this.currentword != 0) { this.hasvalue = true; return; } bitmap1.advance(); if (bitmap1.hasValue()) { bitmap2.advanceUntil(bitmap1 .getCurrentWordOffset()); if (bitmap2.hasValue()) { continue; } } return; } } } } @Override public void advance() { bitmap1.advance(); if (bitmap1.hasValue()) { bitmap2.advanceUntil(bitmap1.getCurrentWordOffset()); movetonext(); } else this.hasvalue = false; } @Override public void advanceUntil(int min) { bitmap1.advanceUntil(min); if (bitmap1.hasValue()) { bitmap2.advanceUntil(bitmap1.getCurrentWordOffset()); movetonext(); } else this.hasvalue = false; } @Override public int getCurrentWord() { return this.currentword; } @Override public int getCurrentWordOffset() { return bitmap1.getCurrentWordOffset();// could be bitmap2, they // must be equal } }.init(); } }
public class class_name { public static SkippableIterator and2by2(final SkippableIterator bitmap1, final SkippableIterator bitmap2) { return new SkippableIterator() { boolean hasvalue = false; int currentword = 0; @Override public boolean hasValue() { return this.hasvalue; } public SkippableIterator init() { movetonext(); return this; } public void movetonext() { this.hasvalue = false; if (bitmap1.hasValue() && bitmap2.hasValue()) { while (true) { if (bitmap1.getCurrentWordOffset() < bitmap2 .getCurrentWordOffset()) { bitmap1.advanceUntil(bitmap2.getCurrentWordOffset()); // depends on control dependency: [if], data = [none] if (!bitmap1.hasValue()) { return; // depends on control dependency: [if], data = [none] } } else if (bitmap1.getCurrentWordOffset() > bitmap2 .getCurrentWordOffset()) { bitmap2.advanceUntil(bitmap1.getCurrentWordOffset()); // depends on control dependency: [if], data = [(bitmap1.getCurr] if (!bitmap2.hasValue()) { return; // depends on control dependency: [if], data = [none] } } else { this.currentword = bitmap1.getCurrentWord() & bitmap2.getCurrentWord(); // depends on control dependency: [if], data = [none] if (this.currentword != 0) { this.hasvalue = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } bitmap1.advance(); // depends on control dependency: [if], data = [none] if (bitmap1.hasValue()) { bitmap2.advanceUntil(bitmap1 .getCurrentWordOffset()); // depends on control dependency: [if], data = [none] if (bitmap2.hasValue()) { continue; } } return; // depends on control dependency: [if], data = [none] } } } } @Override public void advance() { bitmap1.advance(); if (bitmap1.hasValue()) { bitmap2.advanceUntil(bitmap1.getCurrentWordOffset()); // depends on control dependency: [if], data = [none] movetonext(); // depends on control dependency: [if], data = [none] } else this.hasvalue = false; } @Override public void advanceUntil(int min) { bitmap1.advanceUntil(min); if (bitmap1.hasValue()) { bitmap2.advanceUntil(bitmap1.getCurrentWordOffset()); // depends on control dependency: [if], data = [none] movetonext(); // depends on control dependency: [if], data = [none] } else this.hasvalue = false; } @Override public int getCurrentWord() { return this.currentword; } @Override public int getCurrentWordOffset() { return bitmap1.getCurrentWordOffset();// could be bitmap2, they // must be equal } }.init(); } }
public class class_name { public EClass getIfcIntegerCountRateMeasure() { if (ifcIntegerCountRateMeasureEClass == null) { ifcIntegerCountRateMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(689); } return ifcIntegerCountRateMeasureEClass; } }
public class class_name { public EClass getIfcIntegerCountRateMeasure() { if (ifcIntegerCountRateMeasureEClass == null) { ifcIntegerCountRateMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(689); // depends on control dependency: [if], data = [none] } return ifcIntegerCountRateMeasureEClass; } }
public class class_name { private String getState(CmsPublishJobFinished publishJob) { byte[] reportBytes = null; try { reportBytes = OpenCms.getPublishManager().getReportContents(publishJob); } catch (CmsException e) { //Can't read report -> error return STATE_ERROR; } if (reportBytes != null) { String report = new String(reportBytes); if (report.indexOf("<span class='err'>") > -1) { //Report contains error span return STATE_ERROR; } if (report.indexOf("<span class='warn'>") > -1) { //Report contains warning span return STATE_WARNING; } } //no warning or error state detected -> ok return STATE_OK; } }
public class class_name { private String getState(CmsPublishJobFinished publishJob) { byte[] reportBytes = null; try { reportBytes = OpenCms.getPublishManager().getReportContents(publishJob); // depends on control dependency: [try], data = [none] } catch (CmsException e) { //Can't read report -> error return STATE_ERROR; } // depends on control dependency: [catch], data = [none] if (reportBytes != null) { String report = new String(reportBytes); if (report.indexOf("<span class='err'>") > -1) { //Report contains error span return STATE_ERROR; // depends on control dependency: [if], data = [none] } if (report.indexOf("<span class='warn'>") > -1) { //Report contains warning span return STATE_WARNING; // depends on control dependency: [if], data = [none] } } //no warning or error state detected -> ok return STATE_OK; } }
public class class_name { private void initMainParameterValue(String arg) { if (mainParameter == null) { throw new ParameterException( "Was passed main parameter '" + arg + "' but no main parameter was defined in your arg class"); } Object object = mainParameter.parameterized.get(mainParameter.object); Class<?> type = mainParameter.parameterized.getType(); // If it's a List<String>, we might need to create that list and then add the value to it. if (List.class.isAssignableFrom(type)) { List result; if (object == null) { result = Lists.newArrayList(); } else { result = (List) object; } if (mainParameter.firstTimeMainParameter) { result.clear(); mainParameter.firstTimeMainParameter = false; } mainParameter.multipleValue = result; mainParameter.parameterized.set(mainParameter.object, result); } } }
public class class_name { private void initMainParameterValue(String arg) { if (mainParameter == null) { throw new ParameterException( "Was passed main parameter '" + arg + "' but no main parameter was defined in your arg class"); } Object object = mainParameter.parameterized.get(mainParameter.object); Class<?> type = mainParameter.parameterized.getType(); // If it's a List<String>, we might need to create that list and then add the value to it. if (List.class.isAssignableFrom(type)) { List result; if (object == null) { result = Lists.newArrayList(); // depends on control dependency: [if], data = [none] } else { result = (List) object; // depends on control dependency: [if], data = [none] } if (mainParameter.firstTimeMainParameter) { result.clear(); // depends on control dependency: [if], data = [none] mainParameter.firstTimeMainParameter = false; // depends on control dependency: [if], data = [none] } mainParameter.multipleValue = result; // depends on control dependency: [if], data = [none] mainParameter.parameterized.set(mainParameter.object, result); // depends on control dependency: [if], data = [none] } } }
public class class_name { @VisibleForTesting protected long getLowWatermark(ExtractType extractType, WatermarkType watermarkType, long previousWatermark, int deltaForNextWatermark) { long lowWatermark = ConfigurationKeys.DEFAULT_WATERMARK_VALUE; if (this.isFullDump() || this.isWatermarkOverride()) { String timeZone = this.state.getProp(ConfigurationKeys.SOURCE_TIMEZONE, ConfigurationKeys.DEFAULT_SOURCE_TIMEZONE); /* * SOURCE_QUERYBASED_START_VALUE could be: * - a simple string, e.g. "12345" * - a timestamp string, e.g. "20140101000000" * - a string with a time directive, e.g. "CURRENTDAY-X", "CURRENTHOUR-X", (X is a number) */ lowWatermark = Utils.getLongWithCurrentDate(this.state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_START_VALUE), timeZone); LOG.info("Overriding low water mark with the given start value: " + lowWatermark); } else { if (isSnapshot(extractType)) { lowWatermark = this.getSnapshotLowWatermark(watermarkType, previousWatermark, deltaForNextWatermark); } else { lowWatermark = this.getAppendLowWatermark(watermarkType, previousWatermark, deltaForNextWatermark); } } return (lowWatermark == 0 ? ConfigurationKeys.DEFAULT_WATERMARK_VALUE : lowWatermark); } }
public class class_name { @VisibleForTesting protected long getLowWatermark(ExtractType extractType, WatermarkType watermarkType, long previousWatermark, int deltaForNextWatermark) { long lowWatermark = ConfigurationKeys.DEFAULT_WATERMARK_VALUE; if (this.isFullDump() || this.isWatermarkOverride()) { String timeZone = this.state.getProp(ConfigurationKeys.SOURCE_TIMEZONE, ConfigurationKeys.DEFAULT_SOURCE_TIMEZONE); /* * SOURCE_QUERYBASED_START_VALUE could be: * - a simple string, e.g. "12345" * - a timestamp string, e.g. "20140101000000" * - a string with a time directive, e.g. "CURRENTDAY-X", "CURRENTHOUR-X", (X is a number) */ lowWatermark = Utils.getLongWithCurrentDate(this.state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_START_VALUE), timeZone); // depends on control dependency: [if], data = [none] LOG.info("Overriding low water mark with the given start value: " + lowWatermark); // depends on control dependency: [if], data = [none] } else { if (isSnapshot(extractType)) { lowWatermark = this.getSnapshotLowWatermark(watermarkType, previousWatermark, deltaForNextWatermark); // depends on control dependency: [if], data = [none] } else { lowWatermark = this.getAppendLowWatermark(watermarkType, previousWatermark, deltaForNextWatermark); // depends on control dependency: [if], data = [none] } } return (lowWatermark == 0 ? ConfigurationKeys.DEFAULT_WATERMARK_VALUE : lowWatermark); } }
public class class_name { protected void bufferize(byte b) { if (index == buffer.length) { byte[] newBuffer = new byte[buffer.length * 2]; System.arraycopy(buffer, 0, newBuffer, 0, index); buffer = newBuffer; } buffer[index++] = b; } }
public class class_name { protected void bufferize(byte b) { if (index == buffer.length) { byte[] newBuffer = new byte[buffer.length * 2]; System.arraycopy(buffer, 0, newBuffer, 0, index); // depends on control dependency: [if], data = [none] buffer = newBuffer; // depends on control dependency: [if], data = [none] } buffer[index++] = b; } }
public class class_name { public static String normalizeExponents(String input) { Matcher m = eExp.matcher(input); if (m.find()) { Float number = Float.parseFloat(m.group(1)); int exp = Integer.parseInt(m.group(3)); boolean negative = m.group(2) != null && m.group(2).equals("-"); if (negative) exp *= -1; return FORMATTER.format(number * Math.pow(10, exp)); } // TODO refactor into 1 m = xExp.matcher(input); if (m.find()) { Float number = Float.parseFloat(m.group(1)); int exp = Integer.parseInt(m.group(3)); boolean negative = m.group(2) != null && m.group(2).equals("-"); if (negative) exp *= -1; String s = FORMATTER.format(number * Math.pow(10, exp)); return s; } return input; } }
public class class_name { public static String normalizeExponents(String input) { Matcher m = eExp.matcher(input); if (m.find()) { Float number = Float.parseFloat(m.group(1)); int exp = Integer.parseInt(m.group(3)); boolean negative = m.group(2) != null && m.group(2).equals("-"); if (negative) exp *= -1; return FORMATTER.format(number * Math.pow(10, exp)); // depends on control dependency: [if], data = [none] } // TODO refactor into 1 m = xExp.matcher(input); if (m.find()) { Float number = Float.parseFloat(m.group(1)); int exp = Integer.parseInt(m.group(3)); boolean negative = m.group(2) != null && m.group(2).equals("-"); if (negative) exp *= -1; String s = FORMATTER.format(number * Math.pow(10, exp)); return s; // depends on control dependency: [if], data = [none] } return input; } }
public class class_name { public CmsLinkTable getLinkTable(String name, Locale locale) { CmsXmlHtmlValue value = (CmsXmlHtmlValue)getValue(name, locale); if (value != null) { return value.getLinkTable(); } return new CmsLinkTable(); } }
public class class_name { public CmsLinkTable getLinkTable(String name, Locale locale) { CmsXmlHtmlValue value = (CmsXmlHtmlValue)getValue(name, locale); if (value != null) { return value.getLinkTable(); // depends on control dependency: [if], data = [none] } return new CmsLinkTable(); } }
public class class_name { public TranslationRequest addCode(String theSystem, String theCode) { Validate.notBlank(theSystem, "theSystem must not be null"); Validate.notBlank(theCode, "theCode must not be null"); if (getCodeableConcept() == null) { setCodeableConcept(new CodeableConcept()); } getCodeableConcept().addCoding(new Coding().setSystem(theSystem).setCode(theCode)); return this; } }
public class class_name { public TranslationRequest addCode(String theSystem, String theCode) { Validate.notBlank(theSystem, "theSystem must not be null"); Validate.notBlank(theCode, "theCode must not be null"); if (getCodeableConcept() == null) { setCodeableConcept(new CodeableConcept()); // depends on control dependency: [if], data = [none] } getCodeableConcept().addCoding(new Coding().setSystem(theSystem).setCode(theCode)); return this; } }
public class class_name { private boolean readSlab(String channel, ByteBuffer slabId, SlabCursor cursor, boolean open, EventSink sink) { int start = cursor.get(); if (start == SlabCursor.END) { return true; } boolean recent = isRecent(slabId); // Event add and delete write with local quorum, so read with local quorum to get a consistent view of things. // Using a lower consistency level could result in (a) duplicate events because we miss deletes and (b) // incorrectly closing or deleting slabs when slabs look empty if we miss adds. ColumnList<Integer> eventColumns = execute( _keyspace.prepareQuery(ColumnFamilies.SLAB, ConsistencyLevel.CL_LOCAL_QUORUM) .getKey(slabId) .withColumnRange(start, Constants.OPEN_SLAB_MARKER, false, Integer.MAX_VALUE)); boolean searching = true; boolean empty = (start == 0); // If we skipped events in the query we must assume the slab isn't empty. boolean more = false; int next = start; for (Column<Integer> eventColumn : eventColumns) { int eventIdx = eventColumn.getName(); // Open slabs have a dummy entry at maxint that indicates that this slab is still open. if (eventIdx == Constants.OPEN_SLAB_MARKER) { break; } // Found at least one data item. empty = false; if (!searching) { more = true; // There are more events to be found next time we poll this slab. break; } // Pass the data on to the EventSink. It will tell us whether or not to keep searching. EventId eventId = AstyanaxEventId.create(channel, slabId, eventIdx); ByteBuffer eventData = eventColumn.getByteBufferValue(); searching = sink.accept(eventId, eventData); next = eventIdx; } // Next time we query this slab start the search with last event received by the sink, repeating it. cursor.set(next); // Stale open slab? Rare, should only happen when a writer crashes without cleaning up and closing its open // slabs. Normally writers re-write the OPEN_SLAB_MARKER column on every write as a sort of heartbeat. Readers // detect "stale" slabs when the open slab markers expire, and they close those slabs on behalf of the crashed writers. boolean hasOpenSlabMarker = !eventColumns.isEmpty() && eventColumns.getColumnByIndex(eventColumns.size() - 1).getName() == Constants.OPEN_SLAB_MARKER; boolean stale = open && !recent && !hasOpenSlabMarker; if (stale) { _staleSlabMeter.mark(); } // If the slab is currently closed or should be closed then it will never receive more data so check to see if // we can (a) delete it (it's empty) or at least (b) close it. if (empty && (!open || stale)) { deleteEmptySlabAsync(channel, slabId); open = false; } else if (stale) { closeStaleSlabAsync(channel, slabId); open = false; } // If we ran through all the data in a closed slab, skip this slab next time. This is especially common with // badly-behaving Databus listeners that poll repeatedly but don't ack. if (!more && !open) { cursor.set(SlabCursor.END); } return searching; } }
public class class_name { private boolean readSlab(String channel, ByteBuffer slabId, SlabCursor cursor, boolean open, EventSink sink) { int start = cursor.get(); if (start == SlabCursor.END) { return true; // depends on control dependency: [if], data = [none] } boolean recent = isRecent(slabId); // Event add and delete write with local quorum, so read with local quorum to get a consistent view of things. // Using a lower consistency level could result in (a) duplicate events because we miss deletes and (b) // incorrectly closing or deleting slabs when slabs look empty if we miss adds. ColumnList<Integer> eventColumns = execute( _keyspace.prepareQuery(ColumnFamilies.SLAB, ConsistencyLevel.CL_LOCAL_QUORUM) .getKey(slabId) .withColumnRange(start, Constants.OPEN_SLAB_MARKER, false, Integer.MAX_VALUE)); boolean searching = true; boolean empty = (start == 0); // If we skipped events in the query we must assume the slab isn't empty. boolean more = false; int next = start; for (Column<Integer> eventColumn : eventColumns) { int eventIdx = eventColumn.getName(); // Open slabs have a dummy entry at maxint that indicates that this slab is still open. if (eventIdx == Constants.OPEN_SLAB_MARKER) { break; } // Found at least one data item. empty = false; // depends on control dependency: [for], data = [none] if (!searching) { more = true; // There are more events to be found next time we poll this slab. // depends on control dependency: [if], data = [none] break; } // Pass the data on to the EventSink. It will tell us whether or not to keep searching. EventId eventId = AstyanaxEventId.create(channel, slabId, eventIdx); ByteBuffer eventData = eventColumn.getByteBufferValue(); searching = sink.accept(eventId, eventData); // depends on control dependency: [for], data = [none] next = eventIdx; // depends on control dependency: [for], data = [none] } // Next time we query this slab start the search with last event received by the sink, repeating it. cursor.set(next); // Stale open slab? Rare, should only happen when a writer crashes without cleaning up and closing its open // slabs. Normally writers re-write the OPEN_SLAB_MARKER column on every write as a sort of heartbeat. Readers // detect "stale" slabs when the open slab markers expire, and they close those slabs on behalf of the crashed writers. boolean hasOpenSlabMarker = !eventColumns.isEmpty() && eventColumns.getColumnByIndex(eventColumns.size() - 1).getName() == Constants.OPEN_SLAB_MARKER; boolean stale = open && !recent && !hasOpenSlabMarker; if (stale) { _staleSlabMeter.mark(); // depends on control dependency: [if], data = [none] } // If the slab is currently closed or should be closed then it will never receive more data so check to see if // we can (a) delete it (it's empty) or at least (b) close it. if (empty && (!open || stale)) { deleteEmptySlabAsync(channel, slabId); // depends on control dependency: [if], data = [none] open = false; // depends on control dependency: [if], data = [none] } else if (stale) { closeStaleSlabAsync(channel, slabId); // depends on control dependency: [if], data = [none] open = false; // depends on control dependency: [if], data = [none] } // If we ran through all the data in a closed slab, skip this slab next time. This is especially common with // badly-behaving Databus listeners that poll repeatedly but don't ack. if (!more && !open) { cursor.set(SlabCursor.END); // depends on control dependency: [if], data = [none] } return searching; } }
public class class_name { public static void startServerComms() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "startServerComms"); try { ServerConnectionManager.initialise(new AcceptListenerFactoryImpl()); } catch (Throwable t) { FFDCFilter.processException(t, CLASS_NAME + ".startServerComms", CommsConstants.SERVERTRANSPORTFACTORY_INIT_02, null); SibTr.error(tc, "SERVER_FAILED_TO_START_SICO2004", t); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "startServerComms"); } }
public class class_name { public static void startServerComms() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "startServerComms"); try { ServerConnectionManager.initialise(new AcceptListenerFactoryImpl()); // depends on control dependency: [try], data = [none] } catch (Throwable t) { FFDCFilter.processException(t, CLASS_NAME + ".startServerComms", CommsConstants.SERVERTRANSPORTFACTORY_INIT_02, null); SibTr.error(tc, "SERVER_FAILED_TO_START_SICO2004", t); } // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "startServerComms"); } }
public class class_name { public void marshall(DeleteAppRequest deleteAppRequest, ProtocolMarshaller protocolMarshaller) { if (deleteAppRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteAppRequest.getApplicationId(), APPLICATIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteAppRequest deleteAppRequest, ProtocolMarshaller protocolMarshaller) { if (deleteAppRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteAppRequest.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Result render(Entry<String, Object> entry) { if (this.renderable == null) { Map<String, Object> map = Maps.newHashMap(); this.renderable = map; map.put(entry.getKey(), entry.getValue()); } else { assertObjectNoRenderableOrThrowException(this.renderable); Map<String, Object> map; if (this.renderable instanceof Map) { map = (Map) this.renderable; if (map.containsKey(entry.getKey())) { throw new IllegalArgumentException( String.format( "Entry with key %s already stored inside this Result object. " + "This is currently not supported and does not make sense. " + "Consider using your own map.", entry.getKey())); } else { map.put(entry.getKey(), entry.getValue()); } } else { map = Maps.newHashMap(); map.put( SwissKnife.getRealClassNameLowerCamelCase(this.renderable), this.renderable); this.renderable = map; } map.put(entry.getKey(), entry.getValue()); } return this; } }
public class class_name { public Result render(Entry<String, Object> entry) { if (this.renderable == null) { Map<String, Object> map = Maps.newHashMap(); this.renderable = map; // depends on control dependency: [if], data = [none] map.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none] } else { assertObjectNoRenderableOrThrowException(this.renderable); // depends on control dependency: [if], data = [(this.renderable] Map<String, Object> map; if (this.renderable instanceof Map) { map = (Map) this.renderable; // depends on control dependency: [if], data = [none] if (map.containsKey(entry.getKey())) { throw new IllegalArgumentException( String.format( "Entry with key %s already stored inside this Result object. " + "This is currently not supported and does not make sense. " + "Consider using your own map.", entry.getKey())); } else { map.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none] } } else { map = Maps.newHashMap(); // depends on control dependency: [if], data = [none] map.put( SwissKnife.getRealClassNameLowerCamelCase(this.renderable), this.renderable); // depends on control dependency: [if], data = [none] this.renderable = map; // depends on control dependency: [if], data = [none] } map.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public void zeroOut() { for (long off = baseOffset; off < baseOffset + length * WIDTH; off += WIDTH) { Platform.putLong(baseObj, off, 0); } } }
public class class_name { public void zeroOut() { for (long off = baseOffset; off < baseOffset + length * WIDTH; off += WIDTH) { Platform.putLong(baseObj, off, 0); // depends on control dependency: [for], data = [off] } } }
public class class_name { private LVal parseLValTerm(int start, EnclosingScope scope) { checkNotEof(); start = index; // First, attempt to disambiguate the easy forms: Token lookahead = tokens.get(index); switch (lookahead.kind) { case Identifier: Identifier name = parseIdentifier(); LVal var; if(scope.isVariable(name)) { var = new Expr.VariableAccess(Type.Void, scope.getVariableDeclaration(name)); } else { var = new Expr.StaticVariableAccess(Type.Void, new Decl.Link<>(new Name(name))); } return annotateSourceLocation(var, start); case LeftBrace: { match(LeftBrace); LVal lval = parseLVal(start, scope); match(RightBrace); return lval; } case Star: { match(Star); LVal lval = parseLVal(start, scope); return annotateSourceLocation(new Expr.Dereference(Type.Void, lval), start); } default: syntaxError("unrecognised lval", lookahead); return null; // dead-code } } }
public class class_name { private LVal parseLValTerm(int start, EnclosingScope scope) { checkNotEof(); start = index; // First, attempt to disambiguate the easy forms: Token lookahead = tokens.get(index); switch (lookahead.kind) { case Identifier: Identifier name = parseIdentifier(); LVal var; if(scope.isVariable(name)) { var = new Expr.VariableAccess(Type.Void, scope.getVariableDeclaration(name)); // depends on control dependency: [if], data = [none] } else { var = new Expr.StaticVariableAccess(Type.Void, new Decl.Link<>(new Name(name))); // depends on control dependency: [if], data = [none] } return annotateSourceLocation(var, start); case LeftBrace: { match(LeftBrace); LVal lval = parseLVal(start, scope); match(RightBrace); return lval; } case Star: { match(Star); LVal lval = parseLVal(start, scope); return annotateSourceLocation(new Expr.Dereference(Type.Void, lval), start); } default: syntaxError("unrecognised lval", lookahead); return null; // dead-code } } }
public class class_name { E unlink(Node<E> x) { // assert x != null; final E element = x.item; final Node<E> next = x.next; final Node<E> prev = x.prev; if (prev == null) { first = next; } else { prev.next = next; x.prev = null; } if (next == null) { last = prev; } else { next.prev = prev; x.next = null; } x.item = null; size--; modCount++; return element; } }
public class class_name { E unlink(Node<E> x) { // assert x != null; final E element = x.item; final Node<E> next = x.next; final Node<E> prev = x.prev; if (prev == null) { first = next; // depends on control dependency: [if], data = [none] } else { prev.next = next; // depends on control dependency: [if], data = [none] x.prev = null; // depends on control dependency: [if], data = [none] } if (next == null) { last = prev; // depends on control dependency: [if], data = [none] } else { next.prev = prev; // depends on control dependency: [if], data = [none] x.next = null; // depends on control dependency: [if], data = [none] } x.item = null; size--; modCount++; return element; } }
public class class_name { public static void cursorShortToContentValuesIfPresent(Cursor cursor, ContentValues values, String column) { final int index = cursor.getColumnIndex(column); if (index != -1 && !cursor.isNull(index)) { values.put(column, cursor.getShort(index)); } } }
public class class_name { public static void cursorShortToContentValuesIfPresent(Cursor cursor, ContentValues values, String column) { final int index = cursor.getColumnIndex(column); if (index != -1 && !cursor.isNull(index)) { values.put(column, cursor.getShort(index)); // depends on control dependency: [if], data = [(index] } } }
public class class_name { public boolean getFieldsInto(int[] positions, Value[] targets) { for (int i = 0; i < positions.length; i++) { if (!getFieldInto(positions[i], targets[i])) { return false; } } return true; } }
public class class_name { public boolean getFieldsInto(int[] positions, Value[] targets) { for (int i = 0; i < positions.length; i++) { if (!getFieldInto(positions[i], targets[i])) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public FieldInfo getField(int iFieldSeq) { iFieldSeq -= Constants.MAIN_FIELD; // Zero based index try { return (FieldInfo)m_vFieldInfo.elementAt(iFieldSeq); } catch (ArrayIndexOutOfBoundsException ex) { } return null; // Not found } }
public class class_name { public FieldInfo getField(int iFieldSeq) { iFieldSeq -= Constants.MAIN_FIELD; // Zero based index try { return (FieldInfo)m_vFieldInfo.elementAt(iFieldSeq); // depends on control dependency: [try], data = [none] } catch (ArrayIndexOutOfBoundsException ex) { } // depends on control dependency: [catch], data = [none] return null; // Not found } }
public class class_name { @Nullable @GuardedBy("lock") protected Peer connectTo(PeerAddress address, boolean incrementMaxConnections, int connectTimeoutMillis) { checkState(lock.isHeldByCurrentThread()); VersionMessage ver = getVersionMessage().duplicate(); ver.bestHeight = chain == null ? 0 : chain.getBestChainHeight(); ver.time = Utils.currentTimeSeconds(); ver.receivingAddr = address; ver.receivingAddr.setParent(ver); Peer peer = createPeer(address, ver); peer.addConnectedEventListener(Threading.SAME_THREAD, startupListener); peer.addDisconnectedEventListener(Threading.SAME_THREAD, startupListener); peer.setMinProtocolVersion(vMinRequiredProtocolVersion); pendingPeers.add(peer); try { log.info("Attempting connection to {} ({} connected, {} pending, {} max)", address, peers.size(), pendingPeers.size(), maxConnections); ListenableFuture<SocketAddress> future = channels.openConnection(address.toSocketAddress(), peer); if (future.isDone()) Uninterruptibles.getUninterruptibly(future); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); log.warn("Failed to connect to " + address + ": " + cause.getMessage()); handlePeerDeath(peer, cause); return null; } peer.setSocketTimeout(connectTimeoutMillis); // When the channel has connected and version negotiated successfully, handleNewPeer will end up being called on // a worker thread. if (incrementMaxConnections) { // We don't use setMaxConnections here as that would trigger a recursive attempt to establish a new // outbound connection. maxConnections++; } return peer; } }
public class class_name { @Nullable @GuardedBy("lock") protected Peer connectTo(PeerAddress address, boolean incrementMaxConnections, int connectTimeoutMillis) { checkState(lock.isHeldByCurrentThread()); VersionMessage ver = getVersionMessage().duplicate(); ver.bestHeight = chain == null ? 0 : chain.getBestChainHeight(); ver.time = Utils.currentTimeSeconds(); ver.receivingAddr = address; ver.receivingAddr.setParent(ver); Peer peer = createPeer(address, ver); peer.addConnectedEventListener(Threading.SAME_THREAD, startupListener); peer.addDisconnectedEventListener(Threading.SAME_THREAD, startupListener); peer.setMinProtocolVersion(vMinRequiredProtocolVersion); pendingPeers.add(peer); try { log.info("Attempting connection to {} ({} connected, {} pending, {} max)", address, peers.size(), pendingPeers.size(), maxConnections); ListenableFuture<SocketAddress> future = channels.openConnection(address.toSocketAddress(), peer); // depends on control dependency: [try], data = [none] if (future.isDone()) Uninterruptibles.getUninterruptibly(future); } catch (ExecutionException e) { Throwable cause = Throwables.getRootCause(e); log.warn("Failed to connect to " + address + ": " + cause.getMessage()); handlePeerDeath(peer, cause); return null; } // depends on control dependency: [catch], data = [none] peer.setSocketTimeout(connectTimeoutMillis); // When the channel has connected and version negotiated successfully, handleNewPeer will end up being called on // a worker thread. if (incrementMaxConnections) { // We don't use setMaxConnections here as that would trigger a recursive attempt to establish a new // outbound connection. maxConnections++; // depends on control dependency: [if], data = [none] } return peer; } }
public class class_name { public void getCalendarDateFromFixedDate(CalendarDate date, long fixedDate) { Date gdate = (Date) date; int year; long jan1; boolean isLeap; if (gdate.hit(fixedDate)) { year = gdate.getCachedYear(); jan1 = gdate.getCachedJan1(); isLeap = isLeapYear(year); } else { // Looking up FIXED_DATES[] here didn't improve performance // much. So we calculate year and jan1. getFixedDate() // will look up FIXED_DATES[] actually. year = getGregorianYearFromFixedDate(fixedDate); jan1 = getFixedDate(year, JANUARY, 1, null); isLeap = isLeapYear(year); // Update the cache data gdate.setCache (year, jan1, isLeap ? 366 : 365); } int priorDays = (int)(fixedDate - jan1); long mar1 = jan1 + 31 + 28; if (isLeap) { ++mar1; } if (fixedDate >= mar1) { priorDays += isLeap ? 1 : 2; } int month = 12 * priorDays + 373; if (month > 0) { month /= 367; } else { month = CalendarUtils.floorDivide(month, 367); } long month1 = jan1 + ACCUMULATED_DAYS_IN_MONTH[month]; if (isLeap && month >= MARCH) { ++month1; } int dayOfMonth = (int)(fixedDate - month1) + 1; int dayOfWeek = getDayOfWeekFromFixedDate(fixedDate); assert dayOfWeek > 0 : "negative day of week " + dayOfWeek; gdate.setNormalizedYear(year); gdate.setMonth(month); gdate.setDayOfMonth(dayOfMonth); gdate.setDayOfWeek(dayOfWeek); gdate.setLeapYear(isLeap); gdate.setNormalized(true); } }
public class class_name { public void getCalendarDateFromFixedDate(CalendarDate date, long fixedDate) { Date gdate = (Date) date; int year; long jan1; boolean isLeap; if (gdate.hit(fixedDate)) { year = gdate.getCachedYear(); // depends on control dependency: [if], data = [none] jan1 = gdate.getCachedJan1(); // depends on control dependency: [if], data = [none] isLeap = isLeapYear(year); // depends on control dependency: [if], data = [none] } else { // Looking up FIXED_DATES[] here didn't improve performance // much. So we calculate year and jan1. getFixedDate() // will look up FIXED_DATES[] actually. year = getGregorianYearFromFixedDate(fixedDate); // depends on control dependency: [if], data = [none] jan1 = getFixedDate(year, JANUARY, 1, null); // depends on control dependency: [if], data = [none] isLeap = isLeapYear(year); // depends on control dependency: [if], data = [none] // Update the cache data gdate.setCache (year, jan1, isLeap ? 366 : 365); // depends on control dependency: [if], data = [none] } int priorDays = (int)(fixedDate - jan1); long mar1 = jan1 + 31 + 28; if (isLeap) { ++mar1; // depends on control dependency: [if], data = [none] } if (fixedDate >= mar1) { priorDays += isLeap ? 1 : 2; // depends on control dependency: [if], data = [none] } int month = 12 * priorDays + 373; if (month > 0) { month /= 367; // depends on control dependency: [if], data = [none] } else { month = CalendarUtils.floorDivide(month, 367); // depends on control dependency: [if], data = [(month] } long month1 = jan1 + ACCUMULATED_DAYS_IN_MONTH[month]; if (isLeap && month >= MARCH) { ++month1; // depends on control dependency: [if], data = [none] } int dayOfMonth = (int)(fixedDate - month1) + 1; int dayOfWeek = getDayOfWeekFromFixedDate(fixedDate); assert dayOfWeek > 0 : "negative day of week " + dayOfWeek; gdate.setNormalizedYear(year); gdate.setMonth(month); gdate.setDayOfMonth(dayOfMonth); gdate.setDayOfWeek(dayOfWeek); gdate.setLeapYear(isLeap); gdate.setNormalized(true); } }
public class class_name { private void requestCameraPermission() { int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA); if( permissionCheck != android.content.pm.PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 0); // a dialog should open and this dialog will resume when a decision has been made } } }
public class class_name { private void requestCameraPermission() { int permissionCheck = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA); if( permissionCheck != android.content.pm.PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 0); // depends on control dependency: [if], data = [none] // a dialog should open and this dialog will resume when a decision has been made } } }
public class class_name { private void rcvDirectConnect(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rcvDirectConnect", new Object[] { request, conversation, Integer.valueOf(requestNumber), Boolean.valueOf(allocatedFromBufferPool), Boolean.valueOf(partOfExchange) }); ConversationState convState = (ConversationState) conversation.getAttachment(); /**************************************************************/ /* ME Name */ /**************************************************************/ String meName = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Me Name", meName); /**************************************************************/ /* Bus Name */ /**************************************************************/ String busName = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Bus Name", busName); /**************************************************************/ /* User Id */ /**************************************************************/ String userId = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "User Id", userId); /**************************************************************/ /* Password */ /**************************************************************/ String password = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Password", "****"); //Liberty COMMS TODO // Has to be replaced with proper security code // For now just have some dummy subject as this flow would not get called in any of current functionality // First authenticate the user /* * SibLoginFactory loginFactory = SibLoginFactory.getInstance(); * final ConnectionMetaData loginMetaData = new ConnectionMetaDataImpl(conversation.getMetaData(), null); * Subject subject = loginFactory.createNewSibLogin().login(busName, * userId, * password, * loginMetaData); */ Subject subject = new Subject(); if (subject == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Authentication failed"); StaticCATHelper.sendExceptionToClient(new SIAuthenticationException(null), null, conversation, requestNumber); } else { // Now invoke the Direct connection method TrmSingleton trmSingleton = TrmSingleton.getTrmSingleton(); ComponentData componentData = (ComponentData) trmSingleton.getComponentData(); ConnectionMetaDataImpl metaData = new ConnectionMetaDataImpl(conversation.getMetaData(), conversation.getHandshakeProperties()); DirectConnectionImpl connProps = new DirectConnectionImpl(metaData); connProps.setBus(busName); connProps.setName(meName); boolean rc = componentData.directConnect(connProps, subject); SICoreConnection conn = connProps.getSICoreConnection(); if (!rc || conn == null) { // TRM failed to locate an ME or Bus for us if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "TRM did not allocate us a connection"); StaticCATHelper.sendExceptionToClient(new SIResourceException(), null, conversation, requestNumber); } else { try { // Otherwise we got a connection ok, so stash it in the object store ServerSideConnection cc = new ServerSideConnection(conversation); convState.setCommsConnection(cc); convState.addObject(cc); // Save the SICoreConnection short objId = (short) convState.addObject(new CATConnection(conn)); convState.setConnectionObjectId(objId); cc.setSICoreConnection(conn); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "SICoreConnection object ID", "" + objId); // Register the connection listener attachConnectionListener(conversation, conn); // Also grab the unique message id stem byte[] idStem = conn.createUniqueId(); // Now send back a reply CommsByteBuffer reply = poolManager.allocate(); reply.putShort(objId); reply.putShort((short) idStem.length); reply.put(idStem); try { conversation.send(reply, JFapChannelConstants.SEG_DIRECT_CONNECT_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".,rcvDirectConnect", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_02, this); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2019", e); } } catch (ConversationStateFullException e) { FFDCFilter.processException(e, CLASS_NAME + ".,rcvDirectConnect", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_01, conversation, requestNumber); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".,rcvDirectConnect", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_03, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_03, conversation, requestNumber); } } } request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rcvDirectConnect"); } }
public class class_name { private void rcvDirectConnect(CommsByteBuffer request, Conversation conversation, int requestNumber, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rcvDirectConnect", new Object[] { request, conversation, Integer.valueOf(requestNumber), Boolean.valueOf(allocatedFromBufferPool), Boolean.valueOf(partOfExchange) }); ConversationState convState = (ConversationState) conversation.getAttachment(); /**************************************************************/ /* ME Name */ /**************************************************************/ String meName = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Me Name", meName); /**************************************************************/ /* Bus Name */ /**************************************************************/ String busName = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Bus Name", busName); /**************************************************************/ /* User Id */ /**************************************************************/ String userId = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "User Id", userId); /**************************************************************/ /* Password */ /**************************************************************/ String password = request.getString(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Password", "****"); //Liberty COMMS TODO // Has to be replaced with proper security code // For now just have some dummy subject as this flow would not get called in any of current functionality // First authenticate the user /* * SibLoginFactory loginFactory = SibLoginFactory.getInstance(); * final ConnectionMetaData loginMetaData = new ConnectionMetaDataImpl(conversation.getMetaData(), null); * Subject subject = loginFactory.createNewSibLogin().login(busName, * userId, * password, * loginMetaData); */ Subject subject = new Subject(); if (subject == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Authentication failed"); StaticCATHelper.sendExceptionToClient(new SIAuthenticationException(null), null, conversation, requestNumber); // depends on control dependency: [if], data = [none] } else { // Now invoke the Direct connection method TrmSingleton trmSingleton = TrmSingleton.getTrmSingleton(); ComponentData componentData = (ComponentData) trmSingleton.getComponentData(); ConnectionMetaDataImpl metaData = new ConnectionMetaDataImpl(conversation.getMetaData(), conversation.getHandshakeProperties()); DirectConnectionImpl connProps = new DirectConnectionImpl(metaData); connProps.setBus(busName); // depends on control dependency: [if], data = [none] connProps.setName(meName); // depends on control dependency: [if], data = [none] boolean rc = componentData.directConnect(connProps, subject); SICoreConnection conn = connProps.getSICoreConnection(); if (!rc || conn == null) { // TRM failed to locate an ME or Bus for us if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "TRM did not allocate us a connection"); StaticCATHelper.sendExceptionToClient(new SIResourceException(), null, conversation, requestNumber); // depends on control dependency: [if], data = [none] } else { try { // Otherwise we got a connection ok, so stash it in the object store ServerSideConnection cc = new ServerSideConnection(conversation); convState.setCommsConnection(cc); // depends on control dependency: [try], data = [none] convState.addObject(cc); // depends on control dependency: [try], data = [none] // Save the SICoreConnection short objId = (short) convState.addObject(new CATConnection(conn)); convState.setConnectionObjectId(objId); // depends on control dependency: [try], data = [none] cc.setSICoreConnection(conn); // depends on control dependency: [try], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "SICoreConnection object ID", "" + objId); // Register the connection listener attachConnectionListener(conversation, conn); // depends on control dependency: [try], data = [none] // Also grab the unique message id stem byte[] idStem = conn.createUniqueId(); // Now send back a reply CommsByteBuffer reply = poolManager.allocate(); reply.putShort(objId); // depends on control dependency: [try], data = [none] reply.putShort((short) idStem.length); // depends on control dependency: [try], data = [none] reply.put(idStem); // depends on control dependency: [try], data = [none] try { conversation.send(reply, JFapChannelConstants.SEG_DIRECT_CONNECT_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); // depends on control dependency: [try], data = [none] } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".,rcvDirectConnect", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_02, this); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2019", e); } // depends on control dependency: [catch], data = [none] } catch (ConversationStateFullException e) { FFDCFilter.processException(e, CLASS_NAME + ".,rcvDirectConnect", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_01, conversation, requestNumber); } catch (SIException e) { // depends on control dependency: [catch], data = [none] FFDCFilter.processException(e, CLASS_NAME + ".,rcvDirectConnect", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_03, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.SERVERTRANSPORTRECEIVELISTENER_DIRECTCN_03, conversation, requestNumber); } // depends on control dependency: [catch], data = [none] } } request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rcvDirectConnect"); } }
public class class_name { public static BufferedImage getUrlBufferedImage(String urlPath) { URL url = null; BufferedImage bufferImage = null; try { url = new URL(urlPath); bufferImage = ImageIO.read(url); return bufferImage; } catch (Exception e) { logger.error("getUrlBufferedImage error, {}, {}", urlPath, e); } return null; } }
public class class_name { public static BufferedImage getUrlBufferedImage(String urlPath) { URL url = null; BufferedImage bufferImage = null; try { url = new URL(urlPath); // depends on control dependency: [try], data = [none] bufferImage = ImageIO.read(url); // depends on control dependency: [try], data = [none] return bufferImage; // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.error("getUrlBufferedImage error, {}, {}", urlPath, e); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { @Override public boolean contains(final KEY key) { try { verifyID(key); } catch (VerificationFailedException ex) { new FatalImplementationErrorException("Contains check failed because of an invalid key!", this, ex); return false; } return entryMap.containsKey(key); } }
public class class_name { @Override public boolean contains(final KEY key) { try { verifyID(key); // depends on control dependency: [try], data = [none] } catch (VerificationFailedException ex) { new FatalImplementationErrorException("Contains check failed because of an invalid key!", this, ex); return false; } // depends on control dependency: [catch], data = [none] return entryMap.containsKey(key); } }
public class class_name { public String[] getEntityClass(Object obj, String name, Siren4JEntity entityAnno) { Class<?> clazz = obj.getClass(); String[] compClass = entityAnno == null ? null : entityAnno.entityClass(); //If entity class specified then use it. if (compClass != null && !ArrayUtils.isEmpty(compClass)) { return compClass; } //Else use name or class. List<String> entityClass = new ArrayList<String>(); entityClass.add(StringUtils.defaultString(name, clazz.getName())); if (obj instanceof CollectionResource) { String tag = getCollectionClassTag(); if (StringUtils.isNotBlank(tag)) { entityClass.add(tag); } } return entityClass.toArray(new String[]{}); } }
public class class_name { public String[] getEntityClass(Object obj, String name, Siren4JEntity entityAnno) { Class<?> clazz = obj.getClass(); String[] compClass = entityAnno == null ? null : entityAnno.entityClass(); //If entity class specified then use it. if (compClass != null && !ArrayUtils.isEmpty(compClass)) { return compClass; // depends on control dependency: [if], data = [none] } //Else use name or class. List<String> entityClass = new ArrayList<String>(); entityClass.add(StringUtils.defaultString(name, clazz.getName())); if (obj instanceof CollectionResource) { String tag = getCollectionClassTag(); if (StringUtils.isNotBlank(tag)) { entityClass.add(tag); // depends on control dependency: [if], data = [none] } } return entityClass.toArray(new String[]{}); } }
public class class_name { @Override public ServerPrepareResult prepare(String sql, boolean executeOnMaster) throws SQLException { cmdPrologue(); lock.lock(); try { if (options.cachePrepStmts && options.useServerPrepStmts) { ServerPrepareResult pr = serverPrepareStatementCache.get(database + "-" + sql); if (pr != null && pr.incrementShareCounter()) { return pr; } } writer.startPacket(0); writer.write(COM_STMT_PREPARE); writer.write(sql); writer.flush(); ComStmtPrepare comStmtPrepare = new ComStmtPrepare(this, sql); return comStmtPrepare.read(reader, eofDeprecated); } catch (IOException e) { throw handleIoException(e); } finally { lock.unlock(); } } }
public class class_name { @Override public ServerPrepareResult prepare(String sql, boolean executeOnMaster) throws SQLException { cmdPrologue(); lock.lock(); try { if (options.cachePrepStmts && options.useServerPrepStmts) { ServerPrepareResult pr = serverPrepareStatementCache.get(database + "-" + sql); if (pr != null && pr.incrementShareCounter()) { return pr; // depends on control dependency: [if], data = [none] } } writer.startPacket(0); writer.write(COM_STMT_PREPARE); writer.write(sql); writer.flush(); ComStmtPrepare comStmtPrepare = new ComStmtPrepare(this, sql); return comStmtPrepare.read(reader, eofDeprecated); } catch (IOException e) { throw handleIoException(e); } finally { lock.unlock(); } } }
public class class_name { @Pure public boolean isNull() { for (int i = 0; i < this.bytes.length; ++i) { if (this.bytes[i] != 0) { return false; } } return true; } }
public class class_name { @Pure public boolean isNull() { for (int i = 0; i < this.bytes.length; ++i) { if (this.bytes[i] != 0) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public ImageIcon getIcon() { if (confidence == Alert.CONFIDENCE_FALSE_POSITIVE) { // Special case - theres no risk - use the green flag return DisplayUtils.getScaledIcon(Constant.OK_FLAG_IMAGE_URL); } switch (risk) { case Alert.RISK_INFO: return DisplayUtils.getScaledIcon(Constant.INFO_FLAG_IMAGE_URL); case Alert.RISK_LOW: return DisplayUtils.getScaledIcon(Constant.LOW_FLAG_IMAGE_URL); case Alert.RISK_MEDIUM: return DisplayUtils.getScaledIcon(Constant.MED_FLAG_IMAGE_URL); case Alert.RISK_HIGH: return DisplayUtils.getScaledIcon(Constant.HIGH_FLAG_IMAGE_URL); } return null; } }
public class class_name { public ImageIcon getIcon() { if (confidence == Alert.CONFIDENCE_FALSE_POSITIVE) { // Special case - theres no risk - use the green flag return DisplayUtils.getScaledIcon(Constant.OK_FLAG_IMAGE_URL); // depends on control dependency: [if], data = [none] } switch (risk) { case Alert.RISK_INFO: return DisplayUtils.getScaledIcon(Constant.INFO_FLAG_IMAGE_URL); case Alert.RISK_LOW: return DisplayUtils.getScaledIcon(Constant.LOW_FLAG_IMAGE_URL); case Alert.RISK_MEDIUM: return DisplayUtils.getScaledIcon(Constant.MED_FLAG_IMAGE_URL); case Alert.RISK_HIGH: return DisplayUtils.getScaledIcon(Constant.HIGH_FLAG_IMAGE_URL); } return null; } }
public class class_name { private static void configureWagon(Wagon wagon, String repositoryId, Settings settings, PlexusContainer container, Log log) throws WagonConfigurationException { log.debug(" configureWagon "); //config log configureLog(wagon, log); configureScpWagonIfRequired(wagon, log); // MSITE-25: Make sure that the server settings are inserted for (Server server : settings.getServers()) { String id = server.getId(); log.debug("configureWagon server " + id); if (id != null && id.equals(repositoryId) && (server.getConfiguration() != null)) { final PlexusConfiguration plexusConf = new XmlPlexusConfiguration((Xpp3Dom) server.getConfiguration()); ComponentConfigurator componentConfigurator = null; try { componentConfigurator = (ComponentConfigurator) container.lookup(ComponentConfigurator.ROLE); componentConfigurator.configureComponent(wagon, plexusConf, container.getContainerRealm()); } catch (final ComponentLookupException e) { throw new WagonConfigurationException(repositoryId, "Unable to lookup wagon configurator." + " Wagon configuration cannot be applied.", e); } catch (ComponentConfigurationException e) { throw new WagonConfigurationException(repositoryId, "Unable to apply wagon configuration.", e); } finally { if (componentConfigurator != null) { try { container.release(componentConfigurator); } catch (ComponentLifecycleException e) { log.error("Problem releasing configurator - ignoring: " + e.getMessage()); } } } } } } }
public class class_name { private static void configureWagon(Wagon wagon, String repositoryId, Settings settings, PlexusContainer container, Log log) throws WagonConfigurationException { log.debug(" configureWagon "); //config log configureLog(wagon, log); configureScpWagonIfRequired(wagon, log); // MSITE-25: Make sure that the server settings are inserted for (Server server : settings.getServers()) { String id = server.getId(); log.debug("configureWagon server " + id); if (id != null && id.equals(repositoryId) && (server.getConfiguration() != null)) { final PlexusConfiguration plexusConf = new XmlPlexusConfiguration((Xpp3Dom) server.getConfiguration()); ComponentConfigurator componentConfigurator = null; try { componentConfigurator = (ComponentConfigurator) container.lookup(ComponentConfigurator.ROLE); // depends on control dependency: [try], data = [none] componentConfigurator.configureComponent(wagon, plexusConf, container.getContainerRealm()); // depends on control dependency: [try], data = [none] } catch (final ComponentLookupException e) { throw new WagonConfigurationException(repositoryId, "Unable to lookup wagon configurator." + " Wagon configuration cannot be applied.", e); } catch (ComponentConfigurationException e) { // depends on control dependency: [catch], data = [none] throw new WagonConfigurationException(repositoryId, "Unable to apply wagon configuration.", e); } finally { // depends on control dependency: [catch], data = [none] if (componentConfigurator != null) { try { container.release(componentConfigurator); // depends on control dependency: [try], data = [none] } catch (ComponentLifecycleException e) { log.error("Problem releasing configurator - ignoring: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] } } } } } }
public class class_name { public static <T> T invoke(String className, String methodName, boolean isSingleton, Object... args) { Class<Object> clazz = loadClass(className); try { final Method method = getDeclaredMethod(clazz, methodName, getClasses(args)); if (null == method) { throw new NoSuchMethodException(StrUtil.format("No such method: [{}]", methodName)); } if (isStatic(method)) { return ReflectUtil.invoke(null, method, args); } else { return ReflectUtil.invoke(isSingleton ? Singleton.get(clazz) : clazz.newInstance(), method, args); } } catch (Exception e) { throw new UtilException(e); } } }
public class class_name { public static <T> T invoke(String className, String methodName, boolean isSingleton, Object... args) { Class<Object> clazz = loadClass(className); try { final Method method = getDeclaredMethod(clazz, methodName, getClasses(args)); if (null == method) { throw new NoSuchMethodException(StrUtil.format("No such method: [{}]", methodName)); } if (isStatic(method)) { return ReflectUtil.invoke(null, method, args); // depends on control dependency: [if], data = [none] } else { return ReflectUtil.invoke(isSingleton ? Singleton.get(clazz) : clazz.newInstance(), method, args); // depends on control dependency: [if], data = [none] } } catch (Exception e) { throw new UtilException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void setImportTaskIds(java.util.Collection<String> importTaskIds) { if (importTaskIds == null) { this.importTaskIds = null; return; } this.importTaskIds = new java.util.ArrayList<String>(importTaskIds); } }
public class class_name { public void setImportTaskIds(java.util.Collection<String> importTaskIds) { if (importTaskIds == null) { this.importTaskIds = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.importTaskIds = new java.util.ArrayList<String>(importTaskIds); } }
public class class_name { public void loadDefault(TypeMirror type) throws IOException { if (type.getKind() != TypeKind.VOID) { if (Typ.isPrimitive(type)) { tconst(type, 0); } else { aconst_null(); } } } }
public class class_name { public void loadDefault(TypeMirror type) throws IOException { if (type.getKind() != TypeKind.VOID) { if (Typ.isPrimitive(type)) { tconst(type, 0); // depends on control dependency: [if], data = [none] } else { aconst_null(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void expireOrphanSessions(long timestamp) { // Iterate through registered sessions. for (RaftSession session : raft.getSessions().getSessions()) { if (session.getService().deleted() && session.isTimedOut(timestamp)) { logger.debug("Orphaned session expired in {} milliseconds: {}", timestamp - session.getLastUpdated(), session); session = raft.getSessions().removeSession(session.sessionId()); if (session != null) { session.expire(); } } } } }
public class class_name { private void expireOrphanSessions(long timestamp) { // Iterate through registered sessions. for (RaftSession session : raft.getSessions().getSessions()) { if (session.getService().deleted() && session.isTimedOut(timestamp)) { logger.debug("Orphaned session expired in {} milliseconds: {}", timestamp - session.getLastUpdated(), session); // depends on control dependency: [if], data = [none] session = raft.getSessions().removeSession(session.sessionId()); // depends on control dependency: [if], data = [none] if (session != null) { session.expire(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Nullable public static String getAsIdentifier (@Nullable final String s, final char cReplacement) { if (StringHelper.hasNoText (s)) return s; String sReplacement; if (cReplacement == '$' || cReplacement == '\\') { // These 2 chars must be quoted, otherwise an // StringIndexOutOfBoundsException occurs! sReplacement = "\\" + cReplacement; } else sReplacement = Character.toString (cReplacement); // replace all non-word characters with the replacement character // Important: quote the replacement in case it is a backslash or another // special regex character final String ret = stringReplacePattern ("\\W", s, sReplacement); if (!Character.isJavaIdentifierStart (ret.charAt (0))) return sReplacement + ret; return ret; } }
public class class_name { @Nullable public static String getAsIdentifier (@Nullable final String s, final char cReplacement) { if (StringHelper.hasNoText (s)) return s; String sReplacement; if (cReplacement == '$' || cReplacement == '\\') { // These 2 chars must be quoted, otherwise an // StringIndexOutOfBoundsException occurs! sReplacement = "\\" + cReplacement; // depends on control dependency: [if], data = [none] } else sReplacement = Character.toString (cReplacement); // replace all non-word characters with the replacement character // Important: quote the replacement in case it is a backslash or another // special regex character final String ret = stringReplacePattern ("\\W", s, sReplacement); if (!Character.isJavaIdentifierStart (ret.charAt (0))) return sReplacement + ret; return ret; } }
public class class_name { public static void add3DCoordinates1(IAtomContainer atomContainer) { // atoms without coordinates IAtomContainer noCoords = atomContainer.getBuilder().newInstance(IAtomContainer.class); // get vector of possible referenceAtoms? IAtomContainer refAtoms = atomContainer.getBuilder().newInstance(IAtomContainer.class); for (int i = 0; i < atomContainer.getAtomCount(); i++) { IAtom atom = atomContainer.getAtom(i); // is this atom without 3D coords, and has only one ligand? if (atom.getPoint3d() == null) { List<IAtom> connectedAtoms = atomContainer.getConnectedAtomsList(atom); if (connectedAtoms.size() == 1) { IAtom refAtom = (IAtom) connectedAtoms.get(0);; if (refAtom.getPoint3d() != null) { refAtoms.addAtom(refAtom); // store atoms with no coords and ref atoms in a // single container noCoords.addAtom(atom); noCoords.addAtom(refAtom); // bond is required to extract ligands noCoords.addBond(atomContainer.getBuilder().newInstance(IBond.class, atom, refAtom, Order.SINGLE)); } } } } // now add coordinates to ligands of reference atoms // use default length of 1.0, which can be adjusted later double length = 1.0; double angle = TETRAHEDRAL_ANGLE; for (int i = 0; i < refAtoms.getAtomCount(); i++) { IAtom refAtom = refAtoms.getAtom(i); List<IAtom> noCoordLigands = noCoords.getConnectedAtomsList(refAtom); int nLigands = noCoordLigands.size(); int nwanted = nLigands; String elementType = refAtom.getSymbol(); // try to deal with lone pairs on small hetero if (elementType.equals("N") || elementType.equals("O") || elementType.equals("S")) { nwanted = 3; } Point3d[] newPoints = calculate3DCoordinatesForLigands(atomContainer, refAtom, nwanted, length, angle); for (int j = 0; j < nLigands; j++) { IAtom ligand = (IAtom) noCoordLigands.get(j); Point3d newPoint = rescaleBondLength(refAtom, ligand, newPoints[j]); ligand.setPoint3d(newPoint); } } } }
public class class_name { public static void add3DCoordinates1(IAtomContainer atomContainer) { // atoms without coordinates IAtomContainer noCoords = atomContainer.getBuilder().newInstance(IAtomContainer.class); // get vector of possible referenceAtoms? IAtomContainer refAtoms = atomContainer.getBuilder().newInstance(IAtomContainer.class); for (int i = 0; i < atomContainer.getAtomCount(); i++) { IAtom atom = atomContainer.getAtom(i); // is this atom without 3D coords, and has only one ligand? if (atom.getPoint3d() == null) { List<IAtom> connectedAtoms = atomContainer.getConnectedAtomsList(atom); if (connectedAtoms.size() == 1) { IAtom refAtom = (IAtom) connectedAtoms.get(0);; if (refAtom.getPoint3d() != null) { refAtoms.addAtom(refAtom); // depends on control dependency: [if], data = [none] // store atoms with no coords and ref atoms in a // single container noCoords.addAtom(atom); // depends on control dependency: [if], data = [none] noCoords.addAtom(refAtom); // depends on control dependency: [if], data = [none] // bond is required to extract ligands noCoords.addBond(atomContainer.getBuilder().newInstance(IBond.class, atom, refAtom, Order.SINGLE)); // depends on control dependency: [if], data = [none] } } } } // now add coordinates to ligands of reference atoms // use default length of 1.0, which can be adjusted later double length = 1.0; double angle = TETRAHEDRAL_ANGLE; for (int i = 0; i < refAtoms.getAtomCount(); i++) { IAtom refAtom = refAtoms.getAtom(i); List<IAtom> noCoordLigands = noCoords.getConnectedAtomsList(refAtom); int nLigands = noCoordLigands.size(); int nwanted = nLigands; String elementType = refAtom.getSymbol(); // try to deal with lone pairs on small hetero if (elementType.equals("N") || elementType.equals("O") || elementType.equals("S")) { nwanted = 3; // depends on control dependency: [if], data = [none] } Point3d[] newPoints = calculate3DCoordinatesForLigands(atomContainer, refAtom, nwanted, length, angle); for (int j = 0; j < nLigands; j++) { IAtom ligand = (IAtom) noCoordLigands.get(j); Point3d newPoint = rescaleBondLength(refAtom, ligand, newPoints[j]); ligand.setPoint3d(newPoint); // depends on control dependency: [for], data = [none] } } } }
public class class_name { @Override public Map loadAll(Collection keys) { if (keys == null || keys.isEmpty()) { return Collections.emptyMap(); } Map<Object, Object> map = createHashMap(keys.size()); Iterator iterator = keys.iterator(); while (iterator.hasNext()) { Object key = iterator.next(); Data dataKey = toHeapData(key); DelayedEntry delayedEntry = getFromStagingArea(dataKey); if (delayedEntry != null) { Object value = delayedEntry.getValue(); if (value != null) { map.put(dataKey, toObject(value)); } iterator.remove(); } } map.putAll(super.loadAll(keys)); return map; } }
public class class_name { @Override public Map loadAll(Collection keys) { if (keys == null || keys.isEmpty()) { return Collections.emptyMap(); // depends on control dependency: [if], data = [none] } Map<Object, Object> map = createHashMap(keys.size()); Iterator iterator = keys.iterator(); while (iterator.hasNext()) { Object key = iterator.next(); Data dataKey = toHeapData(key); DelayedEntry delayedEntry = getFromStagingArea(dataKey); if (delayedEntry != null) { Object value = delayedEntry.getValue(); if (value != null) { map.put(dataKey, toObject(value)); // depends on control dependency: [if], data = [(value] } iterator.remove(); // depends on control dependency: [if], data = [none] } } map.putAll(super.loadAll(keys)); return map; } }
public class class_name { public EClass getMIO() { if (mioEClass == null) { mioEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(297); } return mioEClass; } }
public class class_name { public EClass getMIO() { if (mioEClass == null) { mioEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(297); // depends on control dependency: [if], data = [none] } return mioEClass; } }
public class class_name { public void removeObservableListener(ObservableListener<T> listener) { checkBeanBound(); checkNotNull(listener, "listener cannot be null"); if (adaptersByListener.containsKey(listener)) { PropertyChangeListener adapter = adaptersByListener.remove(listener); BeanUtils.removePropertyChangeListener(bean, adapter); } } }
public class class_name { public void removeObservableListener(ObservableListener<T> listener) { checkBeanBound(); checkNotNull(listener, "listener cannot be null"); if (adaptersByListener.containsKey(listener)) { PropertyChangeListener adapter = adaptersByListener.remove(listener); BeanUtils.removePropertyChangeListener(bean, adapter); // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean check() { // System.out.println(" performing CHECK on " + getPayload(this)); // System.out.println("[sequitur debug] *calling check() on* " + this.value + ", n isGuard: " // + n.isGuard()); // ... Each time a link is made between two symbols if the new digram is repeated elsewhere // and the repetitions do not overlap, if the other occurrence is a complete rule, // replace the new digram with the non-terminal symbol that heads the rule, // otherwise,form a new rule and replace both digrams with the new non-terminal symbol // otherwise, insert the digram into the index... if (n.isGuard()) { // i am the rule return false; } if (!theDigrams.containsKey(this)) { // System.out.println("[sequitur debug] *check...* digrams contain this (" + this.value + "~" // + this.n.value + ")? NO. Checking in."); // found = theDigrams.put(this, this); theDigrams.put(this, this); // System.out.println(" *** Digrams now: " + makeDigramsTable()); // System.out.println("[sequitur debug] *digrams* " + hash2String()); return false; } // System.out.println("[sequitur debug] *check...* digrams contain this (" + this.value // + this.n.value + ")? Yes. Oh-Oh..."); // well the same hash is in the store, lemme see... SAXSymbol found = theDigrams.get(this); // if it's not me, then lets call match magic? if (found.n != this) { // System.out.println("[sequitur debug] *double check...* IT IS NOT ME!"); match(this, found); } return true; } }
public class class_name { public boolean check() { // System.out.println(" performing CHECK on " + getPayload(this)); // System.out.println("[sequitur debug] *calling check() on* " + this.value + ", n isGuard: " // + n.isGuard()); // ... Each time a link is made between two symbols if the new digram is repeated elsewhere // and the repetitions do not overlap, if the other occurrence is a complete rule, // replace the new digram with the non-terminal symbol that heads the rule, // otherwise,form a new rule and replace both digrams with the new non-terminal symbol // otherwise, insert the digram into the index... if (n.isGuard()) { // i am the rule return false; // depends on control dependency: [if], data = [none] } if (!theDigrams.containsKey(this)) { // System.out.println("[sequitur debug] *check...* digrams contain this (" + this.value + "~" // + this.n.value + ")? NO. Checking in."); // found = theDigrams.put(this, this); theDigrams.put(this, this); // depends on control dependency: [if], data = [none] // System.out.println(" *** Digrams now: " + makeDigramsTable()); // System.out.println("[sequitur debug] *digrams* " + hash2String()); return false; // depends on control dependency: [if], data = [none] } // System.out.println("[sequitur debug] *check...* digrams contain this (" + this.value // + this.n.value + ")? Yes. Oh-Oh..."); // well the same hash is in the store, lemme see... SAXSymbol found = theDigrams.get(this); // if it's not me, then lets call match magic? if (found.n != this) { // System.out.println("[sequitur debug] *double check...* IT IS NOT ME!"); match(this, found); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { @Override public Map<String, Object> toSource() { Map<String, Object> sourceMap = new HashMap<>(); if (available != null) { addFieldToSource(sourceMap, "available", available); } if (crawler != null) { addFieldToSource(sourceMap, "crawler", crawler); } if (createdBy != null) { addFieldToSource(sourceMap, "createdBy", createdBy); } if (createdTime != null) { addFieldToSource(sourceMap, "createdTime", createdTime); } if (cronExpression != null) { addFieldToSource(sourceMap, "cronExpression", cronExpression); } if (jobLogging != null) { addFieldToSource(sourceMap, "jobLogging", jobLogging); } if (name != null) { addFieldToSource(sourceMap, "name", name); } if (scriptData != null) { addFieldToSource(sourceMap, "scriptData", scriptData); } if (scriptType != null) { addFieldToSource(sourceMap, "scriptType", scriptType); } if (sortOrder != null) { addFieldToSource(sourceMap, "sortOrder", sortOrder); } if (target != null) { addFieldToSource(sourceMap, "target", target); } if (updatedBy != null) { addFieldToSource(sourceMap, "updatedBy", updatedBy); } if (updatedTime != null) { addFieldToSource(sourceMap, "updatedTime", updatedTime); } return sourceMap; } }
public class class_name { @Override public Map<String, Object> toSource() { Map<String, Object> sourceMap = new HashMap<>(); if (available != null) { addFieldToSource(sourceMap, "available", available); // depends on control dependency: [if], data = [none] } if (crawler != null) { addFieldToSource(sourceMap, "crawler", crawler); // depends on control dependency: [if], data = [none] } if (createdBy != null) { addFieldToSource(sourceMap, "createdBy", createdBy); // depends on control dependency: [if], data = [none] } if (createdTime != null) { addFieldToSource(sourceMap, "createdTime", createdTime); // depends on control dependency: [if], data = [none] } if (cronExpression != null) { addFieldToSource(sourceMap, "cronExpression", cronExpression); // depends on control dependency: [if], data = [none] } if (jobLogging != null) { addFieldToSource(sourceMap, "jobLogging", jobLogging); // depends on control dependency: [if], data = [none] } if (name != null) { addFieldToSource(sourceMap, "name", name); // depends on control dependency: [if], data = [none] } if (scriptData != null) { addFieldToSource(sourceMap, "scriptData", scriptData); // depends on control dependency: [if], data = [none] } if (scriptType != null) { addFieldToSource(sourceMap, "scriptType", scriptType); // depends on control dependency: [if], data = [none] } if (sortOrder != null) { addFieldToSource(sourceMap, "sortOrder", sortOrder); // depends on control dependency: [if], data = [none] } if (target != null) { addFieldToSource(sourceMap, "target", target); // depends on control dependency: [if], data = [none] } if (updatedBy != null) { addFieldToSource(sourceMap, "updatedBy", updatedBy); // depends on control dependency: [if], data = [none] } if (updatedTime != null) { addFieldToSource(sourceMap, "updatedTime", updatedTime); // depends on control dependency: [if], data = [none] } return sourceMap; } }
public class class_name { public static void addEntries(File zip, ZipEntrySource[] entries, OutputStream destOut) { if (log.isDebugEnabled()) { log.debug("Copying '" + zip + "' to a stream and adding " + Arrays.asList(entries) + "."); } ZipOutputStream out = null; try { out = new ZipOutputStream(destOut); copyEntries(zip, out); for (int i = 0; i < entries.length; i++) { addEntry(entries[i], out); } out.finish(); } catch (IOException e) { ZipExceptionUtil.rethrow(e); } } }
public class class_name { public static void addEntries(File zip, ZipEntrySource[] entries, OutputStream destOut) { if (log.isDebugEnabled()) { log.debug("Copying '" + zip + "' to a stream and adding " + Arrays.asList(entries) + "."); // depends on control dependency: [if], data = [none] } ZipOutputStream out = null; try { out = new ZipOutputStream(destOut); // depends on control dependency: [try], data = [none] copyEntries(zip, out); // depends on control dependency: [try], data = [none] for (int i = 0; i < entries.length; i++) { addEntry(entries[i], out); // depends on control dependency: [for], data = [i] } out.finish(); // depends on control dependency: [try], data = [none] } catch (IOException e) { ZipExceptionUtil.rethrow(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Future<?> runBatch(Batch<T> batch) throws InterruptedException { while (true) { try { runBatchMeter.mark(); if (perRollupMetrics) { batch.getMap().forEach((addr, op) -> { if (addr.getSourceRollup().isPresent()) { updateRollupHistogram(rollupWriteSize, addr.getSourceRollup().get(), "rollupWriteSize", op); } }); } return db.runBatchAsync(batch, flushErrorHandler); } catch (FullQueueException e) { asyncQueueBackoffMeter.mark(); // Sleeping and retrying like this means batches may be flushed out of order log.debug("Async queue is full, retrying soon"); Thread.sleep(100); } } } }
public class class_name { private Future<?> runBatch(Batch<T> batch) throws InterruptedException { while (true) { try { runBatchMeter.mark(); // depends on control dependency: [try], data = [none] if (perRollupMetrics) { batch.getMap().forEach((addr, op) -> { if (addr.getSourceRollup().isPresent()) { updateRollupHistogram(rollupWriteSize, addr.getSourceRollup().get(), "rollupWriteSize", op); // depends on control dependency: [if], data = [none] } }); } return db.runBatchAsync(batch, flushErrorHandler); // depends on control dependency: [try], data = [none] } catch (FullQueueException e) { asyncQueueBackoffMeter.mark(); // Sleeping and retrying like this means batches may be flushed out of order log.debug("Async queue is full, retrying soon"); Thread.sleep(100); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private static BiFunction<AnnotatedValueResolver, ResolverContext, Object> resolver(List<RequestObjectResolver> objectResolvers, BeanFactoryId beanFactoryId) { return (resolver, ctx) -> { Object value = null; for (final RequestObjectResolver objectResolver : objectResolvers) { try { value = objectResolver.convert(ctx, resolver.elementType(), beanFactoryId); break; } catch (FallthroughException ignore) { // Do nothing. } catch (Throwable cause) { Exceptions.throwUnsafely(cause); } } if (value != null) { return value; } throw new IllegalArgumentException("No suitable request converter found for a @" + RequestObject.class.getSimpleName() + " '" + resolver.elementType().getSimpleName() + '\''); }; } }
public class class_name { private static BiFunction<AnnotatedValueResolver, ResolverContext, Object> resolver(List<RequestObjectResolver> objectResolvers, BeanFactoryId beanFactoryId) { return (resolver, ctx) -> { Object value = null; for (final RequestObjectResolver objectResolver : objectResolvers) { try { value = objectResolver.convert(ctx, resolver.elementType(), beanFactoryId); // depends on control dependency: [try], data = [none] break; } catch (FallthroughException ignore) { // Do nothing. } catch (Throwable cause) { // depends on control dependency: [catch], data = [none] Exceptions.throwUnsafely(cause); } // depends on control dependency: [catch], data = [none] } if (value != null) { return value; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("No suitable request converter found for a @" + RequestObject.class.getSimpleName() + " '" + resolver.elementType().getSimpleName() + '\''); }; } }
public class class_name { protected File gettmpStore(String nic) { if (consumer_key_storage == null || !consumer_key_storage.isDirectory()) { if (e1 == 0) { e1++; log.error( "No cert directory, can not save consumer_key! please set `consumer_key_storage` variable to a valid directory in your {}, or in your environ variale OVH_CONSUMER_KEY_STORAGE", configFiles); } return null; } return new File(consumer_key_storage, nic + ".ck.txt"); } }
public class class_name { protected File gettmpStore(String nic) { if (consumer_key_storage == null || !consumer_key_storage.isDirectory()) { if (e1 == 0) { e1++; // depends on control dependency: [if], data = [none] log.error( "No cert directory, can not save consumer_key! please set `consumer_key_storage` variable to a valid directory in your {}, or in your environ variale OVH_CONSUMER_KEY_STORAGE", configFiles); // depends on control dependency: [if], data = [none] } return null; // depends on control dependency: [if], data = [none] } return new File(consumer_key_storage, nic + ".ck.txt"); } }
public class class_name { public void addConsumer( Object key, String topic, String selectorString, MatchTarget target, boolean isWildcarded) throws SIDiscriminatorSyntaxException { if (tc.isEntryEnabled()) SibTr.entry(tc, "addConsumer", new Object[]{key, topic, selectorString, target, new Boolean(isWildcarded)}); boolean selector = false; MonitoredConsumer mc = (MonitoredConsumer)target; // Is there a selector expression if (selectorString != null && selectorString.trim().length() != 0) { selector = true; } // Has a consumer already registered on this topicexpression? // // If they have then, we can use the matching monitor lists in the existing consumer // to short circuit the monitor matching process. // // Note that in this case we are agnostic about selectors.....but need to // make sure that the SubscriptionRegistrar adds the consumer in the // correct place if(selector) { // This consumer has a selector, see if there is an existing subscription // registrar entry if(_subscriptionRegistrar.isKnownSelectorExpression(topic, isWildcarded)) { // Found existing entry in selector table add this consumer to // that entry addConsumerForKnownTopicExpr(topic, selector, isWildcarded, mc, true); } else { // See if theres a corresponding non-selector entry if(_subscriptionRegistrar.isKnownNonSelectorExpression(topic, isWildcarded)) { // Found existing entry in non-selector table, add a new row in the // subscriptionRegistrar's selector table _subscriptionRegistrar.addNewConsumerForExpression(topic,mc,selector, isWildcarded); addConsumerForKnownTopicExpr(topic, selector, isWildcarded, mc, false); } else { // An Entirely new expression, we'll have to do the matching // Add a new row in the table of subscriptions _subscriptionRegistrar.addNewConsumerForExpression(topic,mc,selector, isWildcarded); addConsumerForNewTopicExpr(topic, isWildcarded, mc); } } } else { // This consumer has no selector, see if there is an existing subscription // registrar entry if(_subscriptionRegistrar.isKnownNonSelectorExpression(topic, isWildcarded)) { // Found existing entry in non-selector table add this consumer to // that entry addConsumerForKnownTopicExpr(topic, selector, isWildcarded, mc, true); } else { // See if theres a corresponding selector entry if(_subscriptionRegistrar.isKnownSelectorExpression(topic, isWildcarded)) { // Found existing entry in selector table, add a new row in the // subscriptionRegistrar's non-selector table _subscriptionRegistrar.addNewConsumerForExpression(topic,mc,selector, isWildcarded); addConsumerForKnownTopicExpr(topic, selector, isWildcarded, mc, false); } else { // An Entirely new expression, we'll have to do the matching // Add a new row in the table of subscriptions _subscriptionRegistrar.addNewConsumerForExpression(topic,mc,selector, isWildcarded); addConsumerForNewTopicExpr(topic, isWildcarded, mc); } } } // Set info into the Target itself if(selector) mc.setSelector(); if(isWildcarded) mc.setWildcarded(); mc.setTopic(topic); if (tc.isEntryEnabled()) SibTr.exit(tc, "addConsumer"); } }
public class class_name { public void addConsumer( Object key, String topic, String selectorString, MatchTarget target, boolean isWildcarded) throws SIDiscriminatorSyntaxException { if (tc.isEntryEnabled()) SibTr.entry(tc, "addConsumer", new Object[]{key, topic, selectorString, target, new Boolean(isWildcarded)}); boolean selector = false; MonitoredConsumer mc = (MonitoredConsumer)target; // Is there a selector expression if (selectorString != null && selectorString.trim().length() != 0) { selector = true; // depends on control dependency: [if], data = [none] } // Has a consumer already registered on this topicexpression? // // If they have then, we can use the matching monitor lists in the existing consumer // to short circuit the monitor matching process. // // Note that in this case we are agnostic about selectors.....but need to // make sure that the SubscriptionRegistrar adds the consumer in the // correct place if(selector) { // This consumer has a selector, see if there is an existing subscription // registrar entry if(_subscriptionRegistrar.isKnownSelectorExpression(topic, isWildcarded)) { // Found existing entry in selector table add this consumer to // that entry addConsumerForKnownTopicExpr(topic, selector, isWildcarded, mc, true); // depends on control dependency: [if], data = [none] } else { // See if theres a corresponding non-selector entry if(_subscriptionRegistrar.isKnownNonSelectorExpression(topic, isWildcarded)) { // Found existing entry in non-selector table, add a new row in the // subscriptionRegistrar's selector table _subscriptionRegistrar.addNewConsumerForExpression(topic,mc,selector, isWildcarded); // depends on control dependency: [if], data = [none] addConsumerForKnownTopicExpr(topic, selector, isWildcarded, mc, false); // depends on control dependency: [if], data = [none] } else { // An Entirely new expression, we'll have to do the matching // Add a new row in the table of subscriptions _subscriptionRegistrar.addNewConsumerForExpression(topic,mc,selector, isWildcarded); // depends on control dependency: [if], data = [none] addConsumerForNewTopicExpr(topic, isWildcarded, mc); // depends on control dependency: [if], data = [none] } } } else { // This consumer has no selector, see if there is an existing subscription // registrar entry if(_subscriptionRegistrar.isKnownNonSelectorExpression(topic, isWildcarded)) { // Found existing entry in non-selector table add this consumer to // that entry addConsumerForKnownTopicExpr(topic, selector, isWildcarded, mc, true); // depends on control dependency: [if], data = [none] } else { // See if theres a corresponding selector entry if(_subscriptionRegistrar.isKnownSelectorExpression(topic, isWildcarded)) { // Found existing entry in selector table, add a new row in the // subscriptionRegistrar's non-selector table _subscriptionRegistrar.addNewConsumerForExpression(topic,mc,selector, isWildcarded); // depends on control dependency: [if], data = [none] addConsumerForKnownTopicExpr(topic, selector, isWildcarded, mc, false); // depends on control dependency: [if], data = [none] } else { // An Entirely new expression, we'll have to do the matching // Add a new row in the table of subscriptions _subscriptionRegistrar.addNewConsumerForExpression(topic,mc,selector, isWildcarded); // depends on control dependency: [if], data = [none] addConsumerForNewTopicExpr(topic, isWildcarded, mc); // depends on control dependency: [if], data = [none] } } } // Set info into the Target itself if(selector) mc.setSelector(); if(isWildcarded) mc.setWildcarded(); mc.setTopic(topic); if (tc.isEntryEnabled()) SibTr.exit(tc, "addConsumer"); } }
public class class_name { void disconnectEdgeFromCluster_(int edge, int cluster) { int next = getNextEdge(edge, cluster); assert (getPrevEdge(next, cluster) == edge); int prev = getPrevEdge(edge, cluster); assert (getNextEdge(prev, cluster) == edge); int first_edge = getClusterFirstEdge(cluster); if (next != edge) { setNextEdge_(prev, cluster, next); setPrevEdge_(next, cluster, prev); if (first_edge == edge) setClusterFirstEdge_(cluster, next); } else setClusterFirstEdge_(cluster, -1); } }
public class class_name { void disconnectEdgeFromCluster_(int edge, int cluster) { int next = getNextEdge(edge, cluster); assert (getPrevEdge(next, cluster) == edge); int prev = getPrevEdge(edge, cluster); assert (getNextEdge(prev, cluster) == edge); int first_edge = getClusterFirstEdge(cluster); if (next != edge) { setNextEdge_(prev, cluster, next); // depends on control dependency: [if], data = [none] setPrevEdge_(next, cluster, prev); // depends on control dependency: [if], data = [(next] if (first_edge == edge) setClusterFirstEdge_(cluster, next); } else setClusterFirstEdge_(cluster, -1); } }
public class class_name { protected void perturbCenter( Cluster c , int x , int y ) { float best = Float.MAX_VALUE; int bestX=0,bestY=0; for( int dy = -1; dy <= 1; dy++ ) { for( int dx = -1; dx <= 1; dx++ ) { float d = gradient(x + dx, y + dy); if( d < best ) { best = d; bestX = dx; bestY = dy; } } } c.x = x+bestX; c.y = y+bestY; setColor(c.color,x+bestX,y+bestY); } }
public class class_name { protected void perturbCenter( Cluster c , int x , int y ) { float best = Float.MAX_VALUE; int bestX=0,bestY=0; for( int dy = -1; dy <= 1; dy++ ) { for( int dx = -1; dx <= 1; dx++ ) { float d = gradient(x + dx, y + dy); if( d < best ) { best = d; // depends on control dependency: [if], data = [none] bestX = dx; // depends on control dependency: [if], data = [none] bestY = dy; // depends on control dependency: [if], data = [none] } } } c.x = x+bestX; c.y = y+bestY; setColor(c.color,x+bestX,y+bestY); } }
public class class_name { public static final String getter(Field field, String fieldName) { Class<?> type = field.getType(); if (type.isPrimitive() && "boolean".equals(type.getName())) { return isser(fieldName); } else { return getter(fieldName); } } }
public class class_name { public static final String getter(Field field, String fieldName) { Class<?> type = field.getType(); if (type.isPrimitive() && "boolean".equals(type.getName())) { return isser(fieldName); // depends on control dependency: [if], data = [none] } else { return getter(fieldName); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void sendAttachmentFile(final InputStream is, final String mimeType) { dispatchConversationTask(new ConversationDispatchTask() { @Override protected boolean execute(Conversation conversation) { if (is == null) { return false; // TODO: add error message } CompoundMessage message = new CompoundMessage(); // No body, just attachment message.setBody(null); message.setRead(true); message.setHidden(true); message.setSenderId(conversation.getPerson().getId()); ArrayList<StoredFile> attachmentStoredFiles = new ArrayList<StoredFile>(); String localFilePath = Util.generateCacheFilePathFromNonceOrPrefix(ApptentiveInternal.getInstance().getApplicationContext(), message.getNonce(), null); String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType); if (!TextUtils.isEmpty(extension)) { localFilePath += "." + extension; } // When created from InputStream, there is no source file uri or path, thus just use the cache file path StoredFile storedFile = Util.createLocalStoredFile(is, localFilePath, localFilePath, mimeType); if (storedFile == null) { return false; // TODO: add error message } storedFile.setId(message.getNonce()); attachmentStoredFiles.add(storedFile); message.setAssociatedFiles(attachmentStoredFiles); conversation.getMessageManager().sendMessage(message); return true; } }, "add unread message listener"); } }
public class class_name { public static void sendAttachmentFile(final InputStream is, final String mimeType) { dispatchConversationTask(new ConversationDispatchTask() { @Override protected boolean execute(Conversation conversation) { if (is == null) { return false; // TODO: add error message // depends on control dependency: [if], data = [none] } CompoundMessage message = new CompoundMessage(); // No body, just attachment message.setBody(null); message.setRead(true); message.setHidden(true); message.setSenderId(conversation.getPerson().getId()); ArrayList<StoredFile> attachmentStoredFiles = new ArrayList<StoredFile>(); String localFilePath = Util.generateCacheFilePathFromNonceOrPrefix(ApptentiveInternal.getInstance().getApplicationContext(), message.getNonce(), null); String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType); if (!TextUtils.isEmpty(extension)) { localFilePath += "." + extension; // depends on control dependency: [if], data = [none] } // When created from InputStream, there is no source file uri or path, thus just use the cache file path StoredFile storedFile = Util.createLocalStoredFile(is, localFilePath, localFilePath, mimeType); if (storedFile == null) { return false; // TODO: add error message // depends on control dependency: [if], data = [none] } storedFile.setId(message.getNonce()); attachmentStoredFiles.add(storedFile); message.setAssociatedFiles(attachmentStoredFiles); conversation.getMessageManager().sendMessage(message); return true; } }, "add unread message listener"); } }
public class class_name { public boolean initMoveHandle(CmsDNDHandler dndHandler, boolean addFirst) { if (m_moveHandle != null) { return true; } if (m_listItemWidget == null) { return false; } m_moveHandle = new MoveHandle(this); if (addFirst) { m_listItemWidget.addButtonToFront(m_moveHandle); } else { m_listItemWidget.addButton(m_moveHandle); } m_moveHandle.addMouseDownHandler(dndHandler); return true; } }
public class class_name { public boolean initMoveHandle(CmsDNDHandler dndHandler, boolean addFirst) { if (m_moveHandle != null) { return true; // depends on control dependency: [if], data = [none] } if (m_listItemWidget == null) { return false; // depends on control dependency: [if], data = [none] } m_moveHandle = new MoveHandle(this); if (addFirst) { m_listItemWidget.addButtonToFront(m_moveHandle); // depends on control dependency: [if], data = [none] } else { m_listItemWidget.addButton(m_moveHandle); // depends on control dependency: [if], data = [none] } m_moveHandle.addMouseDownHandler(dndHandler); return true; } }
public class class_name { public void marshall(AddPermissionRequest addPermissionRequest, ProtocolMarshaller protocolMarshaller) { if (addPermissionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(addPermissionRequest.getFunctionName(), FUNCTIONNAME_BINDING); protocolMarshaller.marshall(addPermissionRequest.getStatementId(), STATEMENTID_BINDING); protocolMarshaller.marshall(addPermissionRequest.getAction(), ACTION_BINDING); protocolMarshaller.marshall(addPermissionRequest.getPrincipal(), PRINCIPAL_BINDING); protocolMarshaller.marshall(addPermissionRequest.getSourceArn(), SOURCEARN_BINDING); protocolMarshaller.marshall(addPermissionRequest.getSourceAccount(), SOURCEACCOUNT_BINDING); protocolMarshaller.marshall(addPermissionRequest.getEventSourceToken(), EVENTSOURCETOKEN_BINDING); protocolMarshaller.marshall(addPermissionRequest.getQualifier(), QUALIFIER_BINDING); protocolMarshaller.marshall(addPermissionRequest.getRevisionId(), REVISIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AddPermissionRequest addPermissionRequest, ProtocolMarshaller protocolMarshaller) { if (addPermissionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(addPermissionRequest.getFunctionName(), FUNCTIONNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(addPermissionRequest.getStatementId(), STATEMENTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(addPermissionRequest.getAction(), ACTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(addPermissionRequest.getPrincipal(), PRINCIPAL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(addPermissionRequest.getSourceArn(), SOURCEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(addPermissionRequest.getSourceAccount(), SOURCEACCOUNT_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(addPermissionRequest.getEventSourceToken(), EVENTSOURCETOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(addPermissionRequest.getQualifier(), QUALIFIER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(addPermissionRequest.getRevisionId(), REVISIONID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public List<String> getAll(String name) { if (properties == null) { return null; } final List<String> all = new ArrayList<String>(); for (Property property : properties) { if (property.getName().equals(name)) { all.add(property.getValue()); } } return all; } }
public class class_name { public List<String> getAll(String name) { if (properties == null) { return null; // depends on control dependency: [if], data = [none] } final List<String> all = new ArrayList<String>(); for (Property property : properties) { if (property.getName().equals(name)) { all.add(property.getValue()); // depends on control dependency: [if], data = [none] } } return all; } }
public class class_name { @Override public EClass getIfcPipeFitting() { if (ifcPipeFittingEClass == null) { ifcPipeFittingEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(419); } return ifcPipeFittingEClass; } }
public class class_name { @Override public EClass getIfcPipeFitting() { if (ifcPipeFittingEClass == null) { ifcPipeFittingEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(419); // depends on control dependency: [if], data = [none] } return ifcPipeFittingEClass; } }
public class class_name { public static void normalizeSumOne( TupleDesc_F64 desc ) { double sum = 0; for (int i = 0; i < desc.size(); i++) { double v = desc.value[i]; sum += v; } if( sum == 0 ) return; for (int i = 0; i < desc.size(); i++) { desc.value[i] /= sum; } } }
public class class_name { public static void normalizeSumOne( TupleDesc_F64 desc ) { double sum = 0; for (int i = 0; i < desc.size(); i++) { double v = desc.value[i]; sum += v; // depends on control dependency: [for], data = [none] } if( sum == 0 ) return; for (int i = 0; i < desc.size(); i++) { desc.value[i] /= sum; // depends on control dependency: [for], data = [i] } } }
public class class_name { public static String file(File file) throws IOException { InputStream in = null; try { in = new FileInputStream(file); return stream(in, file.length()); } finally { if (in != null) { try { in.close(); } catch (Exception e) { e.printStackTrace(); } } } } }
public class class_name { public static String file(File file) throws IOException { InputStream in = null; try { in = new FileInputStream(file); return stream(in, file.length()); } finally { if (in != null) { try { in.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } } }
public class class_name { private int findChild(L child, float depth) { // findInsertion will find us some element with the same depth as the to-be-removed child int startIdx = findInsertion(depth); // search down for our child for (int ii = startIdx-1; ii >= 0; ii--) { L c = children.get(ii); if (c == child) { return ii; } if (c.depth() != depth) { break; } } // search up for our child for (int ii = startIdx, ll = children.size(); ii < ll; ii++) { L c = children.get(ii); if (c == child) { return ii; } if (c.depth() != depth) { break; } } return -1; } }
public class class_name { private int findChild(L child, float depth) { // findInsertion will find us some element with the same depth as the to-be-removed child int startIdx = findInsertion(depth); // search down for our child for (int ii = startIdx-1; ii >= 0; ii--) { L c = children.get(ii); if (c == child) { return ii; // depends on control dependency: [if], data = [none] } if (c.depth() != depth) { break; } } // search up for our child for (int ii = startIdx, ll = children.size(); ii < ll; ii++) { L c = children.get(ii); if (c == child) { return ii; // depends on control dependency: [if], data = [none] } if (c.depth() != depth) { break; } } return -1; } }
public class class_name { public static Resource find(String name, Class<?> contextClass) { Parameters.checkNotNull(name); URL url = contextClass.getResource(name); if (url != null) { return new Resource(url); } throw new NotFoundException(name); } }
public class class_name { public static Resource find(String name, Class<?> contextClass) { Parameters.checkNotNull(name); URL url = contextClass.getResource(name); if (url != null) { return new Resource(url); // depends on control dependency: [if], data = [(url] } throw new NotFoundException(name); } }
public class class_name { public void marshall(AssociateHostedConnectionRequest associateHostedConnectionRequest, ProtocolMarshaller protocolMarshaller) { if (associateHostedConnectionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(associateHostedConnectionRequest.getConnectionId(), CONNECTIONID_BINDING); protocolMarshaller.marshall(associateHostedConnectionRequest.getParentConnectionId(), PARENTCONNECTIONID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(AssociateHostedConnectionRequest associateHostedConnectionRequest, ProtocolMarshaller protocolMarshaller) { if (associateHostedConnectionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(associateHostedConnectionRequest.getConnectionId(), CONNECTIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(associateHostedConnectionRequest.getParentConnectionId(), PARENTCONNECTIONID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { protected String getMappingString() { StringBuilder sb = new StringBuilder(); final int schemaSize = uriMap.size(); final int domainSize = patternMap.size(); int s = 0, d = 0; for (String schema: uriMap.keySet()) { if (s > 0) sb.append(", "); sb.append(schema); s++; if (s > 2 && schemaSize > 3) { sb.append(", "); sb.append(schemaSize - s); sb.append(" more"); break; } } if (schemaSize > 0 && domainSize > 0) sb.append("; "); for (Pattern domain: patternMap.keySet()) { if (d > 0) sb.append(", "); sb.append(domain.pattern()); d++; if (d > 2 && domainSize > 3) { sb.append(", "); sb.append(domainSize - s); sb.append(" more"); break; } } return sb.toString(); } }
public class class_name { protected String getMappingString() { StringBuilder sb = new StringBuilder(); final int schemaSize = uriMap.size(); final int domainSize = patternMap.size(); int s = 0, d = 0; for (String schema: uriMap.keySet()) { if (s > 0) sb.append(", "); sb.append(schema); // depends on control dependency: [for], data = [schema] s++; // depends on control dependency: [for], data = [none] if (s > 2 && schemaSize > 3) { sb.append(", "); // depends on control dependency: [if], data = [none] sb.append(schemaSize - s); // depends on control dependency: [if], data = [(s] sb.append(" more"); // depends on control dependency: [if], data = [none] break; } } if (schemaSize > 0 && domainSize > 0) sb.append("; "); for (Pattern domain: patternMap.keySet()) { if (d > 0) sb.append(", "); sb.append(domain.pattern()); // depends on control dependency: [for], data = [domain] d++; // depends on control dependency: [for], data = [none] if (d > 2 && domainSize > 3) { sb.append(", "); // depends on control dependency: [if], data = [none] sb.append(domainSize - s); // depends on control dependency: [if], data = [(d] sb.append(" more"); // depends on control dependency: [if], data = [none] break; } } return sb.toString(); } }
public class class_name { public Object execute() throws Throwable { try { URL u = new URL("mailto:" + mailto); URLConnection c = u.openConnection(); c.setDoInput(false); c.setDoOutput(true); c.connect(); outMail = new PrintWriter(c.getOutputStream(), true); outMail.println("From: " + mailfrom); outMail.println("To: " + mailto); outMail.println("Subject: " + subject); if (attachments == null) { outMail.println("Content-Type: text/plain;"); outMail.println(" charset=\"UTF-8\""); outMail.println(); if (message != null) { outMail.println(message); } } else { String boundary = "----=" + KeyGenerator.generateKey(); outMail.println("MIME-Version: 1.0\n" + "Content-Type: multipart/mixed; " + "boundary=\"" + boundary + '\"'); outMail.println(); if (message != null) { outMail.println("--" + boundary); outMail.println("Content-Type: text/plain;"); outMail.println(" charset=\"UTF-8\""); // outMail.println("Content-Transfer-Encoding: quoted-printable"); outMail.println(); outMail.println(message); } for (int i = 0; i < attachments.length; i++) { outMail.println(); outMail.println("--" + boundary); outMail.println("Content-Type: " + attachments[i].getMimeType() + ';'); outMail.println(" name=\"" + attachments[i].getFileName() + '\"'); outMail.println("Content-Transfer-Encoding: base64"); outMail.println("Content-Disposition: attachment;"); outMail.println(" filename=\"" + attachments[i].getFileName() + '\"'); outMail.println(); outMail.println(attachments[i].getRawDataBase64Encoded()); outMail.println(); } outMail.println("--" + boundary + "--"); } } catch (Throwable t) { //failure of async action must be logged somewhere t.printStackTrace(); throw new java.lang.RuntimeException("mailing " + mailto + " via " + mailserver + " failed", t); } finally { if (outMail != null) { outMail.close(); } } return null; } }
public class class_name { public Object execute() throws Throwable { try { URL u = new URL("mailto:" + mailto); URLConnection c = u.openConnection(); c.setDoInput(false); c.setDoOutput(true); c.connect(); outMail = new PrintWriter(c.getOutputStream(), true); outMail.println("From: " + mailfrom); outMail.println("To: " + mailto); outMail.println("Subject: " + subject); if (attachments == null) { outMail.println("Content-Type: text/plain;"); outMail.println(" charset=\"UTF-8\""); outMail.println(); if (message != null) { outMail.println(message); } } else { String boundary = "----=" + KeyGenerator.generateKey(); outMail.println("MIME-Version: 1.0\n" + "Content-Type: multipart/mixed; " + "boundary=\"" + boundary + '\"'); outMail.println(); if (message != null) { outMail.println("--" + boundary); // depends on control dependency: [if], data = [none] outMail.println("Content-Type: text/plain;"); // depends on control dependency: [if], data = [none] outMail.println(" charset=\"UTF-8\""); // depends on control dependency: [if], data = [none] // outMail.println("Content-Transfer-Encoding: quoted-printable"); outMail.println(); // depends on control dependency: [if], data = [none] outMail.println(message); // depends on control dependency: [if], data = [(message] } for (int i = 0; i < attachments.length; i++) { outMail.println(); // depends on control dependency: [for], data = [none] outMail.println("--" + boundary); // depends on control dependency: [for], data = [none] outMail.println("Content-Type: " + attachments[i].getMimeType() + ';'); // depends on control dependency: [for], data = [i] outMail.println(" name=\"" + attachments[i].getFileName() + '\"'); // depends on control dependency: [for], data = [i] outMail.println("Content-Transfer-Encoding: base64"); // depends on control dependency: [for], data = [none] outMail.println("Content-Disposition: attachment;"); // depends on control dependency: [for], data = [none] outMail.println(" filename=\"" + attachments[i].getFileName() + '\"'); // depends on control dependency: [for], data = [i] outMail.println(); // depends on control dependency: [for], data = [none] outMail.println(attachments[i].getRawDataBase64Encoded()); // depends on control dependency: [for], data = [i] outMail.println(); // depends on control dependency: [for], data = [none] } outMail.println("--" + boundary + "--"); } } catch (Throwable t) { //failure of async action must be logged somewhere t.printStackTrace(); throw new java.lang.RuntimeException("mailing " + mailto + " via " + mailserver + " failed", t); } finally { if (outMail != null) { outMail.close(); } } return null; } }
public class class_name { public static Object concat(Object[] arrs) { int totalLen = 0; Class commonComponentType = null; for (int i = 0, len = arrs.length; i < len; i++) { // skip all null arrays if (arrs[i] == null) { continue; } int arrayLen = Array.getLength(arrs[i]); // skip all empty arrays if (arrayLen == 0) { continue; } totalLen += arrayLen; Class componentType = arrs[i].getClass().getComponentType(); commonComponentType = (commonComponentType == null) ? componentType : commonClass(commonComponentType, componentType); } if (commonComponentType == null) { return null; } return concat(Array.newInstance(commonComponentType, totalLen), totalLen, arrs); } }
public class class_name { public static Object concat(Object[] arrs) { int totalLen = 0; Class commonComponentType = null; for (int i = 0, len = arrs.length; i < len; i++) { // skip all null arrays if (arrs[i] == null) { continue; } int arrayLen = Array.getLength(arrs[i]); // skip all empty arrays if (arrayLen == 0) { continue; } totalLen += arrayLen; // depends on control dependency: [for], data = [none] Class componentType = arrs[i].getClass().getComponentType(); commonComponentType = (commonComponentType == null) ? componentType : commonClass(commonComponentType, componentType); } if (commonComponentType == null) { return null; // depends on control dependency: [if], data = [none] } return concat(Array.newInstance(commonComponentType, totalLen), totalLen, arrs); } }
public class class_name { public static List<Language> get() { List<Language> result = new ArrayList<>(); for (Language lang : getStaticAndDynamicLanguages()) { if (!"xx".equals(lang.getShortCode()) && !"zz".equals(lang.getShortCode())) { // skip demo and noop language result.add(lang); } } return Collections.unmodifiableList(result); } }
public class class_name { public static List<Language> get() { List<Language> result = new ArrayList<>(); for (Language lang : getStaticAndDynamicLanguages()) { if (!"xx".equals(lang.getShortCode()) && !"zz".equals(lang.getShortCode())) { // skip demo and noop language result.add(lang); // depends on control dependency: [if], data = [none] } } return Collections.unmodifiableList(result); } }
public class class_name { public static String stringFromFile(String filename, String encoding) { try { StringBuilder sb = new StringBuilder(); BufferedReader in = new BufferedReader(new EncodingFileReader(filename,encoding)); String line; while ((line = in.readLine()) != null) { sb.append(line); sb.append(eolChar); } in.close(); return sb.toString(); } catch (IOException e) { e.printStackTrace(); return null; } } }
public class class_name { public static String stringFromFile(String filename, String encoding) { try { StringBuilder sb = new StringBuilder(); BufferedReader in = new BufferedReader(new EncodingFileReader(filename,encoding)); String line; while ((line = in.readLine()) != null) { sb.append(line); // depends on control dependency: [while], data = [none] sb.append(eolChar); // depends on control dependency: [while], data = [none] } in.close(); // depends on control dependency: [try], data = [none] return sb.toString(); // depends on control dependency: [try], data = [none] } catch (IOException e) { e.printStackTrace(); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(ApplicationSummary applicationSummary, ProtocolMarshaller protocolMarshaller) { if (applicationSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(applicationSummary.getApplicationId(), APPLICATIONID_BINDING); protocolMarshaller.marshall(applicationSummary.getAuthor(), AUTHOR_BINDING); protocolMarshaller.marshall(applicationSummary.getCreationTime(), CREATIONTIME_BINDING); protocolMarshaller.marshall(applicationSummary.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(applicationSummary.getHomePageUrl(), HOMEPAGEURL_BINDING); protocolMarshaller.marshall(applicationSummary.getLabels(), LABELS_BINDING); protocolMarshaller.marshall(applicationSummary.getName(), NAME_BINDING); protocolMarshaller.marshall(applicationSummary.getSpdxLicenseId(), SPDXLICENSEID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ApplicationSummary applicationSummary, ProtocolMarshaller protocolMarshaller) { if (applicationSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(applicationSummary.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(applicationSummary.getAuthor(), AUTHOR_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(applicationSummary.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(applicationSummary.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(applicationSummary.getHomePageUrl(), HOMEPAGEURL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(applicationSummary.getLabels(), LABELS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(applicationSummary.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(applicationSummary.getSpdxLicenseId(), SPDXLICENSEID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void updateEntriesById(Collection<CmsUUID> ids) { Map<CmsUUID, CmsClientSitemapEntry> entries = m_controller.getEntriesById(ids); for (CmsClientSitemapEntry entry : entries.values()) { CmsSitemapTreeItem item = CmsSitemapTreeItem.getItemById(entry.getId()); item.updateEntry(entry); } } }
public class class_name { public void updateEntriesById(Collection<CmsUUID> ids) { Map<CmsUUID, CmsClientSitemapEntry> entries = m_controller.getEntriesById(ids); for (CmsClientSitemapEntry entry : entries.values()) { CmsSitemapTreeItem item = CmsSitemapTreeItem.getItemById(entry.getId()); item.updateEntry(entry); // depends on control dependency: [for], data = [entry] } } }
public class class_name { protected static boolean isAdditionalNamespace(String namespaceURI) { assert (namespaceURI != null); if (namespaceURI.equals(Constants.XML_NULL_NS_URI) || namespaceURI.equals(Constants.XML_NS_URI) || namespaceURI.equals(Constants.XML_SCHEMA_INSTANCE_NS_URI) || namespaceURI.equals(Constants.XML_SCHEMA_NS_URI)) { return false; } else { return true; } } }
public class class_name { protected static boolean isAdditionalNamespace(String namespaceURI) { assert (namespaceURI != null); if (namespaceURI.equals(Constants.XML_NULL_NS_URI) || namespaceURI.equals(Constants.XML_NS_URI) || namespaceURI.equals(Constants.XML_SCHEMA_INSTANCE_NS_URI) || namespaceURI.equals(Constants.XML_SCHEMA_NS_URI)) { return false; // depends on control dependency: [if], data = [none] } else { return true; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void leftDeleteWithPredecessor( GBSNode p, GBSNode r, Object deleteKey, DeleteNode point) { java.util.Comparator comp = p.deleteComparator(); int xcc = comp.compare(deleteKey, r.rightMostKey()); if (xcc == 0) /* Target key IS predecessor high key */ { /* Migrate up low key of current (delete key) into high key of predecessor (target key) */ point.setDelete(p, 0); point.setTarget(r, r.rightMostIndex(), DeleteNode.OVERLAY_RIGHT); } else if (xcc > 0) /* Target key > predecessor high key */ { /* Target is in left part of current */ int ix = p.findDeleteInLeft(deleteKey); if ( !(ix < 0) ) point.setDelete(p, ix); } else /* Target key < predecessor high */ { /* It is in right half of predecessor */ int ix = r.findDeleteInRight(deleteKey); if ( !(ix < 0) ) { point.setTarget(r, ix, DeleteNode.ADD_RIGHT); point.setDelete(p, 0); } } } }
public class class_name { private void leftDeleteWithPredecessor( GBSNode p, GBSNode r, Object deleteKey, DeleteNode point) { java.util.Comparator comp = p.deleteComparator(); int xcc = comp.compare(deleteKey, r.rightMostKey()); if (xcc == 0) /* Target key IS predecessor high key */ { /* Migrate up low key of current (delete key) into high key of predecessor (target key) */ point.setDelete(p, 0); // depends on control dependency: [if], data = [0)] point.setTarget(r, r.rightMostIndex(), DeleteNode.OVERLAY_RIGHT); // depends on control dependency: [if], data = [none] } else if (xcc > 0) /* Target key > predecessor high key */ { /* Target is in left part of current */ int ix = p.findDeleteInLeft(deleteKey); if ( !(ix < 0) ) point.setDelete(p, ix); } else /* Target key < predecessor high */ { /* It is in right half of predecessor */ int ix = r.findDeleteInRight(deleteKey); if ( !(ix < 0) ) { point.setTarget(r, ix, DeleteNode.ADD_RIGHT); // depends on control dependency: [if], data = [none] point.setDelete(p, 0); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public String penniesToDollars (int pennies) { float decimal = pennies / 100f; // if the pennies is a whole number of dollars, then we return just the string number if (pennies % 100 == 0) { return String.format("%.0f", decimal); } // otherwise we always return two decimal places return String.format("%#.2f", decimal); } }
public class class_name { public String penniesToDollars (int pennies) { float decimal = pennies / 100f; // if the pennies is a whole number of dollars, then we return just the string number if (pennies % 100 == 0) { return String.format("%.0f", decimal); // depends on control dependency: [if], data = [none] } // otherwise we always return two decimal places return String.format("%#.2f", decimal); } }
public class class_name { protected BoundedPriorityQueue<Result> computeNearestNeighborsInternal(int k, double[] queryVector) throws Exception { BoundedPriorityQueue<Result> nn = new BoundedPriorityQueue<Result>(new Result(), k); double lowest = Double.MAX_VALUE; for (int i = 0; i < (vectorsList.size() / vectorLength); i++) { boolean skip = false; int startIndex = i * vectorLength; double l2distance = 0; for (int j = 0; j < vectorLength; j++) { l2distance += (queryVector[j] - vectorsList.getQuick(startIndex + j)) * (queryVector[j] - vectorsList.getQuick(startIndex + j)); if (l2distance > lowest) { skip = true; break; } } if (!skip) { nn.offer(new Result(i, l2distance)); if (i >= k) { lowest = nn.last().getDistance(); } } } return nn; } }
public class class_name { protected BoundedPriorityQueue<Result> computeNearestNeighborsInternal(int k, double[] queryVector) throws Exception { BoundedPriorityQueue<Result> nn = new BoundedPriorityQueue<Result>(new Result(), k); double lowest = Double.MAX_VALUE; for (int i = 0; i < (vectorsList.size() / vectorLength); i++) { boolean skip = false; int startIndex = i * vectorLength; double l2distance = 0; for (int j = 0; j < vectorLength; j++) { l2distance += (queryVector[j] - vectorsList.getQuick(startIndex + j)) * (queryVector[j] - vectorsList.getQuick(startIndex + j)); // depends on control dependency: [for], data = [j] if (l2distance > lowest) { skip = true; // depends on control dependency: [if], data = [none] break; } } if (!skip) { nn.offer(new Result(i, l2distance)); // depends on control dependency: [if], data = [none] if (i >= k) { lowest = nn.last().getDistance(); // depends on control dependency: [if], data = [none] } } } return nn; } }
public class class_name { public static MutableLongTuple add( Collection<? extends LongTuple> tuples, MutableLongTuple result) { if (tuples.isEmpty()) { return null; } int size = getSize(result, tuples); MutableLongTuple localResult = tuples.parallelStream().collect( () -> LongTuples.create(size), (r,t) -> LongTuples.add(r, t, r), (r0,r1) -> LongTuples.add(r0, r1, r0)); if (result == null) { return localResult; } result.set(localResult); return result; } }
public class class_name { public static MutableLongTuple add( Collection<? extends LongTuple> tuples, MutableLongTuple result) { if (tuples.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } int size = getSize(result, tuples); MutableLongTuple localResult = tuples.parallelStream().collect( () -> LongTuples.create(size), (r,t) -> LongTuples.add(r, t, r), (r0,r1) -> LongTuples.add(r0, r1, r0)); if (result == null) { return localResult; // depends on control dependency: [if], data = [none] } result.set(localResult); return result; } }
public class class_name { public static Type getInheritGenericType(Class<?> clazz, TypeVariable<?> tv) { Type type = null; GenericDeclaration gd = tv.getGenericDeclaration(); do { type = clazz.getGenericSuperclass(); if (type == null) { return null; } if (type instanceof ParameterizedType) { ParameterizedType ptype = (ParameterizedType) type; Type rawType = ptype.getRawType(); boolean eq = gd.equals(rawType) || (gd instanceof Class && rawType instanceof Class && ((Class) gd).isAssignableFrom((Class) rawType)); if (eq) { TypeVariable<?>[] tvs = gd.getTypeParameters(); Type[] types = ptype.getActualTypeArguments(); for (int i = 0; i < tvs.length; i++) { if (tv.equals(tvs[i])) { return types[i]; } } return null; } } clazz = Lang.getTypeClass(type); } while (type != null); return null; } }
public class class_name { public static Type getInheritGenericType(Class<?> clazz, TypeVariable<?> tv) { Type type = null; GenericDeclaration gd = tv.getGenericDeclaration(); do { type = clazz.getGenericSuperclass(); if (type == null) { return null; // depends on control dependency: [if], data = [none] } if (type instanceof ParameterizedType) { ParameterizedType ptype = (ParameterizedType) type; Type rawType = ptype.getRawType(); boolean eq = gd.equals(rawType) || (gd instanceof Class && rawType instanceof Class && ((Class) gd).isAssignableFrom((Class) rawType)); if (eq) { TypeVariable<?>[] tvs = gd.getTypeParameters(); Type[] types = ptype.getActualTypeArguments(); for (int i = 0; i < tvs.length; i++) { if (tv.equals(tvs[i])) { return types[i]; // depends on control dependency: [if], data = [none] } } return null; // depends on control dependency: [if], data = [none] } } clazz = Lang.getTypeClass(type); } while (type != null); return null; } }
public class class_name { private String createPomPath(String relativePath, String moduleName) { if (!moduleName.contains(".xml")) { // Inside the parent pom, the reference is to the pom.xml file return relativePath + "/" + POM_NAME; } // There is a reference to another xml file, which is not the pom. String dirName = relativePath.substring(0, relativePath.indexOf("/")); return dirName + "/" + moduleName; } }
public class class_name { private String createPomPath(String relativePath, String moduleName) { if (!moduleName.contains(".xml")) { // Inside the parent pom, the reference is to the pom.xml file return relativePath + "/" + POM_NAME; // depends on control dependency: [if], data = [none] } // There is a reference to another xml file, which is not the pom. String dirName = relativePath.substring(0, relativePath.indexOf("/")); return dirName + "/" + moduleName; } }
public class class_name { public static CDRStreamReader readerFor(String s, ClassLoader cl) { switch (s.charAt(0)) { case 'A': return AbstractInterfaceReader.instance; case 'B': return ByteReader.instance; case 'C': return CharReader.instance; case 'D': return DoubleReader.instance; case 'E': return SerializableReader.instance; case 'F': return FloatReader.instance; case 'G': return StringReader.instance; case 'I': return IntReader.instance; case 'J': return LongReader.instance; case 'L': try { // Use Class.forName() (rather than cl.loadClass()), because // Class.forName() loads Java array types (which are valuetypes). return new ValuetypeReader(Class.forName(s.substring(1), true, cl)); } catch (ClassNotFoundException e) { throw IIOPLogger.ROOT_LOGGER.errorLoadingClass(s.substring(1), e); } case 'M': return CorbaObjectReader.instance; case 'N': try { return new IdlInterfaceReader(cl.loadClass(s.substring(1))); } catch (ClassNotFoundException e) { throw IIOPLogger.ROOT_LOGGER.errorLoadingClass(s.substring(1), e); } case 'O': return ObjectReader.instance; case 'R': try { return new RemoteReader(cl.loadClass(s.substring(1))); } catch (ClassNotFoundException e) { throw IIOPLogger.ROOT_LOGGER.errorLoadingClass(s.substring(1), e); } case 'S': return ShortReader.instance; case 'V': return null; case 'X': return ExternalizableReader.instance; case 'Z': return BooleanReader.instance; default: return null; } } }
public class class_name { public static CDRStreamReader readerFor(String s, ClassLoader cl) { switch (s.charAt(0)) { case 'A': return AbstractInterfaceReader.instance; case 'B': return ByteReader.instance; case 'C': return CharReader.instance; case 'D': return DoubleReader.instance; case 'E': return SerializableReader.instance; case 'F': return FloatReader.instance; case 'G': return StringReader.instance; case 'I': return IntReader.instance; case 'J': return LongReader.instance; case 'L': try { // Use Class.forName() (rather than cl.loadClass()), because // Class.forName() loads Java array types (which are valuetypes). return new ValuetypeReader(Class.forName(s.substring(1), true, cl)); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { throw IIOPLogger.ROOT_LOGGER.errorLoadingClass(s.substring(1), e); } // depends on control dependency: [catch], data = [none] case 'M': return CorbaObjectReader.instance; case 'N': try { return new IdlInterfaceReader(cl.loadClass(s.substring(1))); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { throw IIOPLogger.ROOT_LOGGER.errorLoadingClass(s.substring(1), e); } // depends on control dependency: [catch], data = [none] case 'O': return ObjectReader.instance; case 'R': try { return new RemoteReader(cl.loadClass(s.substring(1))); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { throw IIOPLogger.ROOT_LOGGER.errorLoadingClass(s.substring(1), e); } // depends on control dependency: [catch], data = [none] case 'S': return ShortReader.instance; case 'V': return null; case 'X': return ExternalizableReader.instance; case 'Z': return BooleanReader.instance; default: return null; } } }
public class class_name { public void setLayerDigests(java.util.Collection<String> layerDigests) { if (layerDigests == null) { this.layerDigests = null; return; } this.layerDigests = new java.util.ArrayList<String>(layerDigests); } }
public class class_name { public void setLayerDigests(java.util.Collection<String> layerDigests) { if (layerDigests == null) { this.layerDigests = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.layerDigests = new java.util.ArrayList<String>(layerDigests); } }
public class class_name { public NotificationCompat.Builder getStatusBarNotificationBuilder() { if (mBuilder == null) { mBuilder = new NotificationCompat.Builder(mContext); } return mBuilder; } }
public class class_name { public NotificationCompat.Builder getStatusBarNotificationBuilder() { if (mBuilder == null) { mBuilder = new NotificationCompat.Builder(mContext); // depends on control dependency: [if], data = [none] } return mBuilder; } }
public class class_name { public static byte[] _16_2(String hexStr) { if (StringUtils.isEmpty(hexStr)) return null; byte[] result = new byte[hexStr.length() / 2]; for (int i = 0; i < hexStr.length() / 2; i++) { int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); result[i] = (byte) (high * 16 + low); } return result; } }
public class class_name { public static byte[] _16_2(String hexStr) { if (StringUtils.isEmpty(hexStr)) return null; byte[] result = new byte[hexStr.length() / 2]; for (int i = 0; i < hexStr.length() / 2; i++) { int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); result[i] = (byte) (high * 16 + low); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { static MBeanServer registerJolokiaMBeanServerHolderMBean(MBeanServer pServer) { JolokiaMBeanServerHolder holder = new JolokiaMBeanServerHolder(); ObjectName holderName = createObjectName(JolokiaMBeanServerHolderMBean.OBJECT_NAME); MBeanServer jolokiaMBeanServer; try { pServer.registerMBean(holder,holderName); jolokiaMBeanServer = holder.getJolokiaMBeanServer(); } catch (InstanceAlreadyExistsException e) { // If the instance already exist, we look it up and fetch the MBeanServerHolder from there. // Might happen in race conditions. try { jolokiaMBeanServer = (MBeanServer) pServer.getAttribute(holderName,JOLOKIA_MBEAN_SERVER_ATTRIBUTE); } catch (JMException e1) { throw new IllegalStateException("Internal: Cannot get JolokiaMBean server in fallback JMX lookup " + "while trying to register the holder MBean: " + e1,e1); } } catch (JMException e) { throw new IllegalStateException("Internal: JolokiaMBeanHolder cannot be registered to JMX: " + e,e); } return jolokiaMBeanServer; } }
public class class_name { static MBeanServer registerJolokiaMBeanServerHolderMBean(MBeanServer pServer) { JolokiaMBeanServerHolder holder = new JolokiaMBeanServerHolder(); ObjectName holderName = createObjectName(JolokiaMBeanServerHolderMBean.OBJECT_NAME); MBeanServer jolokiaMBeanServer; try { pServer.registerMBean(holder,holderName); // depends on control dependency: [try], data = [none] jolokiaMBeanServer = holder.getJolokiaMBeanServer(); // depends on control dependency: [try], data = [none] } catch (InstanceAlreadyExistsException e) { // If the instance already exist, we look it up and fetch the MBeanServerHolder from there. // Might happen in race conditions. try { jolokiaMBeanServer = (MBeanServer) pServer.getAttribute(holderName,JOLOKIA_MBEAN_SERVER_ATTRIBUTE); // depends on control dependency: [try], data = [none] } catch (JMException e1) { throw new IllegalStateException("Internal: Cannot get JolokiaMBean server in fallback JMX lookup " + "while trying to register the holder MBean: " + e1,e1); } // depends on control dependency: [catch], data = [none] } catch (JMException e) { // depends on control dependency: [catch], data = [none] throw new IllegalStateException("Internal: JolokiaMBeanHolder cannot be registered to JMX: " + e,e); } // depends on control dependency: [catch], data = [none] return jolokiaMBeanServer; } }
public class class_name { public Point2D.Double minDistancePointSpline(Point2D.Double p, int nPointsPerSegment){ double minDistance = Double.MAX_VALUE; Point2D.Double minDistancePoint = null; int numberOfSplines = spline.getN(); double[] knots = spline.getKnots(); for(int i = 0; i < numberOfSplines; i++){ double x = knots[i]; double stopx = knots[i+1]; double dx = (stopx-x)/nPointsPerSegment; for(int j = 0; j < nPointsPerSegment; j++){ Point2D.Double candidate = new Point2D.Double(x, spline.value(x)); double d = p.distance(candidate); if(d<minDistance){ minDistance = d; minDistancePoint = candidate; } x += dx; } } return minDistancePoint; } }
public class class_name { public Point2D.Double minDistancePointSpline(Point2D.Double p, int nPointsPerSegment){ double minDistance = Double.MAX_VALUE; Point2D.Double minDistancePoint = null; int numberOfSplines = spline.getN(); double[] knots = spline.getKnots(); for(int i = 0; i < numberOfSplines; i++){ double x = knots[i]; double stopx = knots[i+1]; double dx = (stopx-x)/nPointsPerSegment; for(int j = 0; j < nPointsPerSegment; j++){ Point2D.Double candidate = new Point2D.Double(x, spline.value(x)); double d = p.distance(candidate); if(d<minDistance){ minDistance = d; // depends on control dependency: [if], data = [none] minDistancePoint = candidate; // depends on control dependency: [if], data = [none] } x += dx; // depends on control dependency: [for], data = [none] } } return minDistancePoint; } }
public class class_name { public static boolean startWith(@Nullable CharSequence s, char c) { if (StringUtils.isEmpty(s)) { return false; } return s.charAt(0) == c; } }
public class class_name { public static boolean startWith(@Nullable CharSequence s, char c) { if (StringUtils.isEmpty(s)) { return false; // depends on control dependency: [if], data = [none] } return s.charAt(0) == c; } }
public class class_name { public static void main(String... arguments) { try { Map<String, String> parsedArguments = parseArguments(arguments); MOCK_SERVER_LOGGER.debug(SERVER_CONFIGURATION, "Using command line options: {}", Joiner.on(", ").withKeyValueSeparator("=").join(parsedArguments)); if (parsedArguments.size() > 0 && parsedArguments.containsKey(serverPort.name())) { if (parsedArguments.containsKey(logLevel.name())) { ConfigurationProperties.logLevel(parsedArguments.get(logLevel.name())); } Integer[] localPorts = INTEGER_STRING_LIST_PARSER.toArray(parsedArguments.get(serverPort.name())); if (parsedArguments.containsKey(proxyRemotePort.name())) { String remoteHost = parsedArguments.get(proxyRemoteHost.name()); if (Strings.isNullOrEmpty(remoteHost)) { remoteHost = "localhost"; } new MockServer(Integer.parseInt(parsedArguments.get(proxyRemotePort.name())), remoteHost, localPorts); } else { new MockServer(localPorts); } } else { showUsage(); } } catch (IllegalArgumentException iae) { showUsage(); } } }
public class class_name { public static void main(String... arguments) { try { Map<String, String> parsedArguments = parseArguments(arguments); MOCK_SERVER_LOGGER.debug(SERVER_CONFIGURATION, "Using command line options: {}", Joiner.on(", ").withKeyValueSeparator("=").join(parsedArguments)); // depends on control dependency: [try], data = [none] if (parsedArguments.size() > 0 && parsedArguments.containsKey(serverPort.name())) { if (parsedArguments.containsKey(logLevel.name())) { ConfigurationProperties.logLevel(parsedArguments.get(logLevel.name())); // depends on control dependency: [if], data = [none] } Integer[] localPorts = INTEGER_STRING_LIST_PARSER.toArray(parsedArguments.get(serverPort.name())); if (parsedArguments.containsKey(proxyRemotePort.name())) { String remoteHost = parsedArguments.get(proxyRemoteHost.name()); if (Strings.isNullOrEmpty(remoteHost)) { remoteHost = "localhost"; // depends on control dependency: [if], data = [none] } new MockServer(Integer.parseInt(parsedArguments.get(proxyRemotePort.name())), remoteHost, localPorts); // depends on control dependency: [if], data = [none] } else { new MockServer(localPorts); // depends on control dependency: [if], data = [none] } } else { showUsage(); // depends on control dependency: [if], data = [none] } } catch (IllegalArgumentException iae) { showUsage(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public EClass getIfcWallStandardCase() { if (ifcWallStandardCaseEClass == null) { ifcWallStandardCaseEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(641); } return ifcWallStandardCaseEClass; } }
public class class_name { public EClass getIfcWallStandardCase() { if (ifcWallStandardCaseEClass == null) { ifcWallStandardCaseEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI) .getEClassifiers().get(641); // depends on control dependency: [if], data = [none] } return ifcWallStandardCaseEClass; } }
public class class_name { @Override public Instant with(TemporalField field, long newValue) { if (field instanceof ChronoField) { ChronoField f = (ChronoField) field; f.checkValidValue(newValue); switch (f) { case MILLI_OF_SECOND: { int nval = (int) newValue * 1000_000; return (nval != nanos ? create(seconds, nval) : this); } case MICRO_OF_SECOND: { int nval = (int) newValue * 1000; return (nval != nanos ? create(seconds, nval) : this); } case NANO_OF_SECOND: return (newValue != nanos ? create(seconds, (int) newValue) : this); case INSTANT_SECONDS: return (newValue != seconds ? create(newValue, nanos) : this); } throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.adjustInto(this, newValue); } }
public class class_name { @Override public Instant with(TemporalField field, long newValue) { if (field instanceof ChronoField) { ChronoField f = (ChronoField) field; f.checkValidValue(newValue); // depends on control dependency: [if], data = [none] switch (f) { case MILLI_OF_SECOND: { int nval = (int) newValue * 1000_000; return (nval != nanos ? create(seconds, nval) : this); } case MICRO_OF_SECOND: { int nval = (int) newValue * 1000; return (nval != nanos ? create(seconds, nval) : this); // depends on control dependency: [if], data = [none] } case NANO_OF_SECOND: return (newValue != nanos ? create(seconds, (int) newValue) : this); case INSTANT_SECONDS: return (newValue != seconds ? create(newValue, nanos) : this); } throw new UnsupportedTemporalTypeException("Unsupported field: " + field); } return field.adjustInto(this, newValue); } }
public class class_name { public static base_responses add(nitro_service client, vpnnexthopserver resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { vpnnexthopserver addresources[] = new vpnnexthopserver[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new vpnnexthopserver(); addresources[i].name = resources[i].name; addresources[i].nexthopip = resources[i].nexthopip; addresources[i].nexthopport = resources[i].nexthopport; addresources[i].secure = resources[i].secure; } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { public static base_responses add(nitro_service client, vpnnexthopserver resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { vpnnexthopserver addresources[] = new vpnnexthopserver[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new vpnnexthopserver(); // depends on control dependency: [for], data = [i] addresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i] addresources[i].nexthopip = resources[i].nexthopip; // depends on control dependency: [for], data = [i] addresources[i].nexthopport = resources[i].nexthopport; // depends on control dependency: [for], data = [i] addresources[i].secure = resources[i].secure; // depends on control dependency: [for], data = [i] } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { protected synchronized void invokeBackgroundInvalidation(boolean scan) { final String methodName = "invokeBackgroundInvalidation()"; if (!stopping) { synchronized (cod.diskCleanupThread.dcMonitor) { if (cod.diskCleanupThread.currentThread != null) { this.cod.invokeDiskCleanup(scan); } else { if (scan == SCAN) { traceDebug(methodName, "cacheName=" + this.cod.cacheName + " set cleanupDiskPending to true"); this.cleanupDiskPending = true; } } } } } }
public class class_name { protected synchronized void invokeBackgroundInvalidation(boolean scan) { final String methodName = "invokeBackgroundInvalidation()"; if (!stopping) { synchronized (cod.diskCleanupThread.dcMonitor) { // depends on control dependency: [if], data = [none] if (cod.diskCleanupThread.currentThread != null) { this.cod.invokeDiskCleanup(scan); // depends on control dependency: [if], data = [none] } else { if (scan == SCAN) { traceDebug(methodName, "cacheName=" + this.cod.cacheName + " set cleanupDiskPending to true"); // depends on control dependency: [if], data = [none] this.cleanupDiskPending = true; // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public WebApp getWebApp() { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME,"getWebApp", "webapp -> "+ _webApp +" ,this -> " + this); } return _webApp; } }
public class class_name { public WebApp getWebApp() { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME,"getWebApp", "webapp -> "+ _webApp +" ,this -> " + this); // depends on control dependency: [if], data = [none] } return _webApp; } }
public class class_name { protected void propsFileUpdateNotify(Properties updatedProps, long sequence) { if(aggregator == null || aggregator.getPlatformServices() == null // unit tests? || !loadFromPropertiesFile) return; IPlatformServices platformServices = aggregator.getPlatformServices(); try { IServiceReference[] refs = platformServices.getServiceReferences(OptionsImpl.class.getName(), "(propsFileName=" + getPropsFile().getAbsolutePath().replace("\\", "\\\\") + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ if (refs != null) { for (IServiceReference ref : refs) { String name = ref.getProperty("name"); //$NON-NLS-1$ if (!registrationName.equals(name)) { OptionsImpl impl = (OptionsImpl)platformServices.getService(ref); if (impl != null) { try { impl.propertiesFileUpdated(updatedProps, sequence); } catch (Throwable ignore) {} finally { platformServices.ungetService(ref); } } } } } } catch (PlatformServicesException e) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e.getMessage(), e); } } } }
public class class_name { protected void propsFileUpdateNotify(Properties updatedProps, long sequence) { if(aggregator == null || aggregator.getPlatformServices() == null // unit tests? || !loadFromPropertiesFile) return; IPlatformServices platformServices = aggregator.getPlatformServices(); try { IServiceReference[] refs = platformServices.getServiceReferences(OptionsImpl.class.getName(), "(propsFileName=" + getPropsFile().getAbsolutePath().replace("\\", "\\\\") + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ if (refs != null) { for (IServiceReference ref : refs) { String name = ref.getProperty("name"); //$NON-NLS-1$ if (!registrationName.equals(name)) { OptionsImpl impl = (OptionsImpl)platformServices.getService(ref); if (impl != null) { try { impl.propertiesFileUpdated(updatedProps, sequence); // depends on control dependency: [try], data = [none] } catch (Throwable ignore) {} // depends on control dependency: [catch], data = [none] finally { platformServices.ungetService(ref); } } } } } } catch (PlatformServicesException e) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e.getMessage(), e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public boolean authenticate(ClientAuthScheme scheme, String fromAddress) { if (m_done) throw new IllegalStateException("this authentication request has a result"); boolean authenticated = false; try { authenticated = authenticateImpl(scheme, fromAddress); } catch (Exception ex) { m_authenticationFailure = ex; } finally { m_done = true; } return authenticated; } }
public class class_name { public boolean authenticate(ClientAuthScheme scheme, String fromAddress) { if (m_done) throw new IllegalStateException("this authentication request has a result"); boolean authenticated = false; try { authenticated = authenticateImpl(scheme, fromAddress); // depends on control dependency: [try], data = [none] } catch (Exception ex) { m_authenticationFailure = ex; } // depends on control dependency: [catch], data = [none] finally { m_done = true; } return authenticated; } }