code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private List<CharSequence> getNavigationPreferenceTitles( final Collection<NavigationPreference> navigationPreferences) { List<CharSequence> titles = new LinkedList<>(); for (NavigationPreference navigationPreference : navigationPreferences) { titles.add(navigationPreference.getTitle()); } return titles; } }
public class class_name { private List<CharSequence> getNavigationPreferenceTitles( final Collection<NavigationPreference> navigationPreferences) { List<CharSequence> titles = new LinkedList<>(); for (NavigationPreference navigationPreference : navigationPreferences) { titles.add(navigationPreference.getTitle()); // depends on control dependency: [for], data = [navigationPreference] } return titles; } }
public class class_name { public void marshall(InputLogEvent inputLogEvent, ProtocolMarshaller protocolMarshaller) { if (inputLogEvent == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(inputLogEvent.getTimestamp(), TIMESTAMP_BINDING); protocolMarshaller.marshall(inputLogEvent.getMessage(), MESSAGE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(InputLogEvent inputLogEvent, ProtocolMarshaller protocolMarshaller) { if (inputLogEvent == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(inputLogEvent.getTimestamp(), TIMESTAMP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(inputLogEvent.getMessage(), MESSAGE_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 DescriptorValue calculate(IAtom atom, IAtomContainer org) { if (atom.getProperty(CHARGE_CACHE) == null) { IAtomContainer copy; try { copy = org.clone(); } catch (CloneNotSupportedException e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), NAMES); } for (IAtom a : org.atoms()) { if (a.getImplicitHydrogenCount() == null || a.getImplicitHydrogenCount() != 0) { logger.error("Hydrogens must be explict for MMFF charge calculation"); return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(Double.NaN), NAMES); } } if (!mmff.assignAtomTypes(copy)) logger.warn("One or more atoms could not be assigned an MMFF atom type"); mmff.partialCharges(copy); mmff.clearProps(copy); // cache charges for (int i = 0; i < org.getAtomCount(); i++) { org.getAtom(i).setProperty(CHARGE_CACHE, copy.getAtom(i).getCharge()); } } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(atom.getProperty(CHARGE_CACHE, Double.class)), NAMES); } }
public class class_name { @Override public DescriptorValue calculate(IAtom atom, IAtomContainer org) { if (atom.getProperty(CHARGE_CACHE) == null) { IAtomContainer copy; try { copy = org.clone(); // depends on control dependency: [try], data = [none] } catch (CloneNotSupportedException e) { return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult( Double.NaN), NAMES); } // depends on control dependency: [catch], data = [none] for (IAtom a : org.atoms()) { if (a.getImplicitHydrogenCount() == null || a.getImplicitHydrogenCount() != 0) { logger.error("Hydrogens must be explict for MMFF charge calculation"); // depends on control dependency: [if], data = [none] return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(Double.NaN), NAMES); // depends on control dependency: [if], data = [none] } } if (!mmff.assignAtomTypes(copy)) logger.warn("One or more atoms could not be assigned an MMFF atom type"); mmff.partialCharges(copy); mmff.clearProps(copy); // cache charges for (int i = 0; i < org.getAtomCount(); i++) { org.getAtom(i).setProperty(CHARGE_CACHE, copy.getAtom(i).getCharge()); } } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(atom.getProperty(CHARGE_CACHE, Double.class)), NAMES); } }
public class class_name { public void setApps(java.util.Collection<AppSummary> apps) { if (apps == null) { this.apps = null; return; } this.apps = new java.util.ArrayList<AppSummary>(apps); } }
public class class_name { public void setApps(java.util.Collection<AppSummary> apps) { if (apps == null) { this.apps = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.apps = new java.util.ArrayList<AppSummary>(apps); } }
public class class_name { public int getPropertyAsInteger(final String bundleName, final String key) { LOG.info("Getting value for key: " + key + " from bundle: " + bundleName); ResourceBundle bundle = bundles.get(bundleName); try { return Integer.parseInt(bundle.getString(key)); } catch (MissingResourceException e) { LOG.info("Resource: " + key + " not found!"); } catch (NumberFormatException e) { return -1; } return -1; } }
public class class_name { public int getPropertyAsInteger(final String bundleName, final String key) { LOG.info("Getting value for key: " + key + " from bundle: " + bundleName); ResourceBundle bundle = bundles.get(bundleName); try { return Integer.parseInt(bundle.getString(key)); // depends on control dependency: [try], data = [none] } catch (MissingResourceException e) { LOG.info("Resource: " + key + " not found!"); } catch (NumberFormatException e) { // depends on control dependency: [catch], data = [none] return -1; } // depends on control dependency: [catch], data = [none] return -1; } }
public class class_name { @GuardedBy("this") private void rehashIfNeeded() { int currentSize = table.length; if (currentSize - count >= currentSize / (MAX_EXPECTED_COLLISION_COUNT + 1)) { // Still enough overhead. return; } Object[] oldTable = table; // Grow the table so it increases by 1 / GROWTH_DENOMINATOR. int newSize = currentSize + currentSize / GROWTH_DENOMINATOR; table = new Object[newSize]; count = 0; for (Object element : oldTable) { if (element != null) { intern(element); } } } }
public class class_name { @GuardedBy("this") private void rehashIfNeeded() { int currentSize = table.length; if (currentSize - count >= currentSize / (MAX_EXPECTED_COLLISION_COUNT + 1)) { // Still enough overhead. return; // depends on control dependency: [if], data = [none] } Object[] oldTable = table; // Grow the table so it increases by 1 / GROWTH_DENOMINATOR. int newSize = currentSize + currentSize / GROWTH_DENOMINATOR; table = new Object[newSize]; count = 0; for (Object element : oldTable) { if (element != null) { intern(element); // depends on control dependency: [if], data = [(element] } } } }
public class class_name { public MicroProfileJwtTaiRequest createMicroProfileJwtTaiRequestAndSetRequestAttribute(HttpServletRequest request) { String methodName = "createMicroProfileJwtTaiRequestAndSetRequestAttribute"; if (tc.isDebugEnabled()) { Tr.entry(tc, methodName, request); } MicroProfileJwtTaiRequest mpJwtTaiRequest = new MicroProfileJwtTaiRequest(request); request.setAttribute(ATTRIBUTE_TAI_REQUEST, mpJwtTaiRequest); if (tc.isDebugEnabled()) { Tr.exit(tc, methodName, mpJwtTaiRequest); } return mpJwtTaiRequest; } }
public class class_name { public MicroProfileJwtTaiRequest createMicroProfileJwtTaiRequestAndSetRequestAttribute(HttpServletRequest request) { String methodName = "createMicroProfileJwtTaiRequestAndSetRequestAttribute"; if (tc.isDebugEnabled()) { Tr.entry(tc, methodName, request); // depends on control dependency: [if], data = [none] } MicroProfileJwtTaiRequest mpJwtTaiRequest = new MicroProfileJwtTaiRequest(request); request.setAttribute(ATTRIBUTE_TAI_REQUEST, mpJwtTaiRequest); if (tc.isDebugEnabled()) { Tr.exit(tc, methodName, mpJwtTaiRequest); // depends on control dependency: [if], data = [none] } return mpJwtTaiRequest; } }
public class class_name { public final void rewriteXml( Writer out, Node xmlDoc, String aloneTags[], boolean outputXmlHeader ) { try { if (outputXmlHeader) out.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"); renderXMLRecurs( new PrintWriter(out), xmlDoc, aloneTags ); } catch (Exception e) { e.printStackTrace(); return; } } }
public class class_name { public final void rewriteXml( Writer out, Node xmlDoc, String aloneTags[], boolean outputXmlHeader ) { try { if (outputXmlHeader) out.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"); renderXMLRecurs( new PrintWriter(out), xmlDoc, aloneTags ); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); return; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void find95() { String s = "winipcfg.out"; try { Process p; p = Runtime.getRuntime().exec("winipcfg /all /batch " + s); p.waitFor(); File f = new File(s); findWin(new FileInputStream(f)); new File(s).delete(); } catch (Exception e) { return; } } }
public class class_name { private void find95() { String s = "winipcfg.out"; try { Process p; p = Runtime.getRuntime().exec("winipcfg /all /batch " + s); // depends on control dependency: [try], data = [none] p.waitFor(); // depends on control dependency: [try], data = [none] File f = new File(s); findWin(new FileInputStream(f)); // depends on control dependency: [try], data = [none] new File(s).delete(); // depends on control dependency: [try], data = [none] } catch (Exception e) { return; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public SafeHtmlBuilder setHref(SafeUrl value) { if (!HREF_SAFE_URL_ELEMENT_WHITELIST.contains(elementName) && !elementName.equals("link")) { throw new IllegalArgumentException( "Attribute \"href\" with a SafeUrl value can only be used " + "by one of the following elements: " + HREF_SAFE_URL_ELEMENT_WHITELIST); } if (elementName.equals("link")) { checkLinkDependentAttributes(attributes.get("rel"), AttributeContract.SAFE_URL); } hrefValueContract = AttributeContract.SAFE_URL; return setAttribute("href", value.getSafeUrlString()); } }
public class class_name { public SafeHtmlBuilder setHref(SafeUrl value) { if (!HREF_SAFE_URL_ELEMENT_WHITELIST.contains(elementName) && !elementName.equals("link")) { throw new IllegalArgumentException( "Attribute \"href\" with a SafeUrl value can only be used " + "by one of the following elements: " + HREF_SAFE_URL_ELEMENT_WHITELIST); } if (elementName.equals("link")) { checkLinkDependentAttributes(attributes.get("rel"), AttributeContract.SAFE_URL); // depends on control dependency: [if], data = [none] } hrefValueContract = AttributeContract.SAFE_URL; return setAttribute("href", value.getSafeUrlString()); } }
public class class_name { public static String generateUnionStatement(List<String> patterns) { // Check the input and exit immediately if null if (patterns == null || patterns.isEmpty()) { return ""; } // This is a trivial UNION if (patterns.size() == 1) { return patterns.get(0); } // General case StringBuffer query = new StringBuffer(); // Add the first one as a special case and then loop over the rest query.append(" {" + NL); query.append(patterns.get(0)); query.append(" }" + NL); for (int i = 1; i < patterns.size(); i++) { query.append(" UNION {" + NL); query.append(patterns.get(i)); query.append(" }" + NL); } return query.toString(); } }
public class class_name { public static String generateUnionStatement(List<String> patterns) { // Check the input and exit immediately if null if (patterns == null || patterns.isEmpty()) { return ""; // depends on control dependency: [if], data = [none] } // This is a trivial UNION if (patterns.size() == 1) { return patterns.get(0); // depends on control dependency: [if], data = [none] } // General case StringBuffer query = new StringBuffer(); // Add the first one as a special case and then loop over the rest query.append(" {" + NL); query.append(patterns.get(0)); query.append(" }" + NL); for (int i = 1; i < patterns.size(); i++) { query.append(" UNION {" + NL); // depends on control dependency: [for], data = [none] query.append(patterns.get(i)); // depends on control dependency: [for], data = [i] query.append(" }" + NL); // depends on control dependency: [for], data = [none] } return query.toString(); } }
public class class_name { public void load(Object source, Object target) { for (LoadField load : _loadFields) { load.load(source, target); } } }
public class class_name { public void load(Object source, Object target) { for (LoadField load : _loadFields) { load.load(source, target); // depends on control dependency: [for], data = [load] } } }
public class class_name { public PrettyTime withWeeksToDays() { if (this.weekToDays) { return this; } return new PrettyTime( this.locale, this.refClock, this.zeroDigit, this.minusSign, this.emptyUnit, true, this.shortStyle, this.stdListSeparator, this.endListSeparator); } }
public class class_name { public PrettyTime withWeeksToDays() { if (this.weekToDays) { return this; // depends on control dependency: [if], data = [none] } return new PrettyTime( this.locale, this.refClock, this.zeroDigit, this.minusSign, this.emptyUnit, true, this.shortStyle, this.stdListSeparator, this.endListSeparator); } }
public class class_name { public int getNextRangeIndex() { int length = rangeIndexList.size(); if (length > 0) { Integer rindex = rangeIndexList.get(length - 1); return rindex.intValue(); } return 0; } }
public class class_name { public int getNextRangeIndex() { int length = rangeIndexList.size(); if (length > 0) { Integer rindex = rangeIndexList.get(length - 1); return rindex.intValue(); // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { private ShellCommand getCommandForLine(final String line) { final int pos = line.indexOf(" "); final String commandString = pos > 0 ? line.substring(0, pos) : line; final Class<? extends ShellCommand> clazz = commands.get(commandString); if (clazz != null) { try { return clazz.newInstance(); } catch (Throwable t) { logger.warn("", t); } } return null; } }
public class class_name { private ShellCommand getCommandForLine(final String line) { final int pos = line.indexOf(" "); final String commandString = pos > 0 ? line.substring(0, pos) : line; final Class<? extends ShellCommand> clazz = commands.get(commandString); if (clazz != null) { try { return clazz.newInstance(); // depends on control dependency: [try], data = [none] } catch (Throwable t) { logger.warn("", t); } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { public InvCatalogImpl makeCatalogForDirectory( String orgPath, URI catURI ) { if ( log.isDebugEnabled()) { log.debug( "baseURI=" + catURI ); log.debug( "orgPath=" + orgPath ); log.debug( "rootPath=" + rootPath ); log.debug( "scanLocation=" + scanLocation ); } // Get the dataset path. String dsDirPath = translatePathToLocation( orgPath ); if ( dsDirPath == null ) { String tmpMsg = "makeCatalogForDirectory(): Requesting path <" + orgPath + "> must start with \"" + rootPath + "\"."; log.error( tmpMsg ); return null; } // Setup and create catalog builder. CatalogBuilder catBuilder = buildCatalogBuilder(); if ( catBuilder == null ) return null; // A very round about way to remove the filename (e.g., "catalog.xml"). // Note: Gets around "path separator at end of path" issues that are CrDs implementation dependant. // Note: Does not check that CrDs is allowed by filters. String dsPath = dsDirPath.substring( scanLocationCrDs.getPath().length() ); if ( dsPath.startsWith( "/" )) dsPath = dsPath.substring( 1 ); CrawlableDataset reqCrDs = scanLocationCrDs.getDescendant( dsPath ); CrawlableDataset parent = reqCrDs.getParentDataset(); if (parent == null) { log.error( "makeCatalogForDirectory(): I/O error getting parent crDs level <" + dsDirPath + ">: "); return null; } dsDirPath = parent.getPath(); // Get the CrawlableDataset for the desired catalog level (checks that allowed by filters). CrawlableDataset catalogCrDs; try { catalogCrDs = catBuilder.requestCrawlableDataset( dsDirPath ); } catch ( IOException e ) { log.error( "makeCatalogForDirectory(): I/O error getting catalog level <" + dsDirPath + ">: " + e.getMessage(), e ); return null; } if ( catalogCrDs == null ) { log.warn( "makeCatalogForDirectory(): requested catalog level <" + dsDirPath + "> not allowed (filtered out)."); return null; } if ( ! catalogCrDs.isCollection() ) { log.warn( "makeCatalogForDirectory(): requested catalog level <" + dsDirPath + "> is not a collection."); return null; } // Generate the desired catalog using the builder. InvCatalogImpl catalog; try { catalog = catBuilder.generateCatalog( catalogCrDs ); } catch ( IOException e ) { log.error( "makeCatalogForDirectory(): catalog generation failed <" + catalogCrDs.getPath() + ">: " + e.getMessage() ); return null; } // Set the catalog base URI. if ( catalog != null ) catalog.setBaseURI( catURI ); // InvDatasetImpl top = (InvDatasetImpl) catalog.getDataset(); // // if we name it carefully, can get catalogRef to useProxy == true (disappear top dataset) // if ( service.isRelativeBase()) { // pos = dataDir.lastIndexOf("/"); // String lastDir = (pos > 0) ? dataDir.substring(pos+1) : dataDir; // String topName = lastDir.length() > 0 ? lastDir : getName(); // top.setName( topName); // } return catalog; } }
public class class_name { public InvCatalogImpl makeCatalogForDirectory( String orgPath, URI catURI ) { if ( log.isDebugEnabled()) { log.debug( "baseURI=" + catURI ); // depends on control dependency: [if], data = [none] log.debug( "orgPath=" + orgPath ); // depends on control dependency: [if], data = [none] log.debug( "rootPath=" + rootPath ); // depends on control dependency: [if], data = [none] log.debug( "scanLocation=" + scanLocation ); // depends on control dependency: [if], data = [none] } // Get the dataset path. String dsDirPath = translatePathToLocation( orgPath ); if ( dsDirPath == null ) { String tmpMsg = "makeCatalogForDirectory(): Requesting path <" + orgPath + "> must start with \"" + rootPath + "\"."; log.error( tmpMsg ); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } // Setup and create catalog builder. CatalogBuilder catBuilder = buildCatalogBuilder(); if ( catBuilder == null ) return null; // A very round about way to remove the filename (e.g., "catalog.xml"). // Note: Gets around "path separator at end of path" issues that are CrDs implementation dependant. // Note: Does not check that CrDs is allowed by filters. String dsPath = dsDirPath.substring( scanLocationCrDs.getPath().length() ); if ( dsPath.startsWith( "/" )) dsPath = dsPath.substring( 1 ); CrawlableDataset reqCrDs = scanLocationCrDs.getDescendant( dsPath ); CrawlableDataset parent = reqCrDs.getParentDataset(); if (parent == null) { log.error( "makeCatalogForDirectory(): I/O error getting parent crDs level <" + dsDirPath + ">: "); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } dsDirPath = parent.getPath(); // Get the CrawlableDataset for the desired catalog level (checks that allowed by filters). CrawlableDataset catalogCrDs; try { catalogCrDs = catBuilder.requestCrawlableDataset( dsDirPath ); // depends on control dependency: [try], data = [none] } catch ( IOException e ) { log.error( "makeCatalogForDirectory(): I/O error getting catalog level <" + dsDirPath + ">: " + e.getMessage(), e ); return null; } // depends on control dependency: [catch], data = [none] if ( catalogCrDs == null ) { log.warn( "makeCatalogForDirectory(): requested catalog level <" + dsDirPath + "> not allowed (filtered out)."); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } if ( ! catalogCrDs.isCollection() ) { log.warn( "makeCatalogForDirectory(): requested catalog level <" + dsDirPath + "> is not a collection."); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } // Generate the desired catalog using the builder. InvCatalogImpl catalog; try { catalog = catBuilder.generateCatalog( catalogCrDs ); // depends on control dependency: [try], data = [none] } catch ( IOException e ) { log.error( "makeCatalogForDirectory(): catalog generation failed <" + catalogCrDs.getPath() + ">: " + e.getMessage() ); return null; } // depends on control dependency: [catch], data = [none] // Set the catalog base URI. if ( catalog != null ) catalog.setBaseURI( catURI ); // InvDatasetImpl top = (InvDatasetImpl) catalog.getDataset(); // // if we name it carefully, can get catalogRef to useProxy == true (disappear top dataset) // if ( service.isRelativeBase()) { // pos = dataDir.lastIndexOf("/"); // String lastDir = (pos > 0) ? dataDir.substring(pos+1) : dataDir; // String topName = lastDir.length() > 0 ? lastDir : getName(); // top.setName( topName); // } return catalog; } }
public class class_name { @Override public int read(char[] cbuf, int off, int len) { int n = 0; while (pos != max && n < len) { cbuf[off + n++] = data[pos++]; } return n == 0 ? -1 : n; } }
public class class_name { @Override public int read(char[] cbuf, int off, int len) { int n = 0; while (pos != max && n < len) { cbuf[off + n++] = data[pos++]; // depends on control dependency: [while], data = [none] } return n == 0 ? -1 : n; } }
public class class_name { private void validateFields(List<String> fields) { if (fields == null) { return; } List<String> badFields = new ArrayList<String>(); for (String field: fields) { if (field.contains(".")) { badFields.add(field); } } if (!badFields.isEmpty()) { String msg = String.format("Projection field(s) cannot use dotted notation: %s", Misc.join(", ", badFields)); logger.log(Level.SEVERE, msg); throw new IllegalArgumentException(msg); } } }
public class class_name { private void validateFields(List<String> fields) { if (fields == null) { return; // depends on control dependency: [if], data = [none] } List<String> badFields = new ArrayList<String>(); for (String field: fields) { if (field.contains(".")) { badFields.add(field); // depends on control dependency: [if], data = [none] } } if (!badFields.isEmpty()) { String msg = String.format("Projection field(s) cannot use dotted notation: %s", Misc.join(", ", badFields)); logger.log(Level.SEVERE, msg); // depends on control dependency: [if], data = [none] throw new IllegalArgumentException(msg); } } }
public class class_name { public static int writeIntAsVarIntBytes(int intVal, byte[] bytes, int offset) { int pos = offset; int v = intVal; if ((v & ~0x7F) == 0) { bytes[pos++] = ((byte) v); return 1 + offset; } while (true) { if ((v & ~0x7F) == 0) { bytes[pos++] = ((byte) v); return pos; } else { bytes[pos++] = (byte) ((v & 0x7F) | 0x80); v >>>= 7; } } } }
public class class_name { public static int writeIntAsVarIntBytes(int intVal, byte[] bytes, int offset) { int pos = offset; int v = intVal; if ((v & ~0x7F) == 0) { bytes[pos++] = ((byte) v); // depends on control dependency: [if], data = [none] return 1 + offset; // depends on control dependency: [if], data = [none] } while (true) { if ((v & ~0x7F) == 0) { bytes[pos++] = ((byte) v); // depends on control dependency: [if], data = [none] return pos; // depends on control dependency: [if], data = [none] } else { bytes[pos++] = (byte) ((v & 0x7F) | 0x80); // depends on control dependency: [if], data = [0)] v >>>= 7; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void marshall(DeleteOTAUpdateRequest deleteOTAUpdateRequest, ProtocolMarshaller protocolMarshaller) { if (deleteOTAUpdateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteOTAUpdateRequest.getOtaUpdateId(), OTAUPDATEID_BINDING); protocolMarshaller.marshall(deleteOTAUpdateRequest.getDeleteStream(), DELETESTREAM_BINDING); protocolMarshaller.marshall(deleteOTAUpdateRequest.getForceDeleteAWSJob(), FORCEDELETEAWSJOB_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteOTAUpdateRequest deleteOTAUpdateRequest, ProtocolMarshaller protocolMarshaller) { if (deleteOTAUpdateRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteOTAUpdateRequest.getOtaUpdateId(), OTAUPDATEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteOTAUpdateRequest.getDeleteStream(), DELETESTREAM_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteOTAUpdateRequest.getForceDeleteAWSJob(), FORCEDELETEAWSJOB_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 Map<Method, Object> getConsoleMethods() { if (methods != null) return methods; // search for declared command collections final Iterator<OConsoleCommandCollection> ite = ServiceLoader.load(OConsoleCommandCollection.class).iterator(); final Collection<Object> candidates = new ArrayList<Object>(); candidates.add(this); while (ite.hasNext()) { try { // make a copy and set it's context final OConsoleCommandCollection cc = ite.next().getClass().newInstance(); cc.setContext(this); candidates.add(cc); } catch (InstantiationException ex) { Logger.getLogger(OConsoleApplication.class.getName()).log(Level.WARNING, ex.getMessage()); } catch (IllegalAccessException ex) { Logger.getLogger(OConsoleApplication.class.getName()).log(Level.WARNING, ex.getMessage()); } } methods = new TreeMap<Method, Object>(new Comparator<Method>() { public int compare(Method o1, Method o2) { final ConsoleCommand ann1 = o1.getAnnotation(ConsoleCommand.class); final ConsoleCommand ann2 = o2.getAnnotation(ConsoleCommand.class); if (ann1 != null && ann2 != null) { if (ann1.priority() != ann2.priority()) // PRIORITY WINS return ann1.priority() - ann2.priority(); } int res = o1.getName().compareTo(o2.getName()); if (res == 0) res = o1.toString().compareTo(o2.toString()); return res; } }); for (final Object candidate : candidates) { final Method[] classMethods = candidate.getClass().getMethods(); for (Method m : classMethods) { if (Modifier.isAbstract(m.getModifiers()) || Modifier.isStatic(m.getModifiers()) || !Modifier.isPublic(m.getModifiers())) { continue; } if (m.getReturnType() != Void.TYPE) { continue; } methods.put(m, candidate); } } return methods; } }
public class class_name { protected Map<Method, Object> getConsoleMethods() { if (methods != null) return methods; // search for declared command collections final Iterator<OConsoleCommandCollection> ite = ServiceLoader.load(OConsoleCommandCollection.class).iterator(); final Collection<Object> candidates = new ArrayList<Object>(); candidates.add(this); while (ite.hasNext()) { try { // make a copy and set it's context final OConsoleCommandCollection cc = ite.next().getClass().newInstance(); cc.setContext(this); // depends on control dependency: [try], data = [none] candidates.add(cc); // depends on control dependency: [try], data = [none] } catch (InstantiationException ex) { Logger.getLogger(OConsoleApplication.class.getName()).log(Level.WARNING, ex.getMessage()); } catch (IllegalAccessException ex) { // depends on control dependency: [catch], data = [none] Logger.getLogger(OConsoleApplication.class.getName()).log(Level.WARNING, ex.getMessage()); } // depends on control dependency: [catch], data = [none] } methods = new TreeMap<Method, Object>(new Comparator<Method>() { public int compare(Method o1, Method o2) { final ConsoleCommand ann1 = o1.getAnnotation(ConsoleCommand.class); final ConsoleCommand ann2 = o2.getAnnotation(ConsoleCommand.class); if (ann1 != null && ann2 != null) { if (ann1.priority() != ann2.priority()) // PRIORITY WINS return ann1.priority() - ann2.priority(); } int res = o1.getName().compareTo(o2.getName()); if (res == 0) res = o1.toString().compareTo(o2.toString()); return res; } }); for (final Object candidate : candidates) { final Method[] classMethods = candidate.getClass().getMethods(); for (Method m : classMethods) { if (Modifier.isAbstract(m.getModifiers()) || Modifier.isStatic(m.getModifiers()) || !Modifier.isPublic(m.getModifiers())) { continue; } if (m.getReturnType() != Void.TYPE) { continue; } methods.put(m, candidate); // depends on control dependency: [for], data = [m] } } return methods; } }
public class class_name { public void cleanup() { synchronized (_sslMap) { for (SslRelayOdo relay : _sslMap.values()) { if (relay.getHttpServer() != null && relay.isStarted()) { relay.getHttpServer().removeListener(relay); } } sslRelays.clear(); } } }
public class class_name { public void cleanup() { synchronized (_sslMap) { for (SslRelayOdo relay : _sslMap.values()) { if (relay.getHttpServer() != null && relay.isStarted()) { relay.getHttpServer().removeListener(relay); // depends on control dependency: [if], data = [none] } } sslRelays.clear(); } } }
public class class_name { public static TreeModelFilter containsLeafContainingStringIgnoreCase( final String string) { return new TreeModelFilter() { @Override public boolean acceptNode(TreeModel treeModel, TreeNode node) { if (node.isLeaf()) { if (String.valueOf(node).toLowerCase().contains( string.toLowerCase())) { return true; } } for (int i=0; i<node.getChildCount(); i++) { if (acceptNode(treeModel, node.getChildAt(i))) { return true; } } return false; } @Override public String toString() { return "TreeModelFilter[" + "containsLeafContainingStringIgnoreCase("+string+")]"; } }; } }
public class class_name { public static TreeModelFilter containsLeafContainingStringIgnoreCase( final String string) { return new TreeModelFilter() { @Override public boolean acceptNode(TreeModel treeModel, TreeNode node) { if (node.isLeaf()) { if (String.valueOf(node).toLowerCase().contains( string.toLowerCase())) { return true; // depends on control dependency: [if], data = [none] } } for (int i=0; i<node.getChildCount(); i++) { if (acceptNode(treeModel, node.getChildAt(i))) { return true; // depends on control dependency: [if], data = [none] } } return false; } @Override public String toString() { return "TreeModelFilter[" + "containsLeafContainingStringIgnoreCase("+string+")]"; } }; } }
public class class_name { @Deprecated public static <U> Stream<U> concat(final Object o, final Stream<U> stream) { Stream<U> first = null; if (o instanceof Stream) { first = (Stream) o; } else if (o instanceof Iterable) { first = stream((Iterable) o); } else if (o instanceof Streamable) { first = ((Streamable) o).stream(); } else { first = Stream.of((U) o); } return Stream.concat(first, stream); } }
public class class_name { @Deprecated public static <U> Stream<U> concat(final Object o, final Stream<U> stream) { Stream<U> first = null; if (o instanceof Stream) { first = (Stream) o; // depends on control dependency: [if], data = [none] } else if (o instanceof Iterable) { first = stream((Iterable) o); // depends on control dependency: [if], data = [none] } else if (o instanceof Streamable) { first = ((Streamable) o).stream(); // depends on control dependency: [if], data = [none] } else { first = Stream.of((U) o); // depends on control dependency: [if], data = [none] } return Stream.concat(first, stream); } }
public class class_name { public static PrivateKey decryptPrivateKey(String privateKeyStr) { try { KeyFactory keyFactory = KeyFactory.getInstance(algorithm); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(Base64Util.decode(privateKeyStr)); return keyFactory.generatePrivate(keySpec); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (InvalidKeySpecException e) { e.printStackTrace(); } return null; } }
public class class_name { public static PrivateKey decryptPrivateKey(String privateKeyStr) { try { KeyFactory keyFactory = KeyFactory.getInstance(algorithm); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(Base64Util.decode(privateKeyStr)); return keyFactory.generatePrivate(keySpec); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (InvalidKeySpecException e) { // depends on control dependency: [catch], data = [none] e.printStackTrace(); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { public double getAngleValue(String id1, String id2, String id3) { String akey = ""; if (pSet.containsKey(("angle" + id1 + ";" + id2 + ";" + id3))) { akey = "angle" + id1 + ";" + id2 + ";" + id3; } else if (pSet.containsKey(("angle" + id3 + ";" + id2 + ";" + id1))) { akey = "angle" + id3 + ";" + id2 + ";" + id1; } else if (pSet.containsKey(("angle" + id2 + ";" + id1 + ";" + id3))) { akey = "angle" + id2 + ";" + id1 + ";" + id3; } else if (pSet.containsKey(("angle" + id1 + ";" + id3 + ";" + id2))) { akey = "angle" + id1 + ";" + id3 + ";" + id2; } else if (pSet.containsKey(("angle" + id3 + ";" + id1 + ";" + id2))) { akey = "angle" + id3 + ";" + id1 + ";" + id2; } else if (pSet.containsKey(("angle" + id2 + ";" + id3 + ";" + id1))) { akey = "angle" + id2 + ";" + id3 + ";" + id1; } else { //logger.debug("KEYErrorAngle:Unknown angle key in pSet: " +id2 + " ; " + id3 + " ; " + id1+" take default angle:"+DEFAULT_ANGLE); return -1; } return ((Double) (pSet.get(akey).get(0))).doubleValue(); } }
public class class_name { public double getAngleValue(String id1, String id2, String id3) { String akey = ""; if (pSet.containsKey(("angle" + id1 + ";" + id2 + ";" + id3))) { akey = "angle" + id1 + ";" + id2 + ";" + id3; // depends on control dependency: [if], data = [none] } else if (pSet.containsKey(("angle" + id3 + ";" + id2 + ";" + id1))) { akey = "angle" + id3 + ";" + id2 + ";" + id1; // depends on control dependency: [if], data = [none] } else if (pSet.containsKey(("angle" + id2 + ";" + id1 + ";" + id3))) { akey = "angle" + id2 + ";" + id1 + ";" + id3; // depends on control dependency: [if], data = [none] } else if (pSet.containsKey(("angle" + id1 + ";" + id3 + ";" + id2))) { akey = "angle" + id1 + ";" + id3 + ";" + id2; // depends on control dependency: [if], data = [none] } else if (pSet.containsKey(("angle" + id3 + ";" + id1 + ";" + id2))) { akey = "angle" + id3 + ";" + id1 + ";" + id2; // depends on control dependency: [if], data = [none] } else if (pSet.containsKey(("angle" + id2 + ";" + id3 + ";" + id1))) { akey = "angle" + id2 + ";" + id3 + ";" + id1; // depends on control dependency: [if], data = [none] } else { //logger.debug("KEYErrorAngle:Unknown angle key in pSet: " +id2 + " ; " + id3 + " ; " + id1+" take default angle:"+DEFAULT_ANGLE); return -1; // depends on control dependency: [if], data = [none] } return ((Double) (pSet.get(akey).get(0))).doubleValue(); } }
public class class_name { public void setTrasmit(boolean active) { for (SendStream sendStream : sendStreams) { try { if (active) { sendStream.start(); LOGGER.fine("START"); } else { sendStream.stop(); LOGGER.fine("STOP"); } } catch (IOException e) { LOGGER.log(Level.WARNING, "exception", e); } } } }
public class class_name { public void setTrasmit(boolean active) { for (SendStream sendStream : sendStreams) { try { if (active) { sendStream.start(); // depends on control dependency: [if], data = [none] LOGGER.fine("START"); // depends on control dependency: [if], data = [none] } else { sendStream.stop(); // depends on control dependency: [if], data = [none] LOGGER.fine("STOP"); // depends on control dependency: [if], data = [none] } } catch (IOException e) { LOGGER.log(Level.WARNING, "exception", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { @Override public List<ValidationProvider<?>> getValidationProviders() { // first try the TCCL List<ValidationProvider<?>> providers = loadProviders(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged()); if (providers != null && !providers.isEmpty()) { return providers; } // otherwise use the loader of this class else { return loadProviders(WildFlySecurityManager.getClassLoaderPrivileged(WildFlyProviderResolver.class)); } } }
public class class_name { @Override public List<ValidationProvider<?>> getValidationProviders() { // first try the TCCL List<ValidationProvider<?>> providers = loadProviders(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged()); if (providers != null && !providers.isEmpty()) { return providers; // depends on control dependency: [if], data = [none] } // otherwise use the loader of this class else { return loadProviders(WildFlySecurityManager.getClassLoaderPrivileged(WildFlyProviderResolver.class)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public int read(byte []buf, int offset, int length) throws IOException { try { SocketChannel s = _s; if (s == null) { return -1; } int remaining = _readBuffer.remaining(); if (remaining <= 0) { _readBuffer.clear(); if (s.read(_readBuffer) < 0) { _readBuffer.flip(); return -1; } _readBuffer.flip(); remaining = _readBuffer.remaining(); } int sublen = Math.min(remaining, length); _readBuffer.get(buf, offset, sublen); int readLength = sublen; if (readLength >= 0) { _totalReadBytes += readLength; } return readLength; } catch (InterruptedIOException e) { if (_throwReadInterrupts) throw e; log.log(Level.FINEST, e.toString(), e); } catch (IOException e) { if (_throwReadInterrupts) { throw e; } if (log.isLoggable(Level.FINEST)) { log.log(Level.FINEST, e.toString(), e); } else { log.finer(e.toString()); } // server/0611 /* try { close(); } catch (IOException e1) { } */ } return -1; } }
public class class_name { @Override public int read(byte []buf, int offset, int length) throws IOException { try { SocketChannel s = _s; if (s == null) { return -1; } int remaining = _readBuffer.remaining(); if (remaining <= 0) { _readBuffer.clear(); if (s.read(_readBuffer) < 0) { _readBuffer.flip(); return -1; } _readBuffer.flip(); remaining = _readBuffer.remaining(); } int sublen = Math.min(remaining, length); _readBuffer.get(buf, offset, sublen); int readLength = sublen; if (readLength >= 0) { _totalReadBytes += readLength; } return readLength; } catch (InterruptedIOException e) { if (_throwReadInterrupts) throw e; log.log(Level.FINEST, e.toString(), e); } catch (IOException e) { if (_throwReadInterrupts) { throw e; } if (log.isLoggable(Level.FINEST)) { log.log(Level.FINEST, e.toString(), e); // depends on control dependency: [if], data = [none] } else { log.finer(e.toString()); // depends on control dependency: [if], data = [none] } // server/0611 /* try { close(); } catch (IOException e1) { } */ } return -1; } }
public class class_name { public static Version min(Version... versions) { if (versions.length == 0) { throw new IllegalArgumentException( "At least one version needs to be provided for minimum calculation."); } Version minimum = versions[0]; for (int index = 1; index < versions.length; ++index) { Version version = versions[index]; if (minimum.compareTo(version) > 0) { minimum = version; } } return minimum; } }
public class class_name { public static Version min(Version... versions) { if (versions.length == 0) { throw new IllegalArgumentException( "At least one version needs to be provided for minimum calculation."); } Version minimum = versions[0]; for (int index = 1; index < versions.length; ++index) { Version version = versions[index]; if (minimum.compareTo(version) > 0) { minimum = version; // depends on control dependency: [if], data = [none] } } return minimum; } }
public class class_name { public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { if (obj instanceof Date) { return format((Date) obj, toAppendTo); } else if (obj instanceof Calendar) { return format((Calendar) obj, toAppendTo); } else if (obj instanceof Long) { return format(((Long) obj).longValue(), toAppendTo); } else { throw new IllegalArgumentException("Unknown class: " + (obj == null ? "<null>" : obj.getClass().getName())); } } }
public class class_name { public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { if (obj instanceof Date) { return format((Date) obj, toAppendTo); // depends on control dependency: [if], data = [none] } else if (obj instanceof Calendar) { return format((Calendar) obj, toAppendTo); // depends on control dependency: [if], data = [none] } else if (obj instanceof Long) { return format(((Long) obj).longValue(), toAppendTo); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unknown class: " + (obj == null ? "<null>" : obj.getClass().getName())); } } }
public class class_name { public MethodKey createCopy() { int size = getParameterCount(); Class[] paramTypes = new Class[size]; for (int i = 0; i < size; i++) { paramTypes[i] = getParameterType(i); } return new DefaultMethodKey(sender, name, paramTypes, isCallToSuper); } }
public class class_name { public MethodKey createCopy() { int size = getParameterCount(); Class[] paramTypes = new Class[size]; for (int i = 0; i < size; i++) { paramTypes[i] = getParameterType(i); // depends on control dependency: [for], data = [i] } return new DefaultMethodKey(sender, name, paramTypes, isCallToSuper); } }
public class class_name { public void load(String fileName){ try { InputStreamReader read = new InputStreamReader (new FileInputStream(fileName),"utf-8"); BufferedReader bin = new BufferedReader(read); RETemplate qt; qt = new RETemplate(); qt.comment = fileName; StringBuilder sb; String line; // if(fileName.contains("歌曲 - 无修饰推荐")) // errorLogger.debug(""); //读入前缀、后缀 String prefix=""; String suffix=""; while((line = bin.readLine()) != null){ if(line.length()==0) break; if(line.charAt(0)=='@'){ if(line.substring(1, 7).compareTo("PREFIX")==0) prefix = line.substring(8); if(line.substring(1, 7).compareTo("SUFFIX")==0) suffix = line.substring(8); } } //读入模板 while((line = bin.readLine()) != null){ if(line.length()==0) break; line = prefix + line + suffix; try { qt.addTemplate(line,1); count++; } catch (Exception e) { System.out.println(fileName); continue; } } group.add(qt); } catch (Exception e1) { e1.printStackTrace(); } } }
public class class_name { public void load(String fileName){ try { InputStreamReader read = new InputStreamReader (new FileInputStream(fileName),"utf-8"); BufferedReader bin = new BufferedReader(read); RETemplate qt; qt = new RETemplate(); // depends on control dependency: [try], data = [none] qt.comment = fileName; // depends on control dependency: [try], data = [none] StringBuilder sb; String line; // if(fileName.contains("歌曲 - 无修饰推荐")) // errorLogger.debug(""); //读入前缀、后缀 String prefix=""; String suffix=""; while((line = bin.readLine()) != null){ if(line.length()==0) break; if(line.charAt(0)=='@'){ if(line.substring(1, 7).compareTo("PREFIX")==0) prefix = line.substring(8); if(line.substring(1, 7).compareTo("SUFFIX")==0) suffix = line.substring(8); } } //读入模板 while((line = bin.readLine()) != null){ if(line.length()==0) break; line = prefix + line + suffix; // depends on control dependency: [while], data = [none] try { qt.addTemplate(line,1); // depends on control dependency: [try], data = [none] count++; // depends on control dependency: [try], data = [none] } catch (Exception e) { System.out.println(fileName); continue; } // depends on control dependency: [catch], data = [none] } group.add(qt); // depends on control dependency: [try], data = [none] } catch (Exception e1) { e1.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void columnSelectionChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int iColumn = m_jTableScreen.getSelectedColumn(); if (iColumn != -1) if (m_thinTableModel != null) // In case this was freed before I got the message { Convert converter = m_thinTableModel.getFieldInfo(iColumn); BaseApplet baseApplet = this.getBaseApplet(); if (baseApplet != null) { if (converter instanceof FieldInfo) baseApplet.setStatusText(((FieldInfo)converter).getFieldTip()); else { TableColumnModel columnModel = m_jTableScreen.getTableHeader().getColumnModel(); TableColumn tableColumn = columnModel.getColumn(iColumn); TableCellEditor editor = tableColumn.getCellEditor(); String strTip = null; if (editor instanceof JComponent) { String strName = ((JComponent)editor).getName(); if (strName != null) { strName += Constants.TIP; strTip = baseApplet.getString(strName); if (strTip == strName) strTip = baseApplet.getString(((JComponent)editor).getName()); } } baseApplet.setStatusText(strTip); } String strLastError = baseApplet.getLastError(0); if ((strLastError != null) && (strLastError.length() > 0)) baseApplet.setStatusText(strLastError); } } } } }
public class class_name { public void columnSelectionChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { int iColumn = m_jTableScreen.getSelectedColumn(); if (iColumn != -1) if (m_thinTableModel != null) // In case this was freed before I got the message { Convert converter = m_thinTableModel.getFieldInfo(iColumn); BaseApplet baseApplet = this.getBaseApplet(); if (baseApplet != null) { if (converter instanceof FieldInfo) baseApplet.setStatusText(((FieldInfo)converter).getFieldTip()); else { TableColumnModel columnModel = m_jTableScreen.getTableHeader().getColumnModel(); TableColumn tableColumn = columnModel.getColumn(iColumn); TableCellEditor editor = tableColumn.getCellEditor(); String strTip = null; if (editor instanceof JComponent) { String strName = ((JComponent)editor).getName(); if (strName != null) { strName += Constants.TIP; // depends on control dependency: [if], data = [none] strTip = baseApplet.getString(strName); // depends on control dependency: [if], data = [(strName] if (strTip == strName) strTip = baseApplet.getString(((JComponent)editor).getName()); } } baseApplet.setStatusText(strTip); // depends on control dependency: [if], data = [none] } String strLastError = baseApplet.getLastError(0); if ((strLastError != null) && (strLastError.length() > 0)) baseApplet.setStatusText(strLastError); } } } } }
public class class_name { public void goToUrlWithCookies(final String url, final Map<String, String> cookieNamesValues) { LOG.info("Getting: " + url + " with cookies: " + cookieNamesValues); driver.get(url + "/404.html"); // this should display 404 not found driver.manage().deleteAllCookies(); Set<Entry<String, String>> entries = cookieNamesValues.entrySet(); for (Entry<String, String> cookieEntry : entries) { driver.manage().addCookie( new Cookie(cookieEntry.getKey(), cookieEntry.getValue())); } driver.get(url); } }
public class class_name { public void goToUrlWithCookies(final String url, final Map<String, String> cookieNamesValues) { LOG.info("Getting: " + url + " with cookies: " + cookieNamesValues); driver.get(url + "/404.html"); // this should display 404 not found driver.manage().deleteAllCookies(); Set<Entry<String, String>> entries = cookieNamesValues.entrySet(); for (Entry<String, String> cookieEntry : entries) { driver.manage().addCookie( new Cookie(cookieEntry.getKey(), cookieEntry.getValue())); // depends on control dependency: [for], data = [none] } driver.get(url); } }
public class class_name { protected Cassandra.Client getConnection(Object connection) { if (connection != null) { return ((Connection) connection).getClient(); } throw new KunderaException("Invalid configuration!, no available pooled connection found for:" + this.getClass().getSimpleName()); } }
public class class_name { protected Cassandra.Client getConnection(Object connection) { if (connection != null) { return ((Connection) connection).getClient(); // depends on control dependency: [if], data = [none] } throw new KunderaException("Invalid configuration!, no available pooled connection found for:" + this.getClass().getSimpleName()); } }
public class class_name { public CertificateDeleteHeaders withLastModified(DateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { this.lastModified = new DateTimeRfc1123(lastModified); } return this; } }
public class class_name { public CertificateDeleteHeaders withLastModified(DateTime lastModified) { if (lastModified == null) { this.lastModified = null; // depends on control dependency: [if], data = [none] } else { this.lastModified = new DateTimeRfc1123(lastModified); // depends on control dependency: [if], data = [(lastModified] } return this; } }
public class class_name { protected ClassLoader getClassLoader(Set<Artifact> artifacts) throws Exception { Set<URL> classpathURLs = new LinkedHashSet<URL>(); addCustomClasspaths(classpathURLs, true); // add ourselves to top of classpath URL mainClasses = new File(project.getBuild().getOutputDirectory()).toURI().toURL(); getLog().debug("Adding to classpath : " + mainClasses); classpathURLs.add(mainClasses); for (Artifact artifact : artifacts) { File file = artifact.getFile(); if (file != null) { classpathURLs.add(file.toURI().toURL()); } } addCustomClasspaths(classpathURLs, false); if (logClasspath) { getLog().info("Classpath (" + classpathURLs.size() + " entries):"); for (URL url : classpathURLs) { getLog().info(" " + url.getFile().toString()); } } return new URLClassLoader(classpathURLs.toArray(new URL[classpathURLs.size()])); } }
public class class_name { protected ClassLoader getClassLoader(Set<Artifact> artifacts) throws Exception { Set<URL> classpathURLs = new LinkedHashSet<URL>(); addCustomClasspaths(classpathURLs, true); // add ourselves to top of classpath URL mainClasses = new File(project.getBuild().getOutputDirectory()).toURI().toURL(); getLog().debug("Adding to classpath : " + mainClasses); classpathURLs.add(mainClasses); for (Artifact artifact : artifacts) { File file = artifact.getFile(); if (file != null) { classpathURLs.add(file.toURI().toURL()); // depends on control dependency: [if], data = [(file] } } addCustomClasspaths(classpathURLs, false); if (logClasspath) { getLog().info("Classpath (" + classpathURLs.size() + " entries):"); for (URL url : classpathURLs) { getLog().info(" " + url.getFile().toString()); // depends on control dependency: [for], data = [url] } } return new URLClassLoader(classpathURLs.toArray(new URL[classpathURLs.size()])); } }
public class class_name { private ScaleTypeDrawable getScaleTypeDrawableAtIndex(int index) { DrawableParent parent = getParentDrawableAtIndex(index); if (parent instanceof ScaleTypeDrawable) { return (ScaleTypeDrawable) parent; } else { return WrappingUtils.wrapChildWithScaleType(parent, ScalingUtils.ScaleType.FIT_XY); } } }
public class class_name { private ScaleTypeDrawable getScaleTypeDrawableAtIndex(int index) { DrawableParent parent = getParentDrawableAtIndex(index); if (parent instanceof ScaleTypeDrawable) { return (ScaleTypeDrawable) parent; // depends on control dependency: [if], data = [none] } else { return WrappingUtils.wrapChildWithScaleType(parent, ScalingUtils.ScaleType.FIT_XY); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public FileSystemManager provide() { try { return VFS.getManager(); } catch (FileSystemException fse) { logger.error("Cannot create FileSystemManager", fse); throw new RuntimeException("Cannot create FileSystemManager", fse); } } }
public class class_name { @Override public FileSystemManager provide() { try { return VFS.getManager(); // depends on control dependency: [try], data = [none] } catch (FileSystemException fse) { logger.error("Cannot create FileSystemManager", fse); throw new RuntimeException("Cannot create FileSystemManager", fse); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static int compilerOptionsMapFromConfig(IConfig config, Map<AccessibleObject, List<Object>> resultMap, boolean propFieldsOnly /* for unit testing */) { final String sourceMethod = "addCompilerOptionsFromConfig"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{config}); } int numFailed = 0; CompilerOptions test_options = new CompilerOptions(); Map<AccessibleObject, List<Object>> test_map = new HashMap<AccessibleObject, List<Object>>(); resultMap.clear(); Object optionsParamObj = config.getProperty(COMPILEROPTIONS_CONFIGPARAM, Map.class); if (optionsParamObj != null && optionsParamObj instanceof Map) { Map<?,?> optionsParam = (Map<?,?>)optionsParamObj; for (Map.Entry<?, ?> entry : optionsParam.entrySet()) { String key = entry.getKey().toString(); Object value = entry.getValue(); List<Object> args = new ArrayList<Object>(); if (value instanceof List) { // Add the elements in the array to the args list @SuppressWarnings("unchecked") List<Object> listValue = (List<Object>)value; args.addAll(listValue); } else { args = new ArrayList<Object>(); args.add(value); } // find a matching setter in the CompilerOptions class String setterMethodName = "set" + key.substring(0,1).toUpperCase() + key.substring(1); //$NON-NLS-1$ Method setterMethod = findSetterMethod(setterMethodName, args); test_map.clear(); if (setterMethod != null && !propFieldsOnly) { test_map.put(setterMethod, args); } else if (args.size() == 1){ // See if there is a public property with the matching name and type MutableObject<Object> valueHolder = new MutableObject<Object>(args.get(0)); Field field = findField(key, valueHolder); if (field != null) { args = new ArrayList<Object>(1); args.add(valueHolder.getValue()); test_map.put(field, args); } else { numFailed++; if (log.isLoggable(Level.WARNING)) { log.logp(Level.WARNING, sourceClass, sourceMethod, MessageFormat.format( Messages.CompilerUtil_2, new Object[]{ key + "=" + value //$NON-NLS-1$ } ) ); } } } if (!test_map.isEmpty()) { // Apply the option to a test instance to make sure it works if (applyCompilerOptionsFromMap(test_options, test_map) == 0) { // option was successfully applied. Add the option to the result map resultMap.putAll(test_map); } else { ++numFailed; } } } } if (isTraceLogging) { log.exiting(sourceMethod, sourceMethod, numFailed); } return numFailed; } }
public class class_name { static int compilerOptionsMapFromConfig(IConfig config, Map<AccessibleObject, List<Object>> resultMap, boolean propFieldsOnly /* for unit testing */) { final String sourceMethod = "addCompilerOptionsFromConfig"; //$NON-NLS-1$ final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{config}); // depends on control dependency: [if], data = [none] } int numFailed = 0; CompilerOptions test_options = new CompilerOptions(); Map<AccessibleObject, List<Object>> test_map = new HashMap<AccessibleObject, List<Object>>(); resultMap.clear(); Object optionsParamObj = config.getProperty(COMPILEROPTIONS_CONFIGPARAM, Map.class); if (optionsParamObj != null && optionsParamObj instanceof Map) { Map<?,?> optionsParam = (Map<?,?>)optionsParamObj; for (Map.Entry<?, ?> entry : optionsParam.entrySet()) { String key = entry.getKey().toString(); Object value = entry.getValue(); List<Object> args = new ArrayList<Object>(); if (value instanceof List) { // Add the elements in the array to the args list @SuppressWarnings("unchecked") List<Object> listValue = (List<Object>)value; args.addAll(listValue); // depends on control dependency: [if], data = [none] } else { args = new ArrayList<Object>(); // depends on control dependency: [if], data = [none] args.add(value); // depends on control dependency: [if], data = [none] } // find a matching setter in the CompilerOptions class String setterMethodName = "set" + key.substring(0,1).toUpperCase() + key.substring(1); //$NON-NLS-1$ Method setterMethod = findSetterMethod(setterMethodName, args); test_map.clear(); // depends on control dependency: [for], data = [none] if (setterMethod != null && !propFieldsOnly) { test_map.put(setterMethod, args); // depends on control dependency: [if], data = [(setterMethod] } else if (args.size() == 1){ // See if there is a public property with the matching name and type MutableObject<Object> valueHolder = new MutableObject<Object>(args.get(0)); Field field = findField(key, valueHolder); if (field != null) { args = new ArrayList<Object>(1); // depends on control dependency: [if], data = [none] args.add(valueHolder.getValue()); // depends on control dependency: [if], data = [none] test_map.put(field, args); // depends on control dependency: [if], data = [(field] } else { numFailed++; // depends on control dependency: [if], data = [none] if (log.isLoggable(Level.WARNING)) { log.logp(Level.WARNING, sourceClass, sourceMethod, MessageFormat.format( Messages.CompilerUtil_2, new Object[]{ key + "=" + value //$NON-NLS-1$ } ) ); // depends on control dependency: [if], data = [none] } } } if (!test_map.isEmpty()) { // Apply the option to a test instance to make sure it works if (applyCompilerOptionsFromMap(test_options, test_map) == 0) { // option was successfully applied. Add the option to the result map resultMap.putAll(test_map); // depends on control dependency: [if], data = [none] } else { ++numFailed; // depends on control dependency: [if], data = [none] } } } } if (isTraceLogging) { log.exiting(sourceMethod, sourceMethod, numFailed); // depends on control dependency: [if], data = [none] } return numFailed; } }
public class class_name { public static Style createStyleForColortable( String colorTableName, double min, double max, double[] values, double opacity ) throws Exception { List<Color> colorList = new ArrayList<Color>(); String tableString = new DefaultTables().getTableString(colorTableName); if (tableString == null) { return null; } String[] split = tableString.split("\n"); List<Double> newValues = null; // if necessary for( String line : split ) { if (line.startsWith("#")) { //$NON-NLS-1$ continue; } String[] lineSplit = line.trim().split("\\s+"); //$NON-NLS-1$ if (lineSplit.length == 3) { int r = Integer.parseInt(lineSplit[0]); int g = Integer.parseInt(lineSplit[1]); int b = Integer.parseInt(lineSplit[2]); colorList.add(new Color(r, g, b)); } else if (lineSplit.length == 8) { if (newValues == null) { newValues = new ArrayList<Double>(); } // also value are provided, rewrite input values double v1 = Double.parseDouble(lineSplit[0]); int r1 = Integer.parseInt(lineSplit[1]); int g1 = Integer.parseInt(lineSplit[2]); int b1 = Integer.parseInt(lineSplit[3]); colorList.add(new Color(r1, g1, b1)); newValues.add(v1); double v2 = Double.parseDouble(lineSplit[4]); int r2 = Integer.parseInt(lineSplit[5]); int g2 = Integer.parseInt(lineSplit[6]); int b2 = Integer.parseInt(lineSplit[7]); colorList.add(new Color(r2, g2, b2)); newValues.add(v2); } else if (lineSplit.length == 4) { if (newValues == null) { newValues = new ArrayList<Double>(); } // also value are provided, rewrite input values double v1 = Double.parseDouble(lineSplit[0]); int r1 = Integer.parseInt(lineSplit[1]); int g1 = Integer.parseInt(lineSplit[2]); int b1 = Integer.parseInt(lineSplit[3]); colorList.add(new Color(r1, g1, b1)); newValues.add(v1); } } Color[] colorsArray = colorList.toArray(new Color[0]); if (newValues != null) { // redefine values values = new double[newValues.size()]; for( int i = 0; i < newValues.size(); i++ ) { values[i] = newValues.get(i); } } return createRasterStyle(min, max, values, colorsArray, opacity); } }
public class class_name { public static Style createStyleForColortable( String colorTableName, double min, double max, double[] values, double opacity ) throws Exception { List<Color> colorList = new ArrayList<Color>(); String tableString = new DefaultTables().getTableString(colorTableName); if (tableString == null) { return null; } String[] split = tableString.split("\n"); List<Double> newValues = null; // if necessary for( String line : split ) { if (line.startsWith("#")) { //$NON-NLS-1$ continue; } String[] lineSplit = line.trim().split("\\s+"); //$NON-NLS-1$ if (lineSplit.length == 3) { int r = Integer.parseInt(lineSplit[0]); int g = Integer.parseInt(lineSplit[1]); int b = Integer.parseInt(lineSplit[2]); colorList.add(new Color(r, g, b)); // depends on control dependency: [if], data = [none] } else if (lineSplit.length == 8) { if (newValues == null) { newValues = new ArrayList<Double>(); // depends on control dependency: [if], data = [none] } // also value are provided, rewrite input values double v1 = Double.parseDouble(lineSplit[0]); int r1 = Integer.parseInt(lineSplit[1]); int g1 = Integer.parseInt(lineSplit[2]); int b1 = Integer.parseInt(lineSplit[3]); colorList.add(new Color(r1, g1, b1)); // depends on control dependency: [if], data = [none] newValues.add(v1); // depends on control dependency: [if], data = [none] double v2 = Double.parseDouble(lineSplit[4]); int r2 = Integer.parseInt(lineSplit[5]); int g2 = Integer.parseInt(lineSplit[6]); int b2 = Integer.parseInt(lineSplit[7]); colorList.add(new Color(r2, g2, b2)); // depends on control dependency: [if], data = [none] newValues.add(v2); // depends on control dependency: [if], data = [none] } else if (lineSplit.length == 4) { if (newValues == null) { newValues = new ArrayList<Double>(); // depends on control dependency: [if], data = [none] } // also value are provided, rewrite input values double v1 = Double.parseDouble(lineSplit[0]); int r1 = Integer.parseInt(lineSplit[1]); int g1 = Integer.parseInt(lineSplit[2]); int b1 = Integer.parseInt(lineSplit[3]); colorList.add(new Color(r1, g1, b1)); // depends on control dependency: [if], data = [none] newValues.add(v1); // depends on control dependency: [if], data = [none] } } Color[] colorsArray = colorList.toArray(new Color[0]); if (newValues != null) { // redefine values values = new double[newValues.size()]; for( int i = 0; i < newValues.size(); i++ ) { values[i] = newValues.get(i); } } return createRasterStyle(min, max, values, colorsArray, opacity); } }
public class class_name { public void sort( int data[] , int begin , int end ) { histogram.fill(0); for( int i = begin; i < end; i++ ) { histogram.data[data[i]-minValue]++; } // over wrist the input data with sorted elements int index = begin; for( int i = 0; i < histogram.size; i++ ) { int N = histogram.get(i); int value = i+minValue; for( int j = 0; j < N; j++ ) { data[index++] = value; } } } }
public class class_name { public void sort( int data[] , int begin , int end ) { histogram.fill(0); for( int i = begin; i < end; i++ ) { histogram.data[data[i]-minValue]++; // depends on control dependency: [for], data = [i] } // over wrist the input data with sorted elements int index = begin; for( int i = 0; i < histogram.size; i++ ) { int N = histogram.get(i); int value = i+minValue; for( int j = 0; j < N; j++ ) { data[index++] = value; // depends on control dependency: [for], data = [none] } } } }
public class class_name { public static String[] split(String str, boolean keepQuote, boolean keepBlank, char... seps) { List<String> list = new LinkedList<String>(); char[] cs = str.toCharArray(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < cs.length; i++) { char c = cs[i]; // 遇到分隔符号 if (Nums.isin(seps, c)) { if (keepBlank || !Strings.isBlank(sb)) { String s2 = sb.toString(); if (!keepQuote) s2 = evalEscape(s2); list.add(s2); sb = new StringBuilder(); } } // 如果是转义字符 else if (c == '\\') { i++; if (keepQuote) sb.append(c); if (i < cs.length) { c = cs[i]; sb.append(c); } else { break; } } // 字符串 else if (c == '\'' || c == '"' || c == '`') { if (keepQuote) sb.append(c); while (++i < cs.length) { char c2 = cs[i]; // 如果是转义字符 if (c2 == '\\') { sb.append('\\'); i++; if (i < cs.length) { c2 = cs[i]; sb.append(c2); } else { break; } } // 退出字符串 else if (c2 == c) { if (keepQuote) sb.append(c2); break; } // 其他附加 else { sb.append(c2); } } } // 其他,计入 else { sb.append(c); } } // 添加最后一个 if (keepBlank || !Strings.isBlank(sb)) { String s2 = sb.toString(); if (!keepQuote) s2 = evalEscape(s2); list.add(s2); } // 返回拆分后的数组 return list.toArray(new String[list.size()]); } }
public class class_name { public static String[] split(String str, boolean keepQuote, boolean keepBlank, char... seps) { List<String> list = new LinkedList<String>(); char[] cs = str.toCharArray(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < cs.length; i++) { char c = cs[i]; // 遇到分隔符号 if (Nums.isin(seps, c)) { if (keepBlank || !Strings.isBlank(sb)) { String s2 = sb.toString(); if (!keepQuote) s2 = evalEscape(s2); list.add(s2); // depends on control dependency: [if], data = [none] sb = new StringBuilder(); // depends on control dependency: [if], data = [none] } } // 如果是转义字符 else if (c == '\\') { i++; // depends on control dependency: [if], data = [none] if (keepQuote) sb.append(c); if (i < cs.length) { c = cs[i]; // depends on control dependency: [if], data = [none] sb.append(c); // depends on control dependency: [if], data = [none] } else { break; } } // 字符串 else if (c == '\'' || c == '"' || c == '`') { if (keepQuote) sb.append(c); while (++i < cs.length) { char c2 = cs[i]; // 如果是转义字符 if (c2 == '\\') { sb.append('\\'); // depends on control dependency: [if], data = ['\\')] i++; // depends on control dependency: [if], data = [none] if (i < cs.length) { c2 = cs[i]; // depends on control dependency: [if], data = [none] sb.append(c2); // depends on control dependency: [if], data = [none] } else { break; } } // 退出字符串 else if (c2 == c) { if (keepQuote) sb.append(c2); break; } // 其他附加 else { sb.append(c2); // depends on control dependency: [if], data = [(c2] } } } // 其他,计入 else { sb.append(c); // depends on control dependency: [if], data = [(c] } } // 添加最后一个 if (keepBlank || !Strings.isBlank(sb)) { String s2 = sb.toString(); if (!keepQuote) s2 = evalEscape(s2); list.add(s2); // depends on control dependency: [if], data = [none] } // 返回拆分后的数组 return list.toArray(new String[list.size()]); } }
public class class_name { private List<byte[]> copyScanlines(List<byte[]> original) { final List<byte[]> copy = new ArrayList<>(original.size()); for (byte[] scanline : original) { copy.add(scanline.clone()); } return copy; } }
public class class_name { private List<byte[]> copyScanlines(List<byte[]> original) { final List<byte[]> copy = new ArrayList<>(original.size()); for (byte[] scanline : original) { copy.add(scanline.clone()); // depends on control dependency: [for], data = [scanline] } return copy; } }
public class class_name { @SuppressWarnings("unchecked") // Pipeline ensures the proper type will be returned from getMany public <T> CloseableIterator<T> getMany(final Class<T> type, final Map<String, Object> query, final boolean streaming) { final List<SourceHandler<?, ?>> handlers = getSourceHandlers(type); if(handlers.isEmpty()) { return null; } final PipelineContext context = newContext(); for(final SourceHandler<?, ?> handler : handlers) { final CloseableIterator<T> result = (CloseableIterator<T>)handler.getMany(query, context, streaming); if(result != null) { return result; } } return null; } }
public class class_name { @SuppressWarnings("unchecked") // Pipeline ensures the proper type will be returned from getMany public <T> CloseableIterator<T> getMany(final Class<T> type, final Map<String, Object> query, final boolean streaming) { final List<SourceHandler<?, ?>> handlers = getSourceHandlers(type); if(handlers.isEmpty()) { return null; // depends on control dependency: [if], data = [none] } final PipelineContext context = newContext(); for(final SourceHandler<?, ?> handler : handlers) { final CloseableIterator<T> result = (CloseableIterator<T>)handler.getMany(query, context, streaming); if(result != null) { return result; // depends on control dependency: [if], data = [none] } } return null; } }
public class class_name { public Record getHistoryRecord() { if (m_recDependent == null) { if (m_strRecHistoryClass != null) { m_recDependent = Record.makeRecordFromClassName(m_strRecHistoryClass, Record.findRecordOwner(this.getOwner())); if (m_recDependent != null) { m_bCloseOnFree = true; m_recDependent.addListener(new FileRemoveBOnCloseHandler(this)); // Being careful if (m_recDependent.getListener(RecordChangedHandler.class) != null) m_recDependent.removeListener(this.getOwner().getListener(RecordChangedHandler.class), true); // I replace this listener } } } return m_recDependent; } }
public class class_name { public Record getHistoryRecord() { if (m_recDependent == null) { if (m_strRecHistoryClass != null) { m_recDependent = Record.makeRecordFromClassName(m_strRecHistoryClass, Record.findRecordOwner(this.getOwner())); // depends on control dependency: [if], data = [(m_strRecHistoryClass] if (m_recDependent != null) { m_bCloseOnFree = true; // depends on control dependency: [if], data = [none] m_recDependent.addListener(new FileRemoveBOnCloseHandler(this)); // Being careful // depends on control dependency: [if], data = [none] if (m_recDependent.getListener(RecordChangedHandler.class) != null) m_recDependent.removeListener(this.getOwner().getListener(RecordChangedHandler.class), true); // I replace this listener } } } return m_recDependent; } }
public class class_name { public Site addCookie(String domain, String name, String value) { if (!cookies.containsKey(domain)){ cookies.put(domain,new HashMap<String, String>()); } cookies.get(domain).put(name, value); return this; } }
public class class_name { public Site addCookie(String domain, String name, String value) { if (!cookies.containsKey(domain)){ cookies.put(domain,new HashMap<String, String>()); // depends on control dependency: [if], data = [none] } cookies.get(domain).put(name, value); return this; } }
public class class_name { public Variable remove(String name) { if (context.containsKey(name)) { return context.remove(name); } else { return null; } } }
public class class_name { public Variable remove(String name) { if (context.containsKey(name)) { return context.remove(name); // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { public final void expurge() { final Iterator<Entry<K, ReferencableValue<K, V>>> iter = this.map.entrySet().iterator(); Entry<K, ReferencableValue<K, V>> entry; ReferencableValue<K, V> value; while (iter.hasNext()) { entry = iter.next(); if (entry != null) { value = entry.getValue(); if ((value != null) && ((value.isEnqueued()) || (value.get() == null))) { value.enqueue(); value.clear(); } } } Reference<? extends V> reference; while ((reference = this.queue.poll()) != null) { if (reference instanceof ReferencableValue<?, ?>) { this.map.remove(((ReferencableValue<?, ?>) reference).getKey()); } reference.clear(); } } }
public class class_name { public final void expurge() { final Iterator<Entry<K, ReferencableValue<K, V>>> iter = this.map.entrySet().iterator(); Entry<K, ReferencableValue<K, V>> entry; ReferencableValue<K, V> value; while (iter.hasNext()) { entry = iter.next(); // depends on control dependency: [while], data = [none] if (entry != null) { value = entry.getValue(); // depends on control dependency: [if], data = [none] if ((value != null) && ((value.isEnqueued()) || (value.get() == null))) { value.enqueue(); // depends on control dependency: [if], data = [none] value.clear(); // depends on control dependency: [if], data = [none] } } } Reference<? extends V> reference; while ((reference = this.queue.poll()) != null) { if (reference instanceof ReferencableValue<?, ?>) { this.map.remove(((ReferencableValue<?, ?>) reference).getKey()); // depends on control dependency: [if], data = [)] } reference.clear(); // depends on control dependency: [while], data = [none] } } }
public class class_name { static FileEntry obtainDirectoryFileEntry(String path) { try { FileEntry lastEntry = null; Constructor<FileEntry> c = FileEntry.class.getDeclaredConstructor(FileEntry.class, String.class, int.class, boolean.class); c.setAccessible(true); for (String part : path.split("/")) { lastEntry = c.newInstance(lastEntry, part, TYPE_DIRECTORY, lastEntry == null); } return lastEntry; } catch (NoSuchMethodException ignored) { } catch (InvocationTargetException ignored) { } catch (InstantiationException ignored) { } catch (IllegalAccessException ignored) { } return null; } }
public class class_name { static FileEntry obtainDirectoryFileEntry(String path) { try { FileEntry lastEntry = null; Constructor<FileEntry> c = FileEntry.class.getDeclaredConstructor(FileEntry.class, String.class, int.class, boolean.class); c.setAccessible(true); // depends on control dependency: [try], data = [none] for (String part : path.split("/")) { lastEntry = c.newInstance(lastEntry, part, TYPE_DIRECTORY, lastEntry == null); // depends on control dependency: [for], data = [part] } return lastEntry; // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException ignored) { } catch (InvocationTargetException ignored) { // depends on control dependency: [catch], data = [none] } catch (InstantiationException ignored) { // depends on control dependency: [catch], data = [none] } catch (IllegalAccessException ignored) { // depends on control dependency: [catch], data = [none] } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { ProblemType guessProblemType() { if (_problem_type == auto) { boolean image = false; boolean text = false; String first = null; Vec v = train().vec(0); if (v.isString() || v.isCategorical() /*small data parser artefact*/) { BufferedString bs = new BufferedString(); first = v.atStr(bs, 0).toString(); try { ImageIO.read(new File(first)); image = true; } catch (Throwable t) { } try { ImageIO.read(new URL(first)); image = true; } catch (Throwable t) { } } if (first != null) { if (!image && (first.endsWith(".jpg") || first.endsWith(".png") || first.endsWith(".tif"))) { image = true; Log.warn("Cannot read first image at " + first + " - Check data."); } else if (v.isString() && train().numCols() <= 4) { //at most text, label, fold_col, weight text = true; } } if (image) return ProblemType.image; else if (text) return ProblemType.text; else return ProblemType.dataset; } else { return _problem_type; } } }
public class class_name { ProblemType guessProblemType() { if (_problem_type == auto) { boolean image = false; boolean text = false; String first = null; Vec v = train().vec(0); if (v.isString() || v.isCategorical() /*small data parser artefact*/) { BufferedString bs = new BufferedString(); first = v.atStr(bs, 0).toString(); // depends on control dependency: [if], data = [none] try { ImageIO.read(new File(first)); // depends on control dependency: [try], data = [none] image = true; // depends on control dependency: [try], data = [none] } catch (Throwable t) { } // depends on control dependency: [catch], data = [none] try { ImageIO.read(new URL(first)); // depends on control dependency: [try], data = [none] image = true; // depends on control dependency: [try], data = [none] } catch (Throwable t) { } // depends on control dependency: [catch], data = [none] } if (first != null) { if (!image && (first.endsWith(".jpg") || first.endsWith(".png") || first.endsWith(".tif"))) { image = true; Log.warn("Cannot read first image at " + first + " - Check data."); // depends on control dependency: [if], data = [none] } else if (v.isString() && train().numCols() <= 4) { //at most text, label, fold_col, weight text = true; // depends on control dependency: [if], data = [none] } } if (image) return ProblemType.image; else if (text) return ProblemType.text; else return ProblemType.dataset; } else { return _problem_type; } } }
public class class_name { public String encode(int hoursInDay) { int days = ((Double) ((double) durationInMinutes / hoursInDay / MINUTES_IN_ONE_HOUR)).intValue(); Long remainingDuration = durationInMinutes - (days * hoursInDay * MINUTES_IN_ONE_HOUR); int hours = ((Double) (remainingDuration.doubleValue() / MINUTES_IN_ONE_HOUR)).intValue(); remainingDuration = remainingDuration - (hours * MINUTES_IN_ONE_HOUR); int minutes = remainingDuration.intValue(); StringBuilder stringBuilder = new StringBuilder(); if (days > 0) { stringBuilder.append(days); stringBuilder.append(DAY); } if (hours > 0) { stringBuilder.append(hours); stringBuilder.append(HOUR); } if (minutes > 0) { stringBuilder.append(minutes); stringBuilder.append(MINUTE); } return stringBuilder.length() == 0 ? ("0" + MINUTE) : stringBuilder.toString(); } }
public class class_name { public String encode(int hoursInDay) { int days = ((Double) ((double) durationInMinutes / hoursInDay / MINUTES_IN_ONE_HOUR)).intValue(); Long remainingDuration = durationInMinutes - (days * hoursInDay * MINUTES_IN_ONE_HOUR); int hours = ((Double) (remainingDuration.doubleValue() / MINUTES_IN_ONE_HOUR)).intValue(); remainingDuration = remainingDuration - (hours * MINUTES_IN_ONE_HOUR); int minutes = remainingDuration.intValue(); StringBuilder stringBuilder = new StringBuilder(); if (days > 0) { stringBuilder.append(days); // depends on control dependency: [if], data = [(days] stringBuilder.append(DAY); // depends on control dependency: [if], data = [none] } if (hours > 0) { stringBuilder.append(hours); // depends on control dependency: [if], data = [(hours] stringBuilder.append(HOUR); // depends on control dependency: [if], data = [none] } if (minutes > 0) { stringBuilder.append(minutes); // depends on control dependency: [if], data = [(minutes] stringBuilder.append(MINUTE); // depends on control dependency: [if], data = [none] } return stringBuilder.length() == 0 ? ("0" + MINUTE) : stringBuilder.toString(); } }
public class class_name { static int getLocalNameIndex(String uri) { int separatorIdx = uri.indexOf(HASH); if (separatorIdx < 0) { separatorIdx = uri.lastIndexOf(SLASH); } if (separatorIdx < 0) { separatorIdx = uri.lastIndexOf(COLON); } if (separatorIdx < 0) { throw new IllegalArgumentException("No separator character founds in URI: " + uri); } return separatorIdx + 1; } }
public class class_name { static int getLocalNameIndex(String uri) { int separatorIdx = uri.indexOf(HASH); if (separatorIdx < 0) { separatorIdx = uri.lastIndexOf(SLASH); // depends on control dependency: [if], data = [none] } if (separatorIdx < 0) { separatorIdx = uri.lastIndexOf(COLON); // depends on control dependency: [if], data = [none] } if (separatorIdx < 0) { throw new IllegalArgumentException("No separator character founds in URI: " + uri); } return separatorIdx + 1; } }
public class class_name { public static void traceException(TraceComponent callersTrace, Throwable ex) { if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) { // Find XA completion code if one exists, as this isn't in a normal dump String xaErrStr = null; if (ex instanceof XAException) { XAException xaex = (XAException)ex; xaErrStr = "XAExceptionErrorCode: " + xaex.errorCode; } // Trace using the correct trace group if (light_tc.isDebugEnabled()) { if (xaErrStr != null) SibTr.debug(light_tc, xaErrStr); SibTr.exception(light_tc, ex); } else { if (xaErrStr != null) SibTr.debug(callersTrace, xaErrStr); SibTr.exception(callersTrace, ex); } } } }
public class class_name { public static void traceException(TraceComponent callersTrace, Throwable ex) { if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) { // Find XA completion code if one exists, as this isn't in a normal dump String xaErrStr = null; if (ex instanceof XAException) { XAException xaex = (XAException)ex; xaErrStr = "XAExceptionErrorCode: " + xaex.errorCode; // depends on control dependency: [if], data = [none] } // Trace using the correct trace group if (light_tc.isDebugEnabled()) { if (xaErrStr != null) SibTr.debug(light_tc, xaErrStr); SibTr.exception(light_tc, ex); // depends on control dependency: [if], data = [none] } else { if (xaErrStr != null) SibTr.debug(callersTrace, xaErrStr); SibTr.exception(callersTrace, ex); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private <T> HttpResponseHandler<T> getNonNullResponseHandler( HttpResponseHandler<T> responseHandler) { if (responseHandler != null) { return responseHandler; } else { // Return a Dummy, No-Op handler return new HttpResponseHandler<T>() { @Override public T handle(HttpResponse response) throws Exception { return null; } @Override public boolean needsConnectionLeftOpen() { return false; } }; } } }
public class class_name { private <T> HttpResponseHandler<T> getNonNullResponseHandler( HttpResponseHandler<T> responseHandler) { if (responseHandler != null) { return responseHandler; // depends on control dependency: [if], data = [none] } else { // Return a Dummy, No-Op handler return new HttpResponseHandler<T>() { @Override public T handle(HttpResponse response) throws Exception { return null; } // depends on control dependency: [if], data = [none] @Override public boolean needsConnectionLeftOpen() { return false; } }; } } }
public class class_name { public static void registerOperations(KnowledgeComponentImplementationModel model, Map<String, KnowledgeOperation> operations, KnowledgeOperation defaultOperation) { OperationsModel operationsModel = model.getOperations(); if (operationsModel != null) { for (OperationModel operationModel : operationsModel.getOperations()) { String name = Strings.trimToNull(operationModel.getName()); if (name == null) { name = DEFAULT; } KnowledgeOperationType type = operationModel.getType(); if (type == null) { type = defaultOperation.getType(); } String eventId = operationModel.getEventId(); if (eventId == null) { eventId = defaultOperation.getEventId(); } KnowledgeOperation operation = new KnowledgeOperation(type, eventId); mapExpressions(operationModel, operation); if (operations.containsKey(name)) { throw CommonKnowledgeMessages.MESSAGES.cannotRegisterOperation(type.toString(), name); } operations.put(name, operation); } } if (!operations.containsKey(DEFAULT)) { operations.put(DEFAULT, defaultOperation); } } }
public class class_name { public static void registerOperations(KnowledgeComponentImplementationModel model, Map<String, KnowledgeOperation> operations, KnowledgeOperation defaultOperation) { OperationsModel operationsModel = model.getOperations(); if (operationsModel != null) { for (OperationModel operationModel : operationsModel.getOperations()) { String name = Strings.trimToNull(operationModel.getName()); if (name == null) { name = DEFAULT; // depends on control dependency: [if], data = [none] } KnowledgeOperationType type = operationModel.getType(); if (type == null) { type = defaultOperation.getType(); // depends on control dependency: [if], data = [none] } String eventId = operationModel.getEventId(); if (eventId == null) { eventId = defaultOperation.getEventId(); // depends on control dependency: [if], data = [none] } KnowledgeOperation operation = new KnowledgeOperation(type, eventId); mapExpressions(operationModel, operation); // depends on control dependency: [for], data = [operationModel] if (operations.containsKey(name)) { throw CommonKnowledgeMessages.MESSAGES.cannotRegisterOperation(type.toString(), name); } operations.put(name, operation); // depends on control dependency: [for], data = [none] } } if (!operations.containsKey(DEFAULT)) { operations.put(DEFAULT, defaultOperation); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Class<?> getInjectionClassTypeWithException() throws InjectionException { Class<?> type = super.getInjectionClassType(); if (type == null && ivClassLoader != null) { String typeName = getInjectionClassTypeName(); if (typeName != null) { type = loadClass(typeName, !ivHomeInterface); setInjectionClassType(type); } } return type; } }
public class class_name { public Class<?> getInjectionClassTypeWithException() throws InjectionException { Class<?> type = super.getInjectionClassType(); if (type == null && ivClassLoader != null) { String typeName = getInjectionClassTypeName(); if (typeName != null) { type = loadClass(typeName, !ivHomeInterface); // depends on control dependency: [if], data = [(typeName] setInjectionClassType(type); // depends on control dependency: [if], data = [none] } } return type; } }
public class class_name { public static MessageSelectorBuilder fromKeyValueMap(Map<String, Object> valueMap) { StringBuffer buf = new StringBuffer(); Iterator<Entry<String, Object>> iter = valueMap.entrySet().iterator(); if (iter.hasNext()) { Entry<String, Object> entry = iter.next(); String key = entry.getKey(); String value = entry.getValue().toString(); buf.append(key + " = '" + value + "'"); } while (iter.hasNext()) { Entry<String, Object> entry = iter.next(); String key = entry.getKey(); String value = entry.getValue().toString(); buf.append(" AND " + key + " = '" + value + "'"); } return new MessageSelectorBuilder(buf.toString()); } }
public class class_name { public static MessageSelectorBuilder fromKeyValueMap(Map<String, Object> valueMap) { StringBuffer buf = new StringBuffer(); Iterator<Entry<String, Object>> iter = valueMap.entrySet().iterator(); if (iter.hasNext()) { Entry<String, Object> entry = iter.next(); String key = entry.getKey(); String value = entry.getValue().toString(); buf.append(key + " = '" + value + "'"); // depends on control dependency: [if], data = [none] } while (iter.hasNext()) { Entry<String, Object> entry = iter.next(); String key = entry.getKey(); String value = entry.getValue().toString(); buf.append(" AND " + key + " = '" + value + "'"); // depends on control dependency: [while], data = [none] } return new MessageSelectorBuilder(buf.toString()); } }
public class class_name { @Override public void sawOpcode(int seen) { if (!sawAload0) { if (seen == Const.ALOAD_0) { sawAload0 = true; } else { throw new StopOpcodeParsingException(); } } else if (nextParmIndex < parmTypes.length) { if (isExpectedParmInstruction(seen, nextParmOffset, parmTypes[nextParmIndex])) { nextParmOffset += SignatureUtils.getSignatureSize(parmTypes[nextParmIndex].getSignature()); nextParmIndex++; } else { throw new StopOpcodeParsingException(); } } else if (!sawParentCall) { if ((seen == Const.INVOKESPECIAL) && getNameConstantOperand().equals(getMethod().getName()) && getSigConstantOperand().equals(getMethod().getSignature())) { sawParentCall = true; } else { throw new StopOpcodeParsingException(); } } else { int expectedInstruction = getExpectedReturnInstruction(getMethod().getReturnType()); if ((seen == expectedInstruction) && (getNextPC() == getCode().getCode().length)) { bugReporter.reportBug( new BugInstance(this, BugType.COM_PARENT_DELEGATED_CALL.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this)); } else { throw new StopOpcodeParsingException(); } } } }
public class class_name { @Override public void sawOpcode(int seen) { if (!sawAload0) { if (seen == Const.ALOAD_0) { sawAload0 = true; // depends on control dependency: [if], data = [none] } else { throw new StopOpcodeParsingException(); } } else if (nextParmIndex < parmTypes.length) { if (isExpectedParmInstruction(seen, nextParmOffset, parmTypes[nextParmIndex])) { nextParmOffset += SignatureUtils.getSignatureSize(parmTypes[nextParmIndex].getSignature()); // depends on control dependency: [if], data = [none] nextParmIndex++; // depends on control dependency: [if], data = [none] } else { throw new StopOpcodeParsingException(); } } else if (!sawParentCall) { if ((seen == Const.INVOKESPECIAL) && getNameConstantOperand().equals(getMethod().getName()) && getSigConstantOperand().equals(getMethod().getSignature())) { sawParentCall = true; // depends on control dependency: [if], data = [none] } else { throw new StopOpcodeParsingException(); } } else { int expectedInstruction = getExpectedReturnInstruction(getMethod().getReturnType()); if ((seen == expectedInstruction) && (getNextPC() == getCode().getCode().length)) { bugReporter.reportBug( new BugInstance(this, BugType.COM_PARENT_DELEGATED_CALL.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this)); // depends on control dependency: [if], data = [none] } else { throw new StopOpcodeParsingException(); } } } }
public class class_name { static RowRanges union(RowRanges left, RowRanges right) { RowRanges result = new RowRanges(); Iterator<Range> it1 = left.ranges.iterator(); Iterator<Range> it2 = right.ranges.iterator(); if (it2.hasNext()) { Range range2 = it2.next(); while (it1.hasNext()) { Range range1 = it1.next(); if (range1.isAfter(range2)) { result.add(range2); range2 = range1; Iterator<Range> tmp = it1; it1 = it2; it2 = tmp; } else { result.add(range1); } } result.add(range2); } else { it2 = it1; } while (it2.hasNext()) { result.add(it2.next()); } return result; } }
public class class_name { static RowRanges union(RowRanges left, RowRanges right) { RowRanges result = new RowRanges(); Iterator<Range> it1 = left.ranges.iterator(); Iterator<Range> it2 = right.ranges.iterator(); if (it2.hasNext()) { Range range2 = it2.next(); while (it1.hasNext()) { Range range1 = it1.next(); if (range1.isAfter(range2)) { result.add(range2); // depends on control dependency: [if], data = [none] range2 = range1; // depends on control dependency: [if], data = [none] Iterator<Range> tmp = it1; it1 = it2; // depends on control dependency: [if], data = [none] it2 = tmp; // depends on control dependency: [if], data = [none] } else { result.add(range1); // depends on control dependency: [if], data = [none] } } result.add(range2); // depends on control dependency: [if], data = [none] } else { it2 = it1; // depends on control dependency: [if], data = [none] } while (it2.hasNext()) { result.add(it2.next()); // depends on control dependency: [while], data = [none] } return result; } }
public class class_name { @Override protected String doBuildColumnString(String dm) { StringBuilder sb = new StringBuilder(); sb.append(dm).append(elevateWordId); sb.append(dm).append(labelTypeId); if (sb.length() > dm.length()) { sb.delete(0, dm.length()); } sb.insert(0, "{").append("}"); return sb.toString(); } }
public class class_name { @Override protected String doBuildColumnString(String dm) { StringBuilder sb = new StringBuilder(); sb.append(dm).append(elevateWordId); sb.append(dm).append(labelTypeId); if (sb.length() > dm.length()) { sb.delete(0, dm.length()); // depends on control dependency: [if], data = [dm.length())] } sb.insert(0, "{").append("}"); return sb.toString(); } }
public class class_name { public static int hex2bin(char c) { if (c >= '0' && c <= '9') { return (c - '0'); } if (c >= 'A' && c <= 'F') { return (c - 'A' + 10); } if (c >= 'a' && c <= 'f') { return (c - 'a' + 10); } throw new IllegalArgumentException( "Input string may only contain hex digits, but found '" + c + "'"); } }
public class class_name { public static int hex2bin(char c) { if (c >= '0' && c <= '9') { return (c - '0'); // depends on control dependency: [if], data = [(c] } if (c >= 'A' && c <= 'F') { return (c - 'A' + 10); // depends on control dependency: [if], data = [(c] } if (c >= 'a' && c <= 'f') { return (c - 'a' + 10); // depends on control dependency: [if], data = [(c] } throw new IllegalArgumentException( "Input string may only contain hex digits, but found '" + c + "'"); } }
public class class_name { private static String _put(nitro_service service, String request) throws Exception { HttpURLConnection httpURLConnection; StringBuilder responseStr = new StringBuilder(); try { String urlstr; String ipaddress = service.get_ipaddress(); String version = service.get_version(); String protocol = service.get_protocol(); urlstr = protocol+"://" + ipaddress + "/nitro/" + version + "/config/"; URL url = new URL(urlstr); httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setRequestMethod("PUT"); if (httpURLConnection instanceof HttpsURLConnection) { if (service.get_certvalidation()) { SocketFactory sslSocketFactory = SSLSocketFactory.getDefault(); HttpsURLConnection secured = (HttpsURLConnection) httpURLConnection; secured.setSSLSocketFactory((SSLSocketFactory)sslSocketFactory); if (!service.get_hostnameverification()) { /* * override defualt hostNameverifier's verify method * with EmptyHostnameVerifier's verify method to ignore hostname verification check. */ secured.setHostnameVerifier(new EmptyHostnameVerifier()); } } else { SSLContext sslContext = SSLContext.getInstance("SSL"); //we are using an empty trust manager, because NetScaler currently presents //a test certificate not issued by any signing authority, so we need to bypass //the credentials check sslContext.init(null, new TrustManager[]{new EmptyTrustManager()}, null); SocketFactory sslSocketFactory = sslContext.getSocketFactory(); HttpsURLConnection secured = (HttpsURLConnection) httpURLConnection; secured.setSSLSocketFactory((SSLSocketFactory)sslSocketFactory); if (!service.get_hostnameverification()) { /* * overriding defualt hostNameverifier's verify method * with EmptyHostnameVerifier's verify method to bypass hostname check. */ secured.setHostnameVerifier(new EmptyHostnameVerifier()); } } } httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); httpURLConnection.setUseCaches(false); httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); httpURLConnection.setDoOutput(true); OutputStreamWriter ouput = new OutputStreamWriter(httpURLConnection.getOutputStream()); ouput.write(request); ouput.flush(); ouput.close(); InputStream input; try { input = httpURLConnection.getInputStream(); } catch (Exception e) { input = httpURLConnection.getErrorStream(); } String contentEncoding = httpURLConnection.getContentEncoding(); // get correct input stream for compressed data: if (contentEncoding != null) { if(contentEncoding.equalsIgnoreCase("gzip")) input = new GZIPInputStream(input); //reads 2 bytes to determine GZIP stream! else if(contentEncoding.equalsIgnoreCase("deflate")) input = new InflaterInputStream(input); } int numOfTotalBytesRead; byte [] buffer = new byte[1024]; while ((numOfTotalBytesRead = input.read(buffer, 0, buffer.length)) != -1) { responseStr.append(new String(buffer, 0, numOfTotalBytesRead)); } httpURLConnection.disconnect(); input.close(); } catch (MalformedURLException mue) { throw mue; } catch (IOException ioe) { throw ioe; } catch(Exception e) { throw e; } return responseStr.toString(); } }
public class class_name { private static String _put(nitro_service service, String request) throws Exception { HttpURLConnection httpURLConnection; StringBuilder responseStr = new StringBuilder(); try { String urlstr; String ipaddress = service.get_ipaddress(); String version = service.get_version(); String protocol = service.get_protocol(); urlstr = protocol+"://" + ipaddress + "/nitro/" + version + "/config/"; URL url = new URL(urlstr); httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setRequestMethod("PUT"); if (httpURLConnection instanceof HttpsURLConnection) { if (service.get_certvalidation()) { SocketFactory sslSocketFactory = SSLSocketFactory.getDefault(); HttpsURLConnection secured = (HttpsURLConnection) httpURLConnection; secured.setSSLSocketFactory((SSLSocketFactory)sslSocketFactory); // depends on control dependency: [if], data = [none] if (!service.get_hostnameverification()) { /* * override defualt hostNameverifier's verify method * with EmptyHostnameVerifier's verify method to ignore hostname verification check. */ secured.setHostnameVerifier(new EmptyHostnameVerifier()); // depends on control dependency: [if], data = [none] } } else { SSLContext sslContext = SSLContext.getInstance("SSL"); //we are using an empty trust manager, because NetScaler currently presents //a test certificate not issued by any signing authority, so we need to bypass //the credentials check sslContext.init(null, new TrustManager[]{new EmptyTrustManager()}, null); // depends on control dependency: [if], data = [none] SocketFactory sslSocketFactory = sslContext.getSocketFactory(); HttpsURLConnection secured = (HttpsURLConnection) httpURLConnection; secured.setSSLSocketFactory((SSLSocketFactory)sslSocketFactory); // depends on control dependency: [if], data = [none] if (!service.get_hostnameverification()) { /* * overriding defualt hostNameverifier's verify method * with EmptyHostnameVerifier's verify method to bypass hostname check. */ secured.setHostnameVerifier(new EmptyHostnameVerifier()); // depends on control dependency: [if], data = [none] } } } httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); httpURLConnection.setUseCaches(false); httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); httpURLConnection.setDoOutput(true); OutputStreamWriter ouput = new OutputStreamWriter(httpURLConnection.getOutputStream()); ouput.write(request); ouput.flush(); ouput.close(); InputStream input; try { input = httpURLConnection.getInputStream(); // depends on control dependency: [try], data = [none] } catch (Exception e) { input = httpURLConnection.getErrorStream(); } // depends on control dependency: [catch], data = [none] String contentEncoding = httpURLConnection.getContentEncoding(); // get correct input stream for compressed data: if (contentEncoding != null) { if(contentEncoding.equalsIgnoreCase("gzip")) input = new GZIPInputStream(input); //reads 2 bytes to determine GZIP stream! else if(contentEncoding.equalsIgnoreCase("deflate")) input = new InflaterInputStream(input); } int numOfTotalBytesRead; byte [] buffer = new byte[1024]; while ((numOfTotalBytesRead = input.read(buffer, 0, buffer.length)) != -1) { responseStr.append(new String(buffer, 0, numOfTotalBytesRead)); // depends on control dependency: [while], data = [none] } httpURLConnection.disconnect(); input.close(); } catch (MalformedURLException mue) { throw mue; } catch (IOException ioe) { throw ioe; } catch(Exception e) { throw e; } return responseStr.toString(); } }
public class class_name { public Object add(Object data, int iOpenMode) throws DBException, RemoteException { Object key = this.getKey(data); if (key == null) { // If autosequence, bump key try { key = m_mDataMap.lastKey(); } catch (NoSuchElementException ex) { key = new Integer(0); } if (key instanceof Integer) // Always key = new Integer(((Integer)key).intValue() + 1); ((Vector)data).set(0, key); } if (m_mDataMap.get(key) != null) throw new DBException("Duplicate record"); m_mDataMap.put(key, data); m_objCurrentKey = null; m_iterator = null; return key; } }
public class class_name { public Object add(Object data, int iOpenMode) throws DBException, RemoteException { Object key = this.getKey(data); if (key == null) { // If autosequence, bump key try { key = m_mDataMap.lastKey(); // depends on control dependency: [try], data = [none] } catch (NoSuchElementException ex) { key = new Integer(0); } // depends on control dependency: [catch], data = [none] if (key instanceof Integer) // Always key = new Integer(((Integer)key).intValue() + 1); ((Vector)data).set(0, key); } if (m_mDataMap.get(key) != null) throw new DBException("Duplicate record"); m_mDataMap.put(key, data); m_objCurrentKey = null; m_iterator = null; return key; } }
public class class_name { @Override public int compareTo(final MethodInfo other) { final int diff0 = declaringClassName.compareTo(other.declaringClassName); if (diff0 != 0) { return diff0; } final int diff1 = name.compareTo(other.name); if (diff1 != 0) { return diff1; } return typeDescriptorStr.compareTo(other.typeDescriptorStr); } }
public class class_name { @Override public int compareTo(final MethodInfo other) { final int diff0 = declaringClassName.compareTo(other.declaringClassName); if (diff0 != 0) { return diff0; // depends on control dependency: [if], data = [none] } final int diff1 = name.compareTo(other.name); if (diff1 != 0) { return diff1; // depends on control dependency: [if], data = [none] } return typeDescriptorStr.compareTo(other.typeDescriptorStr); } }
public class class_name { private void beginInternTransaction() { if (log.isDebugEnabled()) log.debug("beginInternTransaction was called"); J2EETransactionImpl tx = (J2EETransactionImpl) super.currentTransaction(); if (tx == null) tx = newInternTransaction(); if (!tx.isOpen()) { // start the transaction tx.begin(); tx.setInExternTransaction(true); } } }
public class class_name { private void beginInternTransaction() { if (log.isDebugEnabled()) log.debug("beginInternTransaction was called"); J2EETransactionImpl tx = (J2EETransactionImpl) super.currentTransaction(); if (tx == null) tx = newInternTransaction(); if (!tx.isOpen()) { // start the transaction tx.begin(); // depends on control dependency: [if], data = [none] tx.setInExternTransaction(true); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static final Object putIfMatch( final NonBlockingHashMap topmap, final Object[] kvs, final Object key, final Object putval, final Object expVal ) { assert putval != null; assert !(putval instanceof Prime); assert !(expVal instanceof Prime); final int fullhash = hash (key); // throws NullPointerException if key null final int len = len (kvs); // Count of key/value pairs, reads kvs.length final CHM chm = chm (kvs); // Reads kvs[0] final int[] hashes = hashes(kvs); // Reads kvs[1], read before kvs[0] int idx = fullhash & (len-1); // --- // Key-Claim stanza: spin till we can claim a Key (or force a resizing). int reprobe_cnt=0; Object K=null, V=null; Object[] newkvs=null; while( true ) { // Spin till we get a Key slot V = val(kvs,idx); // Get old value (before volatile read below!) K = key(kvs,idx); // Get current key if( K == null ) { // Slot is free? // Found an empty Key slot - which means this Key has never been in // this table. No need to put a Tombstone - the Key is not here! if( putval == TOMBSTONE ) return putval; // Not-now & never-been in this table // Claim the null key-slot if( CAS_key(kvs,idx, null, key ) ) { // Claim slot for Key chm._slots.add(1); // Raise key-slots-used count hashes[idx] = fullhash; // Memoize fullhash break; // Got it! } // CAS to claim the key-slot failed. // // This re-read of the Key points out an annoying short-coming of Java // CAS. Most hardware CAS's report back the existing value - so that // if you fail you have a *witness* - the value which caused the CAS // to fail. The Java API turns this into a boolean destroying the // witness. Re-reading does not recover the witness because another // thread can write over the memory after the CAS. Hence we can be in // the unfortunate situation of having a CAS fail *for cause* but // having that cause removed by a later store. This turns a // non-spurious-failure CAS (such as Azul has) into one that can // apparently spuriously fail - and we avoid apparent spurious failure // by not allowing Keys to ever change. K = key(kvs,idx); // CAS failed, get updated value assert K != null; // If keys[idx] is null, CAS shoulda worked } // Key slot was not null, there exists a Key here // We need a volatile-read here to preserve happens-before semantics on // newly inserted Keys. If the Key body was written just before inserting // into the table a Key-compare here might read the uninitalized Key body. // Annoyingly this means we have to volatile-read before EACH key compare. newkvs = chm._newkvs; // VOLATILE READ before key compare if( keyeq(K,key,hashes,idx,fullhash) ) break; // Got it! // get and put must have the same key lookup logic! Lest 'get' give // up looking too soon. //topmap._reprobes.add(1); if( ++reprobe_cnt >= reprobe_limit(len) || // too many probes or key == TOMBSTONE ) { // found a TOMBSTONE key, means no more keys // We simply must have a new table to do a 'put'. At this point a // 'get' will also go to the new table (if any). We do not need // to claim a key slot (indeed, we cannot find a free one to claim!). newkvs = chm.resize(topmap,kvs); if( expVal != null ) topmap.help_copy(newkvs); // help along an existing copy return putIfMatch(topmap,newkvs,key,putval,expVal); } idx = (idx+1)&(len-1); // Reprobe! } // End of spinning till we get a Key slot // --- // Found the proper Key slot, now update the matching Value slot. We // never put a null, so Value slots monotonically move from null to // not-null (deleted Values use Tombstone). Thus if 'V' is null we // fail this fast cutout and fall into the check for table-full. if( putval == V ) return V; // Fast cutout for no-change // See if we want to move to a new table (to avoid high average re-probe // counts). We only check on the initial set of a Value from null to // not-null (i.e., once per key-insert). Of course we got a 'free' check // of newkvs once per key-compare (not really free, but paid-for by the // time we get here). if( newkvs == null && // New table-copy already spotted? // Once per fresh key-insert check the hard way ((V == null && chm.tableFull(reprobe_cnt,len)) || // Or we found a Prime, but the JMM allowed reordering such that we // did not spot the new table (very rare race here: the writing // thread did a CAS of _newkvs then a store of a Prime. This thread // reads the Prime, then reads _newkvs - but the read of Prime was so // delayed (or the read of _newkvs was so accelerated) that they // swapped and we still read a null _newkvs. The resize call below // will do a CAS on _newkvs forcing the read. V instanceof Prime) ) newkvs = chm.resize(topmap,kvs); // Force the new table copy to start // See if we are moving to a new table. // If so, copy our slot and retry in the new table. if( newkvs != null ) return putIfMatch(topmap,chm.copy_slot_and_check(topmap,kvs,idx,expVal),key,putval,expVal); // --- // We are finally prepared to update the existing table assert !(V instanceof Prime); // Must match old, and we do not? Then bail out now. Note that either V // or expVal might be TOMBSTONE. Also V can be null, if we've never // inserted a value before. expVal can be null if we are called from // copy_slot. if( expVal != NO_MATCH_OLD && // Do we care about expected-Value at all? V != expVal && // No instant match already? (expVal != MATCH_ANY || V == TOMBSTONE || V == null) && !(V==null && expVal == TOMBSTONE) && // Match on null/TOMBSTONE combo (expVal == null || !expVal.equals(V)) ) // Expensive equals check at the last return V; // Do not update! // Actually change the Value in the Key,Value pair if( CAS_val(kvs, idx, V, putval ) ) { // CAS succeeded - we did the update! // Both normal put's and table-copy calls putIfMatch, but table-copy // does not (effectively) increase the number of live k/v pairs. if( expVal != null ) { // Adjust sizes - a striped counter if( (V == null || V == TOMBSTONE) && putval != TOMBSTONE ) chm._size.add( 1); if( !(V == null || V == TOMBSTONE) && putval == TOMBSTONE ) chm._size.add(-1); } } else { // Else CAS failed V = val(kvs,idx); // Get new value // If a Prime'd value got installed, we need to re-run the put on the // new table. Otherwise we lost the CAS to another racing put. // Simply retry from the start. if( V instanceof Prime ) return putIfMatch(topmap,chm.copy_slot_and_check(topmap,kvs,idx,expVal),key,putval,expVal); } // Win or lose the CAS, we are done. If we won then we know the update // happened as expected. If we lost, it means "we won but another thread // immediately stomped our update with no chance of a reader reading". return (V==null && expVal!=null) ? TOMBSTONE : V; } }
public class class_name { private static final Object putIfMatch( final NonBlockingHashMap topmap, final Object[] kvs, final Object key, final Object putval, final Object expVal ) { assert putval != null; assert !(putval instanceof Prime); assert !(expVal instanceof Prime); final int fullhash = hash (key); // throws NullPointerException if key null final int len = len (kvs); // Count of key/value pairs, reads kvs.length final CHM chm = chm (kvs); // Reads kvs[0] final int[] hashes = hashes(kvs); // Reads kvs[1], read before kvs[0] int idx = fullhash & (len-1); // --- // Key-Claim stanza: spin till we can claim a Key (or force a resizing). int reprobe_cnt=0; Object K=null, V=null; Object[] newkvs=null; while( true ) { // Spin till we get a Key slot V = val(kvs,idx); // Get old value (before volatile read below!) // depends on control dependency: [while], data = [none] K = key(kvs,idx); // Get current key // depends on control dependency: [while], data = [none] if( K == null ) { // Slot is free? // Found an empty Key slot - which means this Key has never been in // this table. No need to put a Tombstone - the Key is not here! if( putval == TOMBSTONE ) return putval; // Not-now & never-been in this table // Claim the null key-slot if( CAS_key(kvs,idx, null, key ) ) { // Claim slot for Key chm._slots.add(1); // Raise key-slots-used count // depends on control dependency: [if], data = [none] hashes[idx] = fullhash; // Memoize fullhash // depends on control dependency: [if], data = [none] break; // Got it! } // CAS to claim the key-slot failed. // // This re-read of the Key points out an annoying short-coming of Java // CAS. Most hardware CAS's report back the existing value - so that // if you fail you have a *witness* - the value which caused the CAS // to fail. The Java API turns this into a boolean destroying the // witness. Re-reading does not recover the witness because another // thread can write over the memory after the CAS. Hence we can be in // the unfortunate situation of having a CAS fail *for cause* but // having that cause removed by a later store. This turns a // non-spurious-failure CAS (such as Azul has) into one that can // apparently spuriously fail - and we avoid apparent spurious failure // by not allowing Keys to ever change. K = key(kvs,idx); // CAS failed, get updated value // depends on control dependency: [if], data = [none] assert K != null; // If keys[idx] is null, CAS shoulda worked } // Key slot was not null, there exists a Key here // We need a volatile-read here to preserve happens-before semantics on // newly inserted Keys. If the Key body was written just before inserting // into the table a Key-compare here might read the uninitalized Key body. // Annoyingly this means we have to volatile-read before EACH key compare. newkvs = chm._newkvs; // VOLATILE READ before key compare // depends on control dependency: [while], data = [none] if( keyeq(K,key,hashes,idx,fullhash) ) break; // Got it! // get and put must have the same key lookup logic! Lest 'get' give // up looking too soon. //topmap._reprobes.add(1); if( ++reprobe_cnt >= reprobe_limit(len) || // too many probes or key == TOMBSTONE ) { // found a TOMBSTONE key, means no more keys // We simply must have a new table to do a 'put'. At this point a // 'get' will also go to the new table (if any). We do not need // to claim a key slot (indeed, we cannot find a free one to claim!). newkvs = chm.resize(topmap,kvs); // depends on control dependency: [if], data = [none] if( expVal != null ) topmap.help_copy(newkvs); // help along an existing copy return putIfMatch(topmap,newkvs,key,putval,expVal); // depends on control dependency: [if], data = [none] } idx = (idx+1)&(len-1); // Reprobe! // depends on control dependency: [while], data = [none] } // End of spinning till we get a Key slot // --- // Found the proper Key slot, now update the matching Value slot. We // never put a null, so Value slots monotonically move from null to // not-null (deleted Values use Tombstone). Thus if 'V' is null we // fail this fast cutout and fall into the check for table-full. if( putval == V ) return V; // Fast cutout for no-change // See if we want to move to a new table (to avoid high average re-probe // counts). We only check on the initial set of a Value from null to // not-null (i.e., once per key-insert). Of course we got a 'free' check // of newkvs once per key-compare (not really free, but paid-for by the // time we get here). if( newkvs == null && // New table-copy already spotted? // Once per fresh key-insert check the hard way ((V == null && chm.tableFull(reprobe_cnt,len)) || // Or we found a Prime, but the JMM allowed reordering such that we // did not spot the new table (very rare race here: the writing // thread did a CAS of _newkvs then a store of a Prime. This thread // reads the Prime, then reads _newkvs - but the read of Prime was so // delayed (or the read of _newkvs was so accelerated) that they // swapped and we still read a null _newkvs. The resize call below // will do a CAS on _newkvs forcing the read. V instanceof Prime) ) newkvs = chm.resize(topmap,kvs); // Force the new table copy to start // See if we are moving to a new table. // If so, copy our slot and retry in the new table. if( newkvs != null ) return putIfMatch(topmap,chm.copy_slot_and_check(topmap,kvs,idx,expVal),key,putval,expVal); // --- // We are finally prepared to update the existing table assert !(V instanceof Prime); // Must match old, and we do not? Then bail out now. Note that either V // or expVal might be TOMBSTONE. Also V can be null, if we've never // inserted a value before. expVal can be null if we are called from // copy_slot. if( expVal != NO_MATCH_OLD && // Do we care about expected-Value at all? V != expVal && // No instant match already? (expVal != MATCH_ANY || V == TOMBSTONE || V == null) && !(V==null && expVal == TOMBSTONE) && // Match on null/TOMBSTONE combo (expVal == null || !expVal.equals(V)) ) // Expensive equals check at the last return V; // Do not update! // Actually change the Value in the Key,Value pair if( CAS_val(kvs, idx, V, putval ) ) { // CAS succeeded - we did the update! // Both normal put's and table-copy calls putIfMatch, but table-copy // does not (effectively) increase the number of live k/v pairs. if( expVal != null ) { // Adjust sizes - a striped counter if( (V == null || V == TOMBSTONE) && putval != TOMBSTONE ) chm._size.add( 1); if( !(V == null || V == TOMBSTONE) && putval == TOMBSTONE ) chm._size.add(-1); } } else { // Else CAS failed V = val(kvs,idx); // Get new value // depends on control dependency: [if], data = [none] // If a Prime'd value got installed, we need to re-run the put on the // new table. Otherwise we lost the CAS to another racing put. // Simply retry from the start. if( V instanceof Prime ) return putIfMatch(topmap,chm.copy_slot_and_check(topmap,kvs,idx,expVal),key,putval,expVal); } // Win or lose the CAS, we are done. If we won then we know the update // happened as expected. If we lost, it means "we won but another thread // immediately stomped our update with no chance of a reader reading". return (V==null && expVal!=null) ? TOMBSTONE : V; } }
public class class_name { static DeviceInfo initialize(Context context) { if (thisInstance_ == null) { thisInstance_ = new DeviceInfo(context); } return thisInstance_; } }
public class class_name { static DeviceInfo initialize(Context context) { if (thisInstance_ == null) { thisInstance_ = new DeviceInfo(context); // depends on control dependency: [if], data = [none] } return thisInstance_; } }
public class class_name { public static int xDigitToInt(int c, int accumulator) { check: { // Use 0..9 < A..Z < a..z if (c <= '9') { c -= '0'; if (0 <= c) { break check; } } else if (c <= 'F') { if ('A' <= c) { c -= ('A' - 10); break check; } } else if (c <= 'f') { if ('a' <= c) { c -= ('a' - 10); break check; } } return -1; } return (accumulator << 4) | c; } }
public class class_name { public static int xDigitToInt(int c, int accumulator) { check: { // Use 0..9 < A..Z < a..z if (c <= '9') { c -= '0'; // depends on control dependency: [if], data = [none] if (0 <= c) { break check; } } else if (c <= 'F') { if ('A' <= c) { c -= ('A' - 10); // depends on control dependency: [if], data = [('A'] break check; } } else if (c <= 'f') { if ('a' <= c) { c -= ('a' - 10); // depends on control dependency: [if], data = [('a'] break check; } } return -1; } return (accumulator << 4) | c; } }
public class class_name { public Status route(final CharSequence method, final CharSequence path, final Result<T> result) { result.captor.optionalTrailingSlash(optionalTrailingSlash); final RouteTarget<T> route = trie.lookup(path, result.captor); if (route == null) { return result.notFound().status(); } final Target<T> target = route.lookup(method); if (target == null) { return result.notAllowed(route).status(); } return result.success(path, route, target).status(); } }
public class class_name { public Status route(final CharSequence method, final CharSequence path, final Result<T> result) { result.captor.optionalTrailingSlash(optionalTrailingSlash); final RouteTarget<T> route = trie.lookup(path, result.captor); if (route == null) { return result.notFound().status(); // depends on control dependency: [if], data = [none] } final Target<T> target = route.lookup(method); if (target == null) { return result.notAllowed(route).status(); // depends on control dependency: [if], data = [none] } return result.success(path, route, target).status(); } }
public class class_name { @Override public DataSet vectorize(InputStream is, String label) { try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = ""; StringBuilder builder = new StringBuilder(); while ((line = reader.readLine()) != null) { builder.append(line); } return vectorize(builder.toString(), label); } catch (Exception e) { throw new RuntimeException(e); } } }
public class class_name { @Override public DataSet vectorize(InputStream is, String label) { try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = ""; StringBuilder builder = new StringBuilder(); while ((line = reader.readLine()) != null) { builder.append(line); // depends on control dependency: [while], data = [none] } return vectorize(builder.toString(), label); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { List<I_CmsSimpleContextMenuEntry<Set<String>>> getMenuEntries() { if (m_menuEntries == null) { m_menuEntries = new ArrayList<I_CmsSimpleContextMenuEntry<Set<String>>>(); m_menuEntries.add(new EntryResources()); m_menuEntries.add(new EntryDelete()); } return m_menuEntries; } }
public class class_name { List<I_CmsSimpleContextMenuEntry<Set<String>>> getMenuEntries() { if (m_menuEntries == null) { m_menuEntries = new ArrayList<I_CmsSimpleContextMenuEntry<Set<String>>>(); // depends on control dependency: [if], data = [none] m_menuEntries.add(new EntryResources()); // depends on control dependency: [if], data = [none] m_menuEntries.add(new EntryDelete()); // depends on control dependency: [if], data = [none] } return m_menuEntries; } }
public class class_name { public static Method[] getAllMethods(Class<?> intf) { // Changed from using a Vector and Hashtable to using an // ArrayList and HashMap to improve performance. d366807.3 Method[] allMethods = intf.getMethods(); ArrayList<Method> result = new ArrayList<Method>(allMethods.length); HashMap<String, Method> methodNameTable = new HashMap<String, Method>(); for (int i = 0; i < allMethods.length; i++) { Method m = allMethods[i]; //--------------------------- // Filter out static methods //--------------------------- if (Modifier.isStatic(m.getModifiers())) { continue; } String mKey = methodKey(m); String interfaceName = m.getDeclaringClass().getName(); if ((!(interfaceName.equals("javax.ejb.EJBObject") || // d135803 interfaceName.equals("javax.ejb.EJBLocalObject"))) // d135803 || m.getName().equals("remove")) { // d135803 Method synonym = methodNameTable.get(mKey); if (synonym == null) { methodNameTable.put(mKey, m); result.add(m); // d366807.3 } else { //--------------------------------------------- // Method declared on most specific class wins //--------------------------------------------- Class<?> mClass = m.getDeclaringClass(); Class<?> sClass = synonym.getDeclaringClass(); if (sClass.isAssignableFrom(mClass)) { methodNameTable.put(mKey, m); result.set(result.indexOf(synonym), m); // d366807.3 } } } } return sortMethods(result); } }
public class class_name { public static Method[] getAllMethods(Class<?> intf) { // Changed from using a Vector and Hashtable to using an // ArrayList and HashMap to improve performance. d366807.3 Method[] allMethods = intf.getMethods(); ArrayList<Method> result = new ArrayList<Method>(allMethods.length); HashMap<String, Method> methodNameTable = new HashMap<String, Method>(); for (int i = 0; i < allMethods.length; i++) { Method m = allMethods[i]; //--------------------------- // Filter out static methods //--------------------------- if (Modifier.isStatic(m.getModifiers())) { continue; } String mKey = methodKey(m); String interfaceName = m.getDeclaringClass().getName(); if ((!(interfaceName.equals("javax.ejb.EJBObject") || // d135803 interfaceName.equals("javax.ejb.EJBLocalObject"))) // d135803 || m.getName().equals("remove")) { // d135803 Method synonym = methodNameTable.get(mKey); if (synonym == null) { methodNameTable.put(mKey, m); // depends on control dependency: [if], data = [none] result.add(m); // d366807.3 // depends on control dependency: [if], data = [none] } else { //--------------------------------------------- // Method declared on most specific class wins //--------------------------------------------- Class<?> mClass = m.getDeclaringClass(); Class<?> sClass = synonym.getDeclaringClass(); if (sClass.isAssignableFrom(mClass)) { methodNameTable.put(mKey, m); // depends on control dependency: [if], data = [none] result.set(result.indexOf(synonym), m); // d366807.3 // depends on control dependency: [if], data = [none] } } } } return sortMethods(result); } }
public class class_name { public void close() { if (log.isDebugEnabled()) { log.debug("close"); } if (!subscriberStream.getState().equals(StreamState.CLOSED)) { IMessageInput in = msgInReference.get(); if (in != null) { in.unsubscribe(this); msgInReference.set(null); } subscriberStream.setState(StreamState.CLOSED); clearWaitJobs(); releasePendingMessage(); lastMessageTs = 0; // XXX is clear ping required? //sendClearPing(); InMemoryPushPushPipe out = (InMemoryPushPushPipe) msgOutReference.get(); if (out != null) { List<IConsumer> consumers = out.getConsumers(); // assume a list of 1 in most cases if (log.isDebugEnabled()) { log.debug("Message out consumers: {}", consumers.size()); } if (!consumers.isEmpty()) { for (IConsumer consumer : consumers) { out.unsubscribe(consumer); } } msgOutReference.set(null); } } else { log.debug("Stream is already in closed state"); } } }
public class class_name { public void close() { if (log.isDebugEnabled()) { log.debug("close"); // depends on control dependency: [if], data = [none] } if (!subscriberStream.getState().equals(StreamState.CLOSED)) { IMessageInput in = msgInReference.get(); if (in != null) { in.unsubscribe(this); // depends on control dependency: [if], data = [none] msgInReference.set(null); // depends on control dependency: [if], data = [null)] } subscriberStream.setState(StreamState.CLOSED); // depends on control dependency: [if], data = [none] clearWaitJobs(); // depends on control dependency: [if], data = [none] releasePendingMessage(); // depends on control dependency: [if], data = [none] lastMessageTs = 0; // depends on control dependency: [if], data = [none] // XXX is clear ping required? //sendClearPing(); InMemoryPushPushPipe out = (InMemoryPushPushPipe) msgOutReference.get(); if (out != null) { List<IConsumer> consumers = out.getConsumers(); // assume a list of 1 in most cases if (log.isDebugEnabled()) { log.debug("Message out consumers: {}", consumers.size()); // depends on control dependency: [if], data = [none] } if (!consumers.isEmpty()) { for (IConsumer consumer : consumers) { out.unsubscribe(consumer); // depends on control dependency: [for], data = [consumer] } } msgOutReference.set(null); // depends on control dependency: [if], data = [null)] } } else { log.debug("Stream is already in closed state"); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void setParameters(CmsObject cms, String resourcePath) { try { CmsProperty prop = cms.readPropertyObject(resourcePath, ARGS_PROPERTY_DEFINITION, false); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(prop.getValue())) { Map<String, String> argsMap = new HashMap<String, String>(); Iterator<String> itArgs = CmsStringUtil.splitAsList(prop.getValue(), ARGUMENT_SEPARATOR).iterator(); while (itArgs.hasNext()) { String arg = ""; try { arg = itArgs.next(); int pos = arg.indexOf(VALUE_SEPARATOR); argsMap.put(arg.substring(0, pos), arg.substring(pos + 1)); } catch (StringIndexOutOfBoundsException e) { LOG.error("sep: " + VALUE_SEPARATOR + "arg: " + arg); throw e; } } if (argsMap.get(ARG_PATH_NAME) != null) { setPath(argsMap.get(ARG_PATH_NAME)); } if (argsMap.get(ARG_CONFIRMATION_NAME) != null) { setConfirmationMessage(argsMap.get(ARG_CONFIRMATION_NAME)); } if (argsMap.get(ARG_PARAM_NAME) != null) { setParameterString(argsMap.get(ARG_PARAM_NAME)); } } } catch (CmsException e) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } } }
public class class_name { protected void setParameters(CmsObject cms, String resourcePath) { try { CmsProperty prop = cms.readPropertyObject(resourcePath, ARGS_PROPERTY_DEFINITION, false); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(prop.getValue())) { Map<String, String> argsMap = new HashMap<String, String>(); Iterator<String> itArgs = CmsStringUtil.splitAsList(prop.getValue(), ARGUMENT_SEPARATOR).iterator(); while (itArgs.hasNext()) { String arg = ""; try { arg = itArgs.next(); // depends on control dependency: [try], data = [none] int pos = arg.indexOf(VALUE_SEPARATOR); argsMap.put(arg.substring(0, pos), arg.substring(pos + 1)); // depends on control dependency: [try], data = [none] } catch (StringIndexOutOfBoundsException e) { LOG.error("sep: " + VALUE_SEPARATOR + "arg: " + arg); throw e; } // depends on control dependency: [catch], data = [none] } if (argsMap.get(ARG_PATH_NAME) != null) { setPath(argsMap.get(ARG_PATH_NAME)); // depends on control dependency: [if], data = [(argsMap.get(ARG_PATH_NAME)] } if (argsMap.get(ARG_CONFIRMATION_NAME) != null) { setConfirmationMessage(argsMap.get(ARG_CONFIRMATION_NAME)); // depends on control dependency: [if], data = [(argsMap.get(ARG_CONFIRMATION_NAME)] } if (argsMap.get(ARG_PARAM_NAME) != null) { setParameterString(argsMap.get(ARG_PARAM_NAME)); // depends on control dependency: [if], data = [(argsMap.get(ARG_PARAM_NAME)] } } } catch (CmsException e) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <T> Iterator<T> drop(final Iterator<T> iterator, final int count) { if (iterator == null) throw new NullPointerException("iterator"); if (count == 0) return iterator; if (count < 0) throw new IllegalArgumentException("Cannot drop a negative number of elements. Argument 'count' was: " + count); return new AbstractIterator<T>() { { int i = count; while (i > 0 && iterator.hasNext()) { iterator.next(); i--; } } @Override protected T computeNext() { if (!iterator.hasNext()) return endOfData(); return iterator.next(); } }; } }
public class class_name { public static <T> Iterator<T> drop(final Iterator<T> iterator, final int count) { if (iterator == null) throw new NullPointerException("iterator"); if (count == 0) return iterator; if (count < 0) throw new IllegalArgumentException("Cannot drop a negative number of elements. Argument 'count' was: " + count); return new AbstractIterator<T>() { { int i = count; while (i > 0 && iterator.hasNext()) { iterator.next(); // depends on control dependency: [while], data = [none] i--; // depends on control dependency: [while], data = [none] } } @Override protected T computeNext() { if (!iterator.hasNext()) return endOfData(); return iterator.next(); } }; } }
public class class_name { @Override public Set<CassandraHost> getKnownPoolHosts(boolean refresh) { if (refresh || knownPoolHosts == null) { knownPoolHosts = connectionManager.getHosts(); if ( log.isInfoEnabled() ) { log.info("found knownPoolHosts: {}", knownPoolHosts); } } return knownPoolHosts; } }
public class class_name { @Override public Set<CassandraHost> getKnownPoolHosts(boolean refresh) { if (refresh || knownPoolHosts == null) { knownPoolHosts = connectionManager.getHosts(); // depends on control dependency: [if], data = [none] if ( log.isInfoEnabled() ) { log.info("found knownPoolHosts: {}", knownPoolHosts); // depends on control dependency: [if], data = [none] } } return knownPoolHosts; } }
public class class_name { public void marshall(CSVMappingParameters cSVMappingParameters, ProtocolMarshaller protocolMarshaller) { if (cSVMappingParameters == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(cSVMappingParameters.getRecordRowDelimiter(), RECORDROWDELIMITER_BINDING); protocolMarshaller.marshall(cSVMappingParameters.getRecordColumnDelimiter(), RECORDCOLUMNDELIMITER_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CSVMappingParameters cSVMappingParameters, ProtocolMarshaller protocolMarshaller) { if (cSVMappingParameters == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(cSVMappingParameters.getRecordRowDelimiter(), RECORDROWDELIMITER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(cSVMappingParameters.getRecordColumnDelimiter(), RECORDCOLUMNDELIMITER_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 { @SuppressWarnings("unchecked") protected UrlMapping lookupMapping(String controller, String action, String namespace, String pluginName, String httpMethod, String version, Map params) { final UrlMappingsListKey lookupKey = new UrlMappingsListKey(controller, action, namespace, pluginName, httpMethod, version); Collection mappingKeysSet = mappingsListLookup.get(lookupKey); final String actionName = lookupKey.action; boolean secondAttempt = false; final boolean isIndexAction = GrailsControllerClass.INDEX_ACTION.equals(actionName); if (null == mappingKeysSet) { lookupKey.httpMethod=UrlMapping.ANY_HTTP_METHOD; mappingKeysSet = mappingsListLookup.get(lookupKey); } if (null == mappingKeysSet && actionName != null) { lookupKey.action=null; mappingKeysSet = mappingsListLookup.get(lookupKey); secondAttempt = true; } if (null == mappingKeysSet) return null; Set<String> lookupParams = new HashSet<String>(params.keySet()); if (secondAttempt) { lookupParams.removeAll(DEFAULT_ACTION_PARAMS); lookupParams.addAll(DEFAULT_ACTION_PARAMS); } UrlMappingKey[] mappingKeys = (UrlMappingKey[]) mappingKeysSet.toArray(new UrlMappingKey[mappingKeysSet.size()]); for (int i = mappingKeys.length; i > 0; i--) { UrlMappingKey mappingKey = mappingKeys[i - 1]; if (lookupParams.containsAll(mappingKey.paramNames)) { final UrlMapping mapping = mappingsLookup.get(mappingKey); if (canInferAction(actionName, secondAttempt, isIndexAction, mapping)) { return mapping; } if (!secondAttempt) { return mapping; } } } return null; } }
public class class_name { @SuppressWarnings("unchecked") protected UrlMapping lookupMapping(String controller, String action, String namespace, String pluginName, String httpMethod, String version, Map params) { final UrlMappingsListKey lookupKey = new UrlMappingsListKey(controller, action, namespace, pluginName, httpMethod, version); Collection mappingKeysSet = mappingsListLookup.get(lookupKey); final String actionName = lookupKey.action; boolean secondAttempt = false; final boolean isIndexAction = GrailsControllerClass.INDEX_ACTION.equals(actionName); if (null == mappingKeysSet) { lookupKey.httpMethod=UrlMapping.ANY_HTTP_METHOD; // depends on control dependency: [if], data = [none] mappingKeysSet = mappingsListLookup.get(lookupKey); // depends on control dependency: [if], data = [none] } if (null == mappingKeysSet && actionName != null) { lookupKey.action=null; // depends on control dependency: [if], data = [none] mappingKeysSet = mappingsListLookup.get(lookupKey); // depends on control dependency: [if], data = [none] secondAttempt = true; // depends on control dependency: [if], data = [none] } if (null == mappingKeysSet) return null; Set<String> lookupParams = new HashSet<String>(params.keySet()); if (secondAttempt) { lookupParams.removeAll(DEFAULT_ACTION_PARAMS); // depends on control dependency: [if], data = [none] lookupParams.addAll(DEFAULT_ACTION_PARAMS); // depends on control dependency: [if], data = [none] } UrlMappingKey[] mappingKeys = (UrlMappingKey[]) mappingKeysSet.toArray(new UrlMappingKey[mappingKeysSet.size()]); for (int i = mappingKeys.length; i > 0; i--) { UrlMappingKey mappingKey = mappingKeys[i - 1]; if (lookupParams.containsAll(mappingKey.paramNames)) { final UrlMapping mapping = mappingsLookup.get(mappingKey); if (canInferAction(actionName, secondAttempt, isIndexAction, mapping)) { return mapping; // depends on control dependency: [if], data = [none] } if (!secondAttempt) { return mapping; // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { @Override public void setAsynchConsumerCallback(int requestNumber, int maxActiveMessages, long messageLockExpiry, int batchsize, OrderingContext orderContext, boolean stoppable, int maxSequentialFailures, long hiddenMessageDelay) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setAsynchConsumerCallback", new Object[] { requestNumber, maxActiveMessages, messageLockExpiry, batchsize, orderContext, stoppable, maxSequentialFailures, hiddenMessageDelay }); try { // Here we need to examine the config parameter that will denote whether we are telling // MP to inline our async callbacks or not. We will default to false, but this can // be overrideen. boolean inlineCallbacks = CommsUtils.getRuntimeBooleanProperty(CommsConstants.INLINE_ASYNC_CBACKS_KEY, CommsConstants.INLINE_ASYNC_CBACKS); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Inline async callbacks: " + inlineCallbacks); MPConsumerSession session = (MPConsumerSession) getConsumerSession(); if (stoppable) { session.registerStoppableAsynchConsumerCallback(this, maxActiveMessages, messageLockExpiry, batchsize, getUnrecoverableReliability(), inlineCallbacks, orderContext, maxSequentialFailures, hiddenMessageDelay); } else { session.registerAsynchConsumerCallback(this, maxActiveMessages, messageLockExpiry, batchsize, getUnrecoverableReliability(), inlineCallbacks, orderContext); } try { getConversation().send(poolManager.allocate(), JFapChannelConstants.SEG_REGISTER_ASYNC_CONSUMER_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".setAsynchConsumerCallback", CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e); } // End d175222 } catch (SIException e) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event. if (!((ConversationState) getConversation().getAttachment()).hasMETerminated()) { FFDCFilter.processException(e, CLASS_NAME + ".setAsynchConsumerCallback", CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_02, this); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_02, getConversation(), requestNumber); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setAsynchConsumerCallback"); } }
public class class_name { @Override public void setAsynchConsumerCallback(int requestNumber, int maxActiveMessages, long messageLockExpiry, int batchsize, OrderingContext orderContext, boolean stoppable, int maxSequentialFailures, long hiddenMessageDelay) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setAsynchConsumerCallback", new Object[] { requestNumber, maxActiveMessages, messageLockExpiry, batchsize, orderContext, stoppable, maxSequentialFailures, hiddenMessageDelay }); try { // Here we need to examine the config parameter that will denote whether we are telling // MP to inline our async callbacks or not. We will default to false, but this can // be overrideen. boolean inlineCallbacks = CommsUtils.getRuntimeBooleanProperty(CommsConstants.INLINE_ASYNC_CBACKS_KEY, CommsConstants.INLINE_ASYNC_CBACKS); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Inline async callbacks: " + inlineCallbacks); MPConsumerSession session = (MPConsumerSession) getConsumerSession(); if (stoppable) { session.registerStoppableAsynchConsumerCallback(this, maxActiveMessages, messageLockExpiry, batchsize, getUnrecoverableReliability(), inlineCallbacks, orderContext, maxSequentialFailures, hiddenMessageDelay); // depends on control dependency: [if], data = [none] } else { session.registerAsynchConsumerCallback(this, maxActiveMessages, messageLockExpiry, batchsize, getUnrecoverableReliability(), inlineCallbacks, orderContext); // depends on control dependency: [if], data = [none] } try { getConversation().send(poolManager.allocate(), JFapChannelConstants.SEG_REGISTER_ASYNC_CONSUMER_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 + ".setAsynchConsumerCallback", CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2017", e); } // depends on control dependency: [catch], data = [none] // End d175222 } catch (SIException e) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event. if (!((ConversationState) getConversation().getAttachment()).hasMETerminated()) { FFDCFilter.processException(e, CLASS_NAME + ".setAsynchConsumerCallback", CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_02, this); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.CATASYNCHCONSUMER_SETCALLBACK_02, getConversation(), requestNumber); } // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setAsynchConsumerCallback"); } }
public class class_name { @Override public void visitIntInsn(int opcode, int operand) { if (opcode == Opcodes.NEWARRAY) { // instack: ... count // outstack: ... aref if (operand >= 4 && operand <= 11) { super.visitInsn(Opcodes.DUP); // -> stack: ... count count super.visitIntInsn(opcode, operand); // -> stack: ... count aref invokeRecordAllocation(primitiveTypeNames[operand]); // -> stack: ... aref } else { logger.severe( "NEWARRAY called with an invalid operand " + operand + ". Not instrumenting this allocation!"); super.visitIntInsn(opcode, operand); } } else { super.visitIntInsn(opcode, operand); } } }
public class class_name { @Override public void visitIntInsn(int opcode, int operand) { if (opcode == Opcodes.NEWARRAY) { // instack: ... count // outstack: ... aref if (operand >= 4 && operand <= 11) { super.visitInsn(Opcodes.DUP); // -> stack: ... count count // depends on control dependency: [if], data = [none] super.visitIntInsn(opcode, operand); // -> stack: ... count aref // depends on control dependency: [if], data = [none] invokeRecordAllocation(primitiveTypeNames[operand]); // depends on control dependency: [if], data = [none] // -> stack: ... aref } else { logger.severe( "NEWARRAY called with an invalid operand " + operand + ". Not instrumenting this allocation!"); // depends on control dependency: [if], data = [none] super.visitIntInsn(opcode, operand); // depends on control dependency: [if], data = [none] } } else { super.visitIntInsn(opcode, operand); // depends on control dependency: [if], data = [(opcode] } } }
public class class_name { public static <T> T loadModel(@NonNull Object lock, @NonNull Language language, @NonNull String configProperty, @NonNull String modelName, @NonNull Supplier<T> modelGetter, @NonNull Consumer<T> modelSetter) { if (modelGetter.get() == null) { synchronized (lock) { if (modelGetter.get() == null) { Exception thrownException = null; Resource modelFile = findModel(language, configProperty, modelName); if (modelFile == null) { thrownException = new RuntimeException(modelName + " does not exist"); } else { try { T model = modelFile.readObject(); modelSetter.accept(model); return model; } catch (Exception e) { thrownException = e; } } throw Throwables.propagate(thrownException); } } } return modelGetter.get(); } }
public class class_name { public static <T> T loadModel(@NonNull Object lock, @NonNull Language language, @NonNull String configProperty, @NonNull String modelName, @NonNull Supplier<T> modelGetter, @NonNull Consumer<T> modelSetter) { if (modelGetter.get() == null) { synchronized (lock) { // depends on control dependency: [if], data = [none] if (modelGetter.get() == null) { Exception thrownException = null; Resource modelFile = findModel(language, configProperty, modelName); if (modelFile == null) { thrownException = new RuntimeException(modelName + " does not exist"); // depends on control dependency: [if], data = [none] } else { try { T model = modelFile.readObject(); modelSetter.accept(model); // depends on control dependency: [try], data = [none] return model; // depends on control dependency: [try], data = [none] } catch (Exception e) { thrownException = e; } // depends on control dependency: [catch], data = [none] } throw Throwables.propagate(thrownException); } } } return modelGetter.get(); } }
public class class_name { public BidiRun getParagraphByIndex(int paraIndex) { verifyValidParaOrLine(); verifyRange(paraIndex, 0, paraCount); Bidi bidi = paraBidi; /* get Para object if Line object */ int paraStart; if (paraIndex == 0) { paraStart = 0; } else { paraStart = bidi.paras_limit[paraIndex - 1]; } BidiRun bidiRun = new BidiRun(); bidiRun.start = paraStart; bidiRun.limit = bidi.paras_limit[paraIndex]; bidiRun.level = GetParaLevelAt(paraStart); return bidiRun; } }
public class class_name { public BidiRun getParagraphByIndex(int paraIndex) { verifyValidParaOrLine(); verifyRange(paraIndex, 0, paraCount); Bidi bidi = paraBidi; /* get Para object if Line object */ int paraStart; if (paraIndex == 0) { paraStart = 0; // depends on control dependency: [if], data = [none] } else { paraStart = bidi.paras_limit[paraIndex - 1]; // depends on control dependency: [if], data = [none] } BidiRun bidiRun = new BidiRun(); bidiRun.start = paraStart; bidiRun.limit = bidi.paras_limit[paraIndex]; bidiRun.level = GetParaLevelAt(paraStart); return bidiRun; } }
public class class_name { public void updateInsideEntryTerminal(int spanStart, int spanEnd, int terminalSpanStart, int terminalSpanEnd, Factor factor) { Preconditions.checkArgument(factor.getVars().size() == 2); // The first entry initializes the chart at this span. if (sumProduct) { updateEntrySumProduct(insideChart[spanStart][spanEnd], factor.coerceToDiscrete().getWeights().getValues(), factor.coerceToDiscrete().getWeights(), parentVar.getOnlyVariableNum()); } else { Tensor weights = factor.coerceToDiscrete().getWeights(); // Negative split indexes are used to represent terminal rules. int splitInd = -1 * (terminalSpanStart * numTerminals + terminalSpanEnd + 1); updateInsideEntryMaxProduct(spanStart, spanEnd, weights.getValues(), weights, splitInd); } } }
public class class_name { public void updateInsideEntryTerminal(int spanStart, int spanEnd, int terminalSpanStart, int terminalSpanEnd, Factor factor) { Preconditions.checkArgument(factor.getVars().size() == 2); // The first entry initializes the chart at this span. if (sumProduct) { updateEntrySumProduct(insideChart[spanStart][spanEnd], factor.coerceToDiscrete().getWeights().getValues(), factor.coerceToDiscrete().getWeights(), parentVar.getOnlyVariableNum()); // depends on control dependency: [if], data = [none] } else { Tensor weights = factor.coerceToDiscrete().getWeights(); // Negative split indexes are used to represent terminal rules. int splitInd = -1 * (terminalSpanStart * numTerminals + terminalSpanEnd + 1); updateInsideEntryMaxProduct(spanStart, spanEnd, weights.getValues(), weights, splitInd); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void registerCloseables(final Collection<Closeable> registry, Closeable... closeables) { registry.addAll(Arrays.asList(closeables)); addListener(resource -> { for (Closeable closeable : closeables) { if (closeable == RedisChannelHandler.this) { continue; } try { if (closeable instanceof AsyncCloseable) { ((AsyncCloseable) closeable).closeAsync(); } else { closeable.close(); } } catch (IOException e) { if (debugEnabled) { logger.debug(e.toString(), e); } } } registry.removeAll(Arrays.asList(closeables)); }); } }
public class class_name { public void registerCloseables(final Collection<Closeable> registry, Closeable... closeables) { registry.addAll(Arrays.asList(closeables)); addListener(resource -> { for (Closeable closeable : closeables) { if (closeable == RedisChannelHandler.this) { continue; } try { if (closeable instanceof AsyncCloseable) { ((AsyncCloseable) closeable).closeAsync(); // depends on control dependency: [if], data = [none] } else { closeable.close(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { if (debugEnabled) { logger.debug(e.toString(), e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } registry.removeAll(Arrays.asList(closeables)); }); } }
public class class_name { static List<String> decodeAll(Collection<String> eventKeys) { List<String> eventIds = Lists.newArrayList(); for (String eventKey : eventKeys) { decodeTo(eventKey, eventIds); } return eventIds; } }
public class class_name { static List<String> decodeAll(Collection<String> eventKeys) { List<String> eventIds = Lists.newArrayList(); for (String eventKey : eventKeys) { decodeTo(eventKey, eventIds); // depends on control dependency: [for], data = [eventKey] } return eventIds; } }
public class class_name { @Override public void processEvent(SystemEvent event) throws AbortProcessingException { final UIViewRoot source = (UIViewRoot) event.getSource(); final FacesContext context = FacesContext.getCurrentInstance(); final WebXmlParameters webXmlParameters = new WebXmlParameters(context.getExternalContext()); final boolean provideJQuery = webXmlParameters.isProvideJQuery(); final boolean provideBootstrap = webXmlParameters.isProvideBoostrap(); final boolean useCompressedResources = webXmlParameters.isUseCompressedResources(); final boolean disablePrimeFacesJQuery = webXmlParameters.isIntegrationPrimeFacesDisableJQuery(); final List<UIComponent> resources = new ArrayList<>(source.getComponentResources(context, HEAD)); // Production mode and compressed if (useCompressedResources && context.getApplication().getProjectStage() == ProjectStage.Production) { handleCompressedResources(context, provideJQuery, provideBootstrap, resources, source); } else { handleConfigurableResources(context, provideJQuery, provideBootstrap, resources, source); } if (disablePrimeFacesJQuery) { for (UIComponent resource : resources) { final String resourceLibrary = (String) resource.getAttributes().get("library"); final String resourceName = (String) resource.getAttributes().get("name"); if ("primefaces".equals(resourceLibrary) && "jquery/jquery.js".equals(resourceName)) { source.removeComponentResource(context, resource); } } } } }
public class class_name { @Override public void processEvent(SystemEvent event) throws AbortProcessingException { final UIViewRoot source = (UIViewRoot) event.getSource(); final FacesContext context = FacesContext.getCurrentInstance(); final WebXmlParameters webXmlParameters = new WebXmlParameters(context.getExternalContext()); final boolean provideJQuery = webXmlParameters.isProvideJQuery(); final boolean provideBootstrap = webXmlParameters.isProvideBoostrap(); final boolean useCompressedResources = webXmlParameters.isUseCompressedResources(); final boolean disablePrimeFacesJQuery = webXmlParameters.isIntegrationPrimeFacesDisableJQuery(); final List<UIComponent> resources = new ArrayList<>(source.getComponentResources(context, HEAD)); // Production mode and compressed if (useCompressedResources && context.getApplication().getProjectStage() == ProjectStage.Production) { handleCompressedResources(context, provideJQuery, provideBootstrap, resources, source); } else { handleConfigurableResources(context, provideJQuery, provideBootstrap, resources, source); } if (disablePrimeFacesJQuery) { for (UIComponent resource : resources) { final String resourceLibrary = (String) resource.getAttributes().get("library"); final String resourceName = (String) resource.getAttributes().get("name"); if ("primefaces".equals(resourceLibrary) && "jquery/jquery.js".equals(resourceName)) { source.removeComponentResource(context, resource); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static BoundingBox getProjectedBoundingBox(Projection projection, TileGrid tileGrid, int zoom) { BoundingBox boundingBox = getWebMercatorBoundingBox(tileGrid, zoom); if (projection != null) { ProjectionTransform transform = webMercator .getTransformation(projection); boundingBox = boundingBox.transform(transform); } return boundingBox; } }
public class class_name { public static BoundingBox getProjectedBoundingBox(Projection projection, TileGrid tileGrid, int zoom) { BoundingBox boundingBox = getWebMercatorBoundingBox(tileGrid, zoom); if (projection != null) { ProjectionTransform transform = webMercator .getTransformation(projection); boundingBox = boundingBox.transform(transform); // depends on control dependency: [if], data = [none] } return boundingBox; } }
public class class_name { private void minimize() { // Algorithm: compare each entry n to all subsequent entries in // the list: if any subsequent entry matches or widens entry n, // remove entry n. If any subsequent entries narrow entry n, remove // the subsequent entries. for (int i = 0; i < size(); i++) { GeneralNameInterface current = getGeneralNameInterface(i); boolean remove1 = false; /* compare current to subsequent elements */ for (int j = i + 1; j < size(); j++) { GeneralNameInterface subsequent = getGeneralNameInterface(j); switch (current.constrains(subsequent)) { case GeneralNameInterface.NAME_DIFF_TYPE: /* not comparable; different name types; keep checking */ continue; case GeneralNameInterface.NAME_MATCH: /* delete one of the duplicates */ remove1 = true; break; case GeneralNameInterface.NAME_NARROWS: /* subsequent narrows current */ /* remove narrower name (subsequent) */ remove(j); j--; /* continue check with new subsequent */ continue; case GeneralNameInterface.NAME_WIDENS: /* subsequent widens current */ /* remove narrower name current */ remove1 = true; break; case GeneralNameInterface.NAME_SAME_TYPE: /* keep both for now; keep checking */ continue; } break; } /* end of this pass of subsequent elements */ if (remove1) { remove(i); i--; /* check the new i value */ } } } }
public class class_name { private void minimize() { // Algorithm: compare each entry n to all subsequent entries in // the list: if any subsequent entry matches or widens entry n, // remove entry n. If any subsequent entries narrow entry n, remove // the subsequent entries. for (int i = 0; i < size(); i++) { GeneralNameInterface current = getGeneralNameInterface(i); boolean remove1 = false; /* compare current to subsequent elements */ for (int j = i + 1; j < size(); j++) { GeneralNameInterface subsequent = getGeneralNameInterface(j); switch (current.constrains(subsequent)) { case GeneralNameInterface.NAME_DIFF_TYPE: /* not comparable; different name types; keep checking */ continue; case GeneralNameInterface.NAME_MATCH: /* delete one of the duplicates */ remove1 = true; break; case GeneralNameInterface.NAME_NARROWS: /* subsequent narrows current */ /* remove narrower name (subsequent) */ remove(j); // depends on control dependency: [for], data = [j] j--; /* continue check with new subsequent */ // depends on control dependency: [for], data = [j] continue; case GeneralNameInterface.NAME_WIDENS: /* subsequent widens current */ /* remove narrower name current */ remove1 = true; break; case GeneralNameInterface.NAME_SAME_TYPE: /* keep both for now; keep checking */ continue; } break; } /* end of this pass of subsequent elements */ if (remove1) { remove(i); // depends on control dependency: [if], data = [none] i--; /* check the new i value */ // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected void initializeComponents(Collection<String> modules) { Iterator<CmsSetupComponent> itGroups = new ArrayList<CmsSetupComponent>( CmsCollectionsGenericWrapper.<CmsSetupComponent> list(m_components.elementList())).iterator(); while (itGroups.hasNext()) { CmsSetupComponent component = itGroups.next(); String errMsg = ""; String warnMsg = ""; // check name if (CmsStringUtil.isEmptyOrWhitespaceOnly(component.getName())) { errMsg += Messages.get().container(Messages.ERR_COMPONENT_NAME_EMPTY_1, component.getId()).key(); errMsg += "\n"; } // check description if (CmsStringUtil.isEmptyOrWhitespaceOnly(component.getName())) { warnMsg += Messages.get().container(Messages.LOG_WARN_COMPONENT_DESC_EMPTY_1, component.getId()).key(); warnMsg += "\n"; } // check position if (component.getPosition() == DEFAULT_POSITION) { warnMsg += Messages.get().container(Messages.LOG_WARN_COMPONENT_POS_EMPTY_1, component.getId()).key(); warnMsg += "\n"; } // check dependencies Iterator<String> itDeps = component.getDependencies().iterator(); while (itDeps.hasNext()) { String dependency = itDeps.next(); if (m_components.getObject(dependency) == null) { errMsg += Messages.get().container( Messages.LOG_WARN_COMPONENT_DEPENDENCY_BROKEN_2, component.getId(), dependency).key(); errMsg += "\n"; } } // check modules match boolean match = false; Iterator<String> itModules = modules.iterator(); while (itModules.hasNext()) { String module = itModules.next(); if (component.match(module)) { match = true; itModules.remove(); } } if (!match) { errMsg += Messages.get().container(Messages.ERR_COMPONENT_MODULES_EMPTY_1, component.getId()).key(); errMsg += "\n"; } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(errMsg)) { m_components.removeObject(component.getId()); if (LOG.isErrorEnabled()) { LOG.error(errMsg); } } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(warnMsg)) { if (LOG.isWarnEnabled()) { LOG.warn(warnMsg); } } } if (!modules.isEmpty()) { if (LOG.isWarnEnabled()) { LOG.warn(Messages.get().container(Messages.LOG_WARN_MODULES_LEFT_1, modules.toString())); } } } }
public class class_name { protected void initializeComponents(Collection<String> modules) { Iterator<CmsSetupComponent> itGroups = new ArrayList<CmsSetupComponent>( CmsCollectionsGenericWrapper.<CmsSetupComponent> list(m_components.elementList())).iterator(); while (itGroups.hasNext()) { CmsSetupComponent component = itGroups.next(); String errMsg = ""; String warnMsg = ""; // check name if (CmsStringUtil.isEmptyOrWhitespaceOnly(component.getName())) { errMsg += Messages.get().container(Messages.ERR_COMPONENT_NAME_EMPTY_1, component.getId()).key(); // depends on control dependency: [if], data = [none] errMsg += "\n"; // depends on control dependency: [if], data = [none] } // check description if (CmsStringUtil.isEmptyOrWhitespaceOnly(component.getName())) { warnMsg += Messages.get().container(Messages.LOG_WARN_COMPONENT_DESC_EMPTY_1, component.getId()).key(); // depends on control dependency: [if], data = [none] warnMsg += "\n"; // depends on control dependency: [if], data = [none] } // check position if (component.getPosition() == DEFAULT_POSITION) { warnMsg += Messages.get().container(Messages.LOG_WARN_COMPONENT_POS_EMPTY_1, component.getId()).key(); // depends on control dependency: [if], data = [none] warnMsg += "\n"; // depends on control dependency: [if], data = [none] } // check dependencies Iterator<String> itDeps = component.getDependencies().iterator(); while (itDeps.hasNext()) { String dependency = itDeps.next(); if (m_components.getObject(dependency) == null) { errMsg += Messages.get().container( Messages.LOG_WARN_COMPONENT_DEPENDENCY_BROKEN_2, component.getId(), dependency).key(); // depends on control dependency: [if], data = [none] errMsg += "\n"; // depends on control dependency: [if], data = [none] } } // check modules match boolean match = false; Iterator<String> itModules = modules.iterator(); while (itModules.hasNext()) { String module = itModules.next(); if (component.match(module)) { match = true; // depends on control dependency: [if], data = [none] itModules.remove(); // depends on control dependency: [if], data = [none] } } if (!match) { errMsg += Messages.get().container(Messages.ERR_COMPONENT_MODULES_EMPTY_1, component.getId()).key(); // depends on control dependency: [if], data = [none] errMsg += "\n"; // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(errMsg)) { m_components.removeObject(component.getId()); // depends on control dependency: [if], data = [none] if (LOG.isErrorEnabled()) { LOG.error(errMsg); // depends on control dependency: [if], data = [none] } } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(warnMsg)) { if (LOG.isWarnEnabled()) { LOG.warn(warnMsg); // depends on control dependency: [if], data = [none] } } } if (!modules.isEmpty()) { if (LOG.isWarnEnabled()) { LOG.warn(Messages.get().container(Messages.LOG_WARN_MODULES_LEFT_1, modules.toString())); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static double norm_1(double[] a) { double sum = 0; for (double anA : a) { sum += (anA < 0 ? -anA : anA); } return sum; } }
public class class_name { public static double norm_1(double[] a) { double sum = 0; for (double anA : a) { sum += (anA < 0 ? -anA : anA); // depends on control dependency: [for], data = [anA] } return sum; } }
public class class_name { public void cancelDownload(final boolean hideWindowImmediately) { logger.info("Cancel of download requested"); _cancelled = true; if (hideWindowImmediately && _downloadProgressWindow != null) { WidgetUtils.invokeSwingAction(_downloadProgressWindow::close); } } }
public class class_name { public void cancelDownload(final boolean hideWindowImmediately) { logger.info("Cancel of download requested"); _cancelled = true; if (hideWindowImmediately && _downloadProgressWindow != null) { WidgetUtils.invokeSwingAction(_downloadProgressWindow::close); // depends on control dependency: [if], data = [none] } } }
public class class_name { @InterfaceAudience.Public public Document getDocument() { if (getDocumentId() == null) { return null; } assert (database != null); Document document = database.getDocument(getDocumentId()); document.loadCurrentRevisionFrom(this); return document; } }
public class class_name { @InterfaceAudience.Public public Document getDocument() { if (getDocumentId() == null) { return null; // depends on control dependency: [if], data = [none] } assert (database != null); Document document = database.getDocument(getDocumentId()); document.loadCurrentRevisionFrom(this); return document; } }
public class class_name { public List<TldExtensionType<FunctionType<T>>> getAllFunctionExtension() { List<TldExtensionType<FunctionType<T>>> list = new ArrayList<TldExtensionType<FunctionType<T>>>(); List<Node> nodeList = childNode.get("function-extension"); for(Node node: nodeList) { TldExtensionType<FunctionType<T>> type = new TldExtensionTypeImpl<FunctionType<T>>(this, "function-extension", childNode, node); list.add(type); } return list; } }
public class class_name { public List<TldExtensionType<FunctionType<T>>> getAllFunctionExtension() { List<TldExtensionType<FunctionType<T>>> list = new ArrayList<TldExtensionType<FunctionType<T>>>(); List<Node> nodeList = childNode.get("function-extension"); for(Node node: nodeList) { TldExtensionType<FunctionType<T>> type = new TldExtensionTypeImpl<FunctionType<T>>(this, "function-extension", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { public boolean syncMonitors(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the Synthetics configuration using the REST API if(cache.isSyntheticsEnabled()) { ret = false; logger.info("Getting the monitors"); cache.monitors().add(syntheticsApiClient.monitors().list()); cache.setUpdatedAt(); ret = true; } return ret; } }
public class class_name { public boolean syncMonitors(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the Synthetics configuration using the REST API if(cache.isSyntheticsEnabled()) { ret = false; // depends on control dependency: [if], data = [none] logger.info("Getting the monitors"); // depends on control dependency: [if], data = [none] cache.monitors().add(syntheticsApiClient.monitors().list()); // depends on control dependency: [if], data = [none] cache.setUpdatedAt(); // depends on control dependency: [if], data = [none] ret = true; // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { @Override public void visit(NodeTraversal traversal, Node node, Node parent) { if (node.isCall()) { Node name = node.getFirstChild(); Node argument = name.getNext(); if (argument == null) { return; } // Detect calls to an aliased goog.string.Const. if (name.isName() && !name.matchesQualifiedName(CONST_FUNCTION_NAME_COLLAPSED)) { Scope scope = traversal.getScope(); Var var = scope.getVar(name.getString()); if (var == null) { return; } name = var.getInitialValue(); if (name == null) { return; } } if (name.matchesQualifiedName(CONST_FUNCTION_NAME) || name.matchesQualifiedName(CONST_FUNCTION_NAME_COLLAPSED)) { if (!isSafeValue(traversal.getScope(), argument)) { compiler.report(JSError.make(argument, CONST_NOT_STRING_LITERAL_ERROR)); } } } } }
public class class_name { @Override public void visit(NodeTraversal traversal, Node node, Node parent) { if (node.isCall()) { Node name = node.getFirstChild(); Node argument = name.getNext(); if (argument == null) { return; // depends on control dependency: [if], data = [none] } // Detect calls to an aliased goog.string.Const. if (name.isName() && !name.matchesQualifiedName(CONST_FUNCTION_NAME_COLLAPSED)) { Scope scope = traversal.getScope(); Var var = scope.getVar(name.getString()); if (var == null) { return; // depends on control dependency: [if], data = [none] } name = var.getInitialValue(); // depends on control dependency: [if], data = [none] if (name == null) { return; // depends on control dependency: [if], data = [none] } } if (name.matchesQualifiedName(CONST_FUNCTION_NAME) || name.matchesQualifiedName(CONST_FUNCTION_NAME_COLLAPSED)) { if (!isSafeValue(traversal.getScope(), argument)) { compiler.report(JSError.make(argument, CONST_NOT_STRING_LITERAL_ERROR)); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static String decryptToAes(String content, String pwd) { if (StringUtil.isEmpty(content) || StringUtil.isEmpty(pwd)) { return null; } try { SecretKeySpec key = new SecretKeySpec(getKey(pwd).getEncoded(), AES); Cipher cipher = Cipher.getInstance(AES); cipher.init(Cipher.DECRYPT_MODE, key); byte[] result = cipher.doFinal(hexToByte(content)); return new String(result); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) { LOG.error(e); } return null; } }
public class class_name { public static String decryptToAes(String content, String pwd) { if (StringUtil.isEmpty(content) || StringUtil.isEmpty(pwd)) { return null; // depends on control dependency: [if], data = [none] } try { SecretKeySpec key = new SecretKeySpec(getKey(pwd).getEncoded(), AES); Cipher cipher = Cipher.getInstance(AES); cipher.init(Cipher.DECRYPT_MODE, key); // depends on control dependency: [try], data = [none] byte[] result = cipher.doFinal(hexToByte(content)); return new String(result); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) { LOG.error(e); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { protected int _findPOJOSerializationType(Class<?> raw) { int type = _findSimpleType(raw, true); if (type == SER_UNKNOWN) { if (JSON.Feature.HANDLE_JAVA_BEANS.isEnabled(_features)) { POJODefinition cd = _resolveBeanDef(raw); BeanPropertyWriter[] props = resolveBeanForSer(raw, cd); // Due to concurrent access, possible that someone might have added it synchronized (_knownWriters) { // Important: do NOT try to reuse shared instance; caller needs it ClassKey k = new ClassKey(raw, _features); Integer I = _knownSerTypes.get(k); // if it was already concurrently added, we'll just discard this copy, return earlier if (I != null) { return I.intValue(); } // otherwise add at the end, use -(index+1) as id _knownWriters.add(props); int typeId = -_knownWriters.size(); _knownSerTypes.put(k, Integer.valueOf(typeId)); return typeId; } } } return type; } }
public class class_name { protected int _findPOJOSerializationType(Class<?> raw) { int type = _findSimpleType(raw, true); if (type == SER_UNKNOWN) { if (JSON.Feature.HANDLE_JAVA_BEANS.isEnabled(_features)) { POJODefinition cd = _resolveBeanDef(raw); BeanPropertyWriter[] props = resolveBeanForSer(raw, cd); // Due to concurrent access, possible that someone might have added it synchronized (_knownWriters) { // depends on control dependency: [if], data = [none] // Important: do NOT try to reuse shared instance; caller needs it ClassKey k = new ClassKey(raw, _features); Integer I = _knownSerTypes.get(k); // if it was already concurrently added, we'll just discard this copy, return earlier if (I != null) { return I.intValue(); // depends on control dependency: [if], data = [none] } // otherwise add at the end, use -(index+1) as id _knownWriters.add(props); int typeId = -_knownWriters.size(); _knownSerTypes.put(k, Integer.valueOf(typeId)); return typeId; } } } return type; } }
public class class_name { private static boolean isControlDependentChild(Node child) { Node parent = child.getParent(); if (parent == null) { return false; } ArrayList<Node> siblings = new ArrayList<>(); Iterables.addAll(siblings, parent.children()); int indexOfChildInParent = siblings.indexOf(child); switch (parent.getToken()) { case IF: case HOOK: return (indexOfChildInParent == 1 || indexOfChildInParent == 2); case FOR: case FOR_IN: // Only initializer is not control dependent return indexOfChildInParent != 0; case SWITCH: return indexOfChildInParent > 0; case WHILE: case DO: case AND: case OR: case FUNCTION: return true; default: return false; } } }
public class class_name { private static boolean isControlDependentChild(Node child) { Node parent = child.getParent(); if (parent == null) { return false; // depends on control dependency: [if], data = [none] } ArrayList<Node> siblings = new ArrayList<>(); Iterables.addAll(siblings, parent.children()); int indexOfChildInParent = siblings.indexOf(child); switch (parent.getToken()) { case IF: case HOOK: return (indexOfChildInParent == 1 || indexOfChildInParent == 2); case FOR: case FOR_IN: // Only initializer is not control dependent return indexOfChildInParent != 0; case SWITCH: return indexOfChildInParent > 0; case WHILE: case DO: case AND: case OR: case FUNCTION: return true; default: return false; } } }