java.util.Enumeration

Here are the examples of the java api class java.util.Enumeration taken from open source projects.

1. DTDBuilder#buildNamesTable()

Project: jdk7u-jdk
Source File: DTDBuilder.java
View license
private void buildNamesTable() {
    for (Enumeration e = entityHash.elements(); e.hasMoreElements(); ) {
        Entity ent = (Entity) e.nextElement();
        // Do even if not isGeneral().  That way, exclusions and inclusions
        // will definitely have their element.
        getNameId(ent.getName());
    }
    for (Enumeration e = elements.elements(); e.hasMoreElements(); ) {
        Element el = (Element) e.nextElement();
        getNameId(el.getName());
        for (AttributeList atts = el.getAttributes(); atts != null; atts = atts.getNext()) {
            getNameId(atts.getName());
            if (atts.getValue() != null) {
                getNameId(atts.getValue());
            }
            Enumeration vals = atts.getValues();
            while (vals != null && vals.hasMoreElements()) {
                String s = (String) vals.nextElement();
                getNameId(s);
            }
        }
    }
}

2. JSFHelper#printRequest()

Project: myWMS
Source File: JSFHelper.java
View license
@SuppressWarnings("rawtypes")
public void printRequest() {
    HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
    Enumeration e = request.getParameterNames();
    while (e.hasMoreElements()) {
        System.out.println("Parameter = " + e.nextElement());
    }
    Enumeration ea = request.getAttributeNames();
    while (ea.hasMoreElements()) {
        System.out.println("Attribute = " + ea.nextElement());
    }
    System.out.println("Requested URI = " + request.getRequestURI());
    System.out.println("Requested URL = " + request.getRequestURL());
    System.out.println("QueryString = " + request.getQueryString());
}

3. AttributeGen#unique()

Project: openjdk
Source File: AttributeGen.java
View license
// ctor
/**
   *
   **/
private boolean unique(InterfaceEntry entry, String name) {
    // Compare the name to the methods of this interface
    Enumeration methods = entry.methods().elements();
    while (methods.hasMoreElements()) {
        SymtabEntry method = (SymtabEntry) methods.nextElement();
        if (name.equals(method.name()))
            return false;
    }
    // Recursively call unique on each derivedFrom interface
    Enumeration derivedFrom = entry.derivedFrom().elements();
    while (derivedFrom.hasMoreElements()) if (!unique((InterfaceEntry) derivedFrom.nextElement(), name))
        return false;
    // derivedFrom interfaces, then the name is unique.
    return true;
}

4. Skeleton#buildMethodList()

Project: openjdk
Source File: Skeleton.java
View license
// buildMethodList
/**
   *
   **/
private void buildMethodList(InterfaceEntry entry) {
    // Add the local methods
    Enumeration locals = entry.methods().elements();
    while (locals.hasMoreElements()) addMethod((MethodEntry) locals.nextElement());
    // Add the inherited methods
    Enumeration parents = entry.derivedFrom().elements();
    while (parents.hasMoreElements()) {
        InterfaceEntry parent = (InterfaceEntry) parents.nextElement();
        if (!parent.name().equals("Object"))
            buildMethodList(parent);
    }
}

5. Stub#buildMethodList()

Project: openjdk
Source File: Stub.java
View license
// buildMethodList
/**
   *
   **/
private void buildMethodList(InterfaceEntry entry) {
    // Add the local methods
    Enumeration locals = entry.methods().elements();
    while (locals.hasMoreElements()) addMethod((MethodEntry) locals.nextElement());
    // Add the inherited methods
    Enumeration parents = entry.derivedFrom().elements();
    while (parents.hasMoreElements()) {
        InterfaceEntry parent = (InterfaceEntry) parents.nextElement();
        if (!parent.name().equals("Object"))
            buildMethodList(parent);
    }
}

6. NanoHTTPD#serve()

Project: selendroid
Source File: NanoHTTPD.java
View license
// ==================================================
// API parts
// ==================================================
/**
	 * Override this to customize the server.
	 * <p>
	 * 
	 * (By default, this delegates to serveFile() and allows directory listing.)
	 * 
	 * @param uri
	 *            Percent-decoded URI without parameters, for example
	 *            "/index.cgi"
	 * @param method
	 *            "GET", "POST" etc.
	 * @param parms
	 *            Parsed, percent decoded parameters from URI and, in case of
	 *            POST, data.
	 * @param header
	 *            Header entries, percent decoded
	 * @return HTTP response, see class Response for details
	 */
public Response serve(String uri, String method, Properties header, Properties parms, Properties files) {
    myOut.println(method + " '" + uri + "' ");
    Enumeration e = header.propertyNames();
    while (e.hasMoreElements()) {
        String value = (String) e.nextElement();
        myOut.println(" HDR: '" + value + "' = '" + header.getProperty(value) + "'");
    }
    e = parms.propertyNames();
    while (e.hasMoreElements()) {
        String value = (String) e.nextElement();
        myOut.println(" PRM: '" + value + "' = '" + parms.getProperty(value) + "'");
    }
    e = files.propertyNames();
    while (e.hasMoreElements()) {
        String value = (String) e.nextElement();
        myOut.println(" UPLOADED: '" + value + "' = '" + files.getProperty(value) + "'");
    }
    return serveFile(uri, header, myRootDir, true);
}

7. NanoHTTPD#serve()

Project: selendroid
Source File: NanoHTTPD.java
View license
// ==================================================
// API parts
// ==================================================
/**
   * Override this to customize the server.
   * <p>
   * 
   * (By default, this delegates to serveFile() and allows directory listing.)
   * 
   * @param uri Percent-decoded URI without parameters, for example "/index.cgi"
   * @param method "GET", "POST" etc.
   * @param parms Parsed, percent decoded parameters from URI and, in case of POST, data.
   * @param header Header entries, percent decoded
   * @return HTTP response, see class Response for details
   */
public Response serve(String uri, String method, Properties header, Properties parms, Properties files) {
    myOut.println(method + " '" + uri + "' ");
    Enumeration e = header.propertyNames();
    while (e.hasMoreElements()) {
        String value = (String) e.nextElement();
        myOut.println("  HDR: '" + value + "' = '" + header.getProperty(value) + "'");
    }
    e = parms.propertyNames();
    while (e.hasMoreElements()) {
        String value = (String) e.nextElement();
        myOut.println("  PRM: '" + value + "' = '" + parms.getProperty(value) + "'");
    }
    e = files.propertyNames();
    while (e.hasMoreElements()) {
        String value = (String) e.nextElement();
        myOut.println("  UPLOADED: '" + value + "' = '" + files.getProperty(value) + "'");
    }
    return serveFile(uri, header, myRootDir, true);
}

8. PKCS12KeyStoreSpi#engineAliases()

Project: bc-java
Source File: PKCS12KeyStoreSpi.java
View license
public Enumeration engineAliases() {
    Hashtable tab = new Hashtable();
    Enumeration e = certs.keys();
    while (e.hasMoreElements()) {
        tab.put(e.nextElement(), "cert");
    }
    e = keys.keys();
    while (e.hasMoreElements()) {
        String a = (String) e.nextElement();
        if (tab.get(a) == null) {
            tab.put(a, "key");
        }
    }
    return tab.keys();
}

9. PKCS12KeyStoreSpi#engineSize()

Project: bc-java
Source File: PKCS12KeyStoreSpi.java
View license
public int engineSize() {
    Hashtable tab = new Hashtable();
    Enumeration e = certs.keys();
    while (e.hasMoreElements()) {
        tab.put(e.nextElement(), "cert");
    }
    e = keys.keys();
    while (e.hasMoreElements()) {
        String a = (String) e.nextElement();
        if (tab.get(a) == null) {
            tab.put(a, "key");
        }
    }
    return tab.size();
}

10. PKCS12KeyStoreSpi#engineAliases()

Project: bc-java
Source File: PKCS12KeyStoreSpi.java
View license
public Enumeration engineAliases() {
    Hashtable tab = new Hashtable();
    Enumeration e = certs.keys();
    while (e.hasMoreElements()) {
        tab.put(e.nextElement(), "cert");
    }
    e = keys.keys();
    while (e.hasMoreElements()) {
        String a = (String) e.nextElement();
        if (tab.get(a) == null) {
            tab.put(a, "key");
        }
    }
    return tab.keys();
}

11. PKCS12KeyStoreSpi#engineSize()

Project: bc-java
Source File: PKCS12KeyStoreSpi.java
View license
public int engineSize() {
    Hashtable tab = new Hashtable();
    Enumeration e = certs.keys();
    while (e.hasMoreElements()) {
        tab.put(e.nextElement(), "cert");
    }
    e = keys.keys();
    while (e.hasMoreElements()) {
        String a = (String) e.nextElement();
        if (tab.get(a) == null) {
            tab.put(a, "key");
        }
    }
    return tab.size();
}

12. PKCS12KeyStoreSpi#engineAliases()

Project: bc-java
Source File: PKCS12KeyStoreSpi.java
View license
public Enumeration engineAliases() {
    Hashtable tab = new Hashtable();
    Enumeration e = certs.keys();
    while (e.hasMoreElements()) {
        tab.put(e.nextElement(), "cert");
    }
    e = keys.keys();
    while (e.hasMoreElements()) {
        String a = (String) e.nextElement();
        if (tab.get(a) == null) {
            tab.put(a, "key");
        }
    }
    return tab.keys();
}

13. PKCS12KeyStoreSpi#engineSize()

Project: bc-java
Source File: PKCS12KeyStoreSpi.java
View license
public int engineSize() {
    Hashtable tab = new Hashtable();
    Enumeration e = certs.keys();
    while (e.hasMoreElements()) {
        tab.put(e.nextElement(), "cert");
    }
    e = keys.keys();
    while (e.hasMoreElements()) {
        String a = (String) e.nextElement();
        if (tab.get(a) == null) {
            tab.put(a, "key");
        }
    }
    return tab.size();
}

14. WebDAVUtil#getProperty()

Project: cocoon
Source File: WebDAVUtil.java
View license
/**
     * get a property 
     * 
     * @param uri  the URI to get the property from
     * @param name  the name of the property
     * @param namespace  the namespace of the property
     * @throws HttpException
     * @throws IOException
     */
public static SourceProperty getProperty(String uri, String name, String namespace) throws HttpException, IOException {
    Vector propNames = new Vector(1);
    propNames.add(new PropertyName(namespace, name));
    Enumeration props = null;
    Property prop = null;
    WebdavResource resource = WebDAVUtil.getWebdavResource(uri);
    Enumeration responses = resource.propfindMethod(0, propNames);
    while (responses.hasMoreElements()) {
        ResponseEntity response = (ResponseEntity) responses.nextElement();
        props = response.getProperties();
        if (props.hasMoreElements()) {
            prop = (Property) props.nextElement();
            return new SourceProperty(prop.getElement());
        }
    }
    return null;
}

15. WebDAVUtil#getAllProperties()

Project: cocoon
Source File: WebDAVUtil.java
View license
/**
     * get all properties for given uri 
     * 
     * @param uri  the URI to get the properties from
     * @throws HttpException
     * @throws IOException
     */
public static List getAllProperties(String uri) throws HttpException, IOException {
    List sourceproperties = new ArrayList();
    WebdavResource resource = WebDAVUtil.getWebdavResource(uri);
    Enumeration responses = resource.propfindMethod(0);
    Enumeration props = null;
    Property prop = null;
    while (responses.hasMoreElements()) {
        ResponseEntity response = (ResponseEntity) responses.nextElement();
        props = response.getProperties();
        while (props.hasMoreElements()) {
            prop = (Property) props.nextElement();
            SourceProperty srcProperty = new SourceProperty(prop.getElement());
            sourceproperties.add(srcProperty);
        }
    }
    return sourceproperties;
}

16. ServletRequestHandler#collectPropertyNames()

View license
protected void collectPropertyNames(HashSet set, Object bean) {
    super.collectPropertyNames(set, bean);
    ServletRequestAndContext handle = (ServletRequestAndContext) bean;
    ServletRequest servletRequest = handle.getServletRequest();
    Enumeration e = servletRequest.getAttributeNames();
    while (e.hasMoreElements()) {
        set.add(e.nextElement());
    }
    e = servletRequest.getParameterNames();
    while (e.hasMoreElements()) {
        set.add(e.nextElement());
    }
}

17. JarFileClassLoader#findResources()

View license
/**
     * [email protected]}
     */
public Enumeration findResources(final String resourceName) throws IOException {
    // todo this is not right
    // first get the resources from the parent classloaders
    Enumeration parentResources = super.findResources(resourceName);
    // get the classes from my urls
    Enumeration myResources = (Enumeration) AccessController.doPrivileged(new PrivilegedAction() {

        public Object run() {
            return resourceFinder.findResources(resourceName);
        }
    }, acc);
    // join the two together
    Enumeration resources = new UnionEnumeration(parentResources, myResources);
    return resources;
}

18. NanoHTTPD#serve()

Project: h-store
Source File: NanoHTTPD.java
View license
// ==================================================
// API parts
// ==================================================
/**
     * Override this to customize the server.<p>
     *
     * (By default, this delegates to serveFile() and allows directory listing.)
     *
     * @parm uri    Percent-decoded URI without parameters, for example "/index.cgi"
     * @parm method "GET", "POST" etc.
     * @parm parms  Parsed, percent decoded parameters from URI and, in case of POST, data.
     * @parm header Header entries, percent decoded
     * @return HTTP response, see class Response for details
     */
@SuppressWarnings("unchecked")
public Response serve(String uri, String method, Properties header, Properties parms) {
    System.out.println(method + " '" + uri + "' ");
    Enumeration e = header.propertyNames();
    while (e.hasMoreElements()) {
        String value = (String) e.nextElement();
        System.out.println("  HDR: '" + value + "' = '" + header.getProperty(value) + "'");
    }
    e = parms.propertyNames();
    while (e.hasMoreElements()) {
        String value = (String) e.nextElement();
        System.out.println("  PRM: '" + value + "' = '" + parms.getProperty(value) + "'");
    }
    return serveFile(uri, header, new File("."), true);
}

19. ZaurusEditor#resetTableForms()

Project: h-store
Source File: ZaurusEditor.java
View license
// reset  everything after changes in the database
private void resetTableForms() {
    lForm.show(pForm, "search");
    lButton.show(pButton, "search");
    Vector vAllTables = getAllTables();
    // fill the drop down list again
    // get all table names and show a drop down list of them in cTables
    cTables.removeAll();
    for (Enumeration e = vAllTables.elements(); e.hasMoreElements(); ) {
        cTables.addItem((String) e.nextElement());
    }
    // remove all form panels from pForm
    for (Enumeration e = vHoldForms.elements(); e.hasMoreElements(); ) {
        pForm.remove((ZaurusTableForm) e.nextElement());
    }
    // end of while (Enumeration e = vHoldForms.elements(); e.hasMoreElements();)
    // initialize a new list for the table names which have a form in pForm
    vHoldTableNames = new Vector(20);
    vHoldForms = new Vector(20);
}

20. EnumerationCanBeIterationInspection#foo()

View license
static void foo(Vector v, Hashtable h) {
    Enumeration e = v.elements();
    while (e.hasMoreElements()) {
        System.out.println(e.nextElement());
    }
    Iterator i = v.iterator();
    while (i.hasNext()) {
        System.out.println(i.next());
    }
    e = h.elements();
    while (e.hasMoreElements()) {
        System.out.println(e.nextElement());
    }
    e = h.keys();
    i = h.values().iterator();
    while (i.hasNext()) {
        System.out.println(i.next());
    }
}

21. VectorTest#test_clear()

Project: j2objc
Source File: VectorTest.java
View license
/**
	 * @tests java.util.Vector#clear()
	 */
public void test_clear() {
    // Test for method void java.util.Vector.clear()
    Vector orgVector = vectorClone(tVector);
    tVector.clear();
    assertEquals("a) Cleared Vector has non-zero size", 0, tVector.size());
    Enumeration e = orgVector.elements();
    while (e.hasMoreElements()) assertTrue("a) Cleared vector contained elements", !tVector.contains(e.nextElement()));
    tVector.add(null);
    tVector.clear();
    assertEquals("b) Cleared Vector has non-zero size", 0, tVector.size());
    e = orgVector.elements();
    while (e.hasMoreElements()) assertTrue("b) Cleared vector contained elements", !tVector.contains(e.nextElement()));
}

22. VectorTest#test_clone()

Project: j2objc
Source File: VectorTest.java
View license
/**
	 * @tests java.util.Vector#clone()
	 */
public void test_clone() {
    // Test for method java.lang.Object java.util.Vector.clone()
    tVector.add(25, null);
    tVector.add(75, null);
    Vector v = (Vector) tVector.clone();
    Enumeration orgNum = tVector.elements();
    Enumeration cnum = v.elements();
    while (orgNum.hasMoreElements()) {
        assertTrue("Not enough elements copied", cnum.hasMoreElements());
        assertTrue("Vector cloned improperly, elements do not match", orgNum.nextElement() == cnum.nextElement());
    }
    assertTrue("Not enough elements copied", !cnum.hasMoreElements());
}

23. DTDBuilder#saveEntities()

Project: jdk7u-jdk
Source File: DTDBuilder.java
View license
/**
     * Save an entity to a stream.
     */
void saveEntities(DataOutputStream out) throws IOException {
    int num = 0;
    for (Enumeration e = entityHash.elements(); e.hasMoreElements(); ) {
        Entity ent = (Entity) e.nextElement();
        if (ent.isGeneral()) {
            num++;
        }
    }
    out.writeShort((short) num);
    for (Enumeration e = entityHash.elements(); e.hasMoreElements(); ) {
        Entity ent = (Entity) e.nextElement();
        if (ent.isGeneral()) {
            out.writeShort(getNameId(ent.getName()));
            out.writeByte(ent.getType() & ~GENERAL);
            out.writeUTF(ent.getString());
        }
    }
}

24. Area#isSingular()

Project: jdk7u-jdk
Source File: Area.java
View license
/**
     * Tests whether this <code>Area</code> is comprised of a single
     * closed subpath.  This method returns <code>true</code> if the
     * path contains 0 or 1 subpaths, or <code>false</code> if the path
     * contains more than 1 subpath.  The subpaths are counted by the
     * number of [email protected] PathIterator#SEG_MOVETO SEG_MOVETO}  segments
     * that appear in the path.
     * @return    <code>true</code> if the <code>Area</code> is comprised
     * of a single basic geometry; <code>false</code> otherwise.
     * @since 1.2
     */
public boolean isSingular() {
    if (curves.size() < 3) {
        return true;
    }
    Enumeration enum_ = curves.elements();
    // First Order0 "moveto"
    enum_.nextElement();
    while (enum_.hasMoreElements()) {
        if (((Curve) enum_.nextElement()).getOrder() == 0) {
            return false;
        }
    }
    return true;
}

25. Manager#disconnectClients()

Project: jmud
Source File: Manager.java
View license
synchronized /* incomingClients, playingClients */
void disconnectClients() {
    Log.info("Desconectando clientes");
    for (Enumeration ce = incomingClients.elements(); ce.hasMoreElements(); ) {
        Client c = (Client) ce.nextElement();
        c.flush();
        c.rawSend(Separators.NL + "Sistema desativado." + Separators.NL);
        c.disconnect();
    }
    for (Enumeration ce = playingClients.elements(); ce.hasMoreElements(); ) {
        Client c = (Client) ce.nextElement();
        c.saveChar();
        c.flush();
        c.rawSend(Separators.NL + "Sistema desativado." + Separators.NL);
        c.disconnect();
    }
}

26. Area#isSingular()

Project: LGame
Source File: Area.java
View license
/**
	 * Tests whether this <code>Area</code> is comprised of a single closed
	 * subpath. This method returns <code>true</code> if the path contains 0 or
	 * 1 subpaths, or <code>false</code> if the path contains more than 1
	 * subpath. The subpaths are counted by the number of
	 * [email protected] PathIterator#SEG_MOVETO SEG_MOVETO} segments that appear in the
	 * path.
	 * 
	 * @return <code>true</code> if the <code>Area</code> is comprised of a
	 *         single basic geometry; <code>false</code> otherwise.
	 * @since 1.2
	 */
public boolean isSingular() {
    if (curves.size() < 3) {
        return true;
    }
    Enumeration enum_ = curves.elements();
    // First Order0 "moveto"
    enum_.nextElement();
    while (enum_.hasMoreElements()) {
        if (((Curve) enum_.nextElement()).getOrder() == 0) {
            return false;
        }
    }
    return true;
}

27. DOMScanner#scan()

Project: openjdk
Source File: DOMScanner.java
View license
public void scan(Element e) throws SAXException {
    setCurrentLocation(e);
    receiver.setDocumentLocator(locator);
    receiver.startDocument();
    NamespaceSupport nss = new NamespaceSupport();
    buildNamespaceSupport(nss, e.getParentNode());
    for (Enumeration en = nss.getPrefixes(); en.hasMoreElements(); ) {
        String prefix = (String) en.nextElement();
        receiver.startPrefixMapping(prefix, nss.getURI(prefix));
    }
    visit(e);
    for (Enumeration en = nss.getPrefixes(); en.hasMoreElements(); ) {
        String prefix = (String) en.nextElement();
        receiver.endPrefixMapping(prefix);
    }
    setCurrentLocation(e);
    receiver.endDocument();
}

28. AnnotationAttr#write()

Project: pluotsorbet
Source File: AnnotationAttr.java
View license
void write(ClassEnv e, DataOutputStream out) throws IOException, jasError {
    out.writeShort(e.getCPIndex(attr));
    int len = 2;
    for (Enumeration en = anns.elements(); en.hasMoreElements(); ) len += ((Annotation) en.nextElement()).size();
    out.writeInt(len);
    out.writeShort((short) anns.size());
    for (Enumeration en = anns.elements(); en.hasMoreElements(); ) ((Annotation) en.nextElement()).write(e, out);
}

29. ZaurusEditor#resetTableForms()

Project: voltdb
Source File: ZaurusEditor.java
View license
// reset  everything after changes in the database
private void resetTableForms() {
    lForm.show(pForm, "search");
    lButton.show(pButton, "search");
    Vector vAllTables = getAllTables();
    // fill the drop down list again
    // get all table names and show a drop down list of them in cTables
    cTables.removeAll();
    for (Enumeration e = vAllTables.elements(); e.hasMoreElements(); ) {
        cTables.addItem((String) e.nextElement());
    }
    // remove all form panels from pForm
    for (Enumeration e = vHoldForms.elements(); e.hasMoreElements(); ) {
        pForm.remove((ZaurusTableForm) e.nextElement());
    }
    // end of while (Enumeration e = vHoldForms.elements(); e.hasMoreElements();)
    // initialize a new list for the table names which have a form in pForm
    vHoldTableNames = new Vector(20);
    vHoldForms = new Vector(20);
}

30. VerifiableProperties#verify()

Project: ambry
Source File: VerifiableProperties.java
View license
public void verify() {
    logger.info("Verifying properties");
    Enumeration keys = props.propertyNames();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        if (!referenceSet.contains(key)) {
            logger.warn("Property {} is not valid", key);
        } else {
            logger.info("Property {} is overridden to {}", key, props.getProperty(key.toString()));
        }
    }
}

31. CnZipOutputStream#finish()

View license
@SuppressWarnings("rawtypes")
public void finish() throws IOException {
    ensureOpen();
    if (this.finished) {
        return;
    }
    if (this.entry != null) {
        closeEntry();
    }
    if (this.entries.size() < 1) {
        throw new ZipException("ZIP file must have at least one entry");
    }
    long off = this.written;
    Enumeration e = this.entries.elements();
    while (e.hasMoreElements()) {
        writeCEN((ZipEntry) e.nextElement());
    }
    writeEND(off, this.written - off);
    this.finished = true;
}

32. MavenProxyPropertyLoader#getSubset()

View license
@SuppressWarnings("unchecked")
private Properties getSubset(Properties props, String prefix) {
    Enumeration keys = props.keys();
    Properties result = new Properties();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        String value = props.getProperty(key);
        if (key.startsWith(prefix)) {
            String newKey = key.substring(prefix.length());
            result.setProperty(newKey, value);
        }
    }
    return result;
}

33. ForeachTask#executeAntTask()

Project: axis1-java
Source File: ForeachTask.java
View license
private void executeAntTask() {
    /* if (callee == null) { */
    callee = (Ant) getProject().createTask("ant");
    callee.setOwningTarget(getOwningTarget());
    callee.setTaskName(getTaskName());
    callee.init();
    /* }                     */
    callee.setAntfile(getProject().getProperty("ant.file"));
    callee.setTarget(subTarget);
    callee.setInheritAll(inheritAll);
    callee.setInheritRefs(inheritRefs);
    Enumeration keys = properties.keys();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        String val = (String) properties.get(key);
        Property prop = callee.createProperty();
        prop.setName(key);
        prop.setValue(val);
    }
    callee.execute();
    System.gc();
    System.gc();
    System.gc();
}

34. RB#merge()

Project: axis1-java
Source File: RB.java
View license
/**
      * Merge two Properties objects
      */
protected Properties merge(Properties p1, Properties p2) {
    if ((p1 == null) && (p2 == null)) {
        return null;
    } else if (p1 == null) {
        return p2;
    } else if (p2 == null) {
        return p1;
    }
    // Now merge. p1 takes precedence
    Enumeration enumeration = p2.keys();
    while (enumeration.hasMoreElements()) {
        String key = (String) enumeration.nextElement();
        if (p1.getProperty(key) == null) {
            p1.put(key, p2.getProperty(key));
        }
    }
    return p1;
}

35. MessageElement#findElement()

Project: axis1-java
Source File: MessageElement.java
View license
// setEncodingStyle implemented above
// getEncodingStyle() implemented above
protected MessageElement findElement(Vector vec, String namespace, String localPart) {
    if (vec.isEmpty()) {
        return null;
    }
    QName qname = new QName(namespace, localPart);
    Enumeration e = vec.elements();
    MessageElement element;
    while (e.hasMoreElements()) {
        element = (MessageElement) e.nextElement();
        if (element.getQName().equals(qname)) {
            return element;
        }
    }
    return null;
}

36. AxisHTTPSessionListener#destroySession()

View license
/**
     * Static method to destroy all ServiceLifecycle objects within an
     * Axis session.
     */
static void destroySession(HttpSession session) {
    // Check for our marker so as not to do unneeded work
    if (session.getAttribute(AxisHttpSession.AXIS_SESSION_MARKER) == null)
        return;
    if (log.isDebugEnabled()) {
        log.debug("Got destroySession event : " + session);
    }
    Enumeration e = session.getAttributeNames();
    while (e.hasMoreElements()) {
        Object next = e.nextElement();
        if (next instanceof ServiceLifecycle) {
            ((ServiceLifecycle) next).destroy();
        }
    }
}

37. TestMessages#testAllMessages()

Project: axis1-java
Source File: TestMessages.java
View license
public void testAllMessages() {
    String arg0 = "arg0";
    String arg1 = "arg1";
    String[] args = { arg0, arg1, "arg2" };
    int count = 0;
    Enumeration keys = Messages.getResourceBundle().getKeys();
    while (keys.hasMoreElements()) {
        count++;
        String key = (String) keys.nextElement();
        try {
            String message = Messages.getMessage(key);
            message = Messages.getMessage(key, arg0);
            message = Messages.getMessage(key, arg0, arg1);
            message = Messages.getMessage(key, args);
        } catch (IllegalArgumentException iae) {
            throw new AssertionFailedError("Test failure on key = " + key + ":  " + iae.getMessage());
        }
    }
    assertTrue("expected # keys greater than " + expectedNumberKeysThreshold + ", only got " + count + "!  VERIFY HIERARCHICAL MESSAGES WORK/LINKED CORRECTLY", count > expectedNumberKeysThreshold);
}

38. SOAPMonitorService#destroy()

Project: axis1-java
Source File: SOAPMonitorService.java
View license
/**
   * Servlet termination
   */
public void destroy() {
    // End all connection threads
    Enumeration e = connections.elements();
    while (e.hasMoreElements()) {
        ConnectionThread ct = (ConnectionThread) e.nextElement();
        ct.close();
    }
    // End main server socket thread
    if (server_socket != null) {
        try {
            server_socket.close();
        } catch (Exception x) {
        }
        server_socket = null;
    }
}

39. RegistryService#Unregister()

Project: axis1-java
Source File: RegistryService.java
View license
/**
     * Unregister a serivce
     * @param server name
     */
public void Unregister(String name) {
    Enumeration e1 = registry.keys();
    while (e1.hasMoreElements()) {
        Vector list = (Vector) registry.get(e1.nextElement());
        Enumeration e2 = list.elements();
        while (e2.hasMoreElements()) {
            Service s = (Service) e2.nextElement();
            if (s.getServiceName().equals(name)) {
                list.remove(s);
                save();
            }
        }
    }
}

40. AxisService#adjustSchemaNames()

Project: axis2-java
Source File: AxisService.java
View license
/**
	 * Run 2 - adjust the names
	 */
private Map adjustSchemaNames(List schemas, Hashtable nameTable, Hashtable sourceURIToNewLocationMap) {
    Hashtable importedSchemas = new Hashtable();
    // process the schemas in the main schema list
    for (int i = 0; i < schemas.size(); i++) {
        adjustSchemaName((XmlSchema) schemas.get(i), nameTable, importedSchemas, sourceURIToNewLocationMap);
    }
    // process all the rest in the name table
    Enumeration nameTableKeys = nameTable.keys();
    while (nameTableKeys.hasMoreElements()) {
        adjustSchemaName((XmlSchema) nameTableKeys.nextElement(), nameTable, importedSchemas, sourceURIToNewLocationMap);
    }
    return importedSchemas;
}

41. RB#merge()

Project: axis2-java
Source File: RB.java
View license
/**
     * Merge two Properties objects
     */
protected Properties merge(Properties p1, Properties p2) {
    if ((p1 == null) && (p2 == null)) {
        return null;
    } else if (p1 == null) {
        return p2;
    } else if (p2 == null) {
        return p1;
    }
    // Now merge. p1 takes precedence
    Enumeration enumeration = p2.keys();
    while (enumeration.hasMoreElements()) {
        String key = (String) enumeration.nextElement();
        if (p1.getProperty(key) == null) {
            p1.put(key, p2.getProperty(key));
        }
    }
    return p1;
}

42. Utils#getIpAddress()

Project: axis2-java
Source File: Utils.java
View license
/**
     * Returns the ip address to be used for the replyto epr
     * CAUTION:
     * This will go through all the available network interfaces and will try to return an ip address.
     * First this will try to get the first IP which is not loopback address (127.0.0.1). If none is found
     * then this will return this will return 127.0.0.1.
     * This will <b>not<b> consider IPv6 addresses.
     * <p/>
     * TODO:
     * - Improve this logic to genaralize it a bit more
     * - Obtain the ip to be used here from the Call API
     *
     * @return Returns String.
     * @throws java.net.SocketException
      */
public static String getIpAddress() throws SocketException {
    Enumeration e = NetworkInterface.getNetworkInterfaces();
    String address = "127.0.0.1";
    while (e.hasMoreElements()) {
        NetworkInterface netface = (NetworkInterface) e.nextElement();
        Enumeration addresses = netface.getInetAddresses();
        while (addresses.hasMoreElements()) {
            InetAddress ip = (InetAddress) addresses.nextElement();
            if (!ip.isLoopbackAddress() && isIP(ip.getHostAddress())) {
                return ip.getHostAddress();
            }
        }
    }
    return address;
}

43. RB#merge()

Project: axis2-java
Source File: RB.java
View license
/** Merge two Properties objects */
protected Properties merge(Properties p1, Properties p2) {
    if ((p1 == null) && (p2 == null)) {
        return null;
    } else if (p1 == null) {
        return p2;
    } else if (p2 == null) {
        return p1;
    }
    // Now merge. p1 takes precedence
    Enumeration enumeration = p2.keys();
    while (enumeration.hasMoreElements()) {
        String key = (String) enumeration.nextElement();
        if (p1.getProperty(key) == null) {
            p1.put(key, p2.getProperty(key));
        }
    }
    return p1;
}

44. SOAPMonitorService#destroy()

Project: axis2-java
Source File: SOAPMonitorService.java
View license
/**
     * Servlet termination
     */
public void destroy() {
    // End all connection threads
    Enumeration e = connections.elements();
    while (e.hasMoreElements()) {
        ConnectionThread ct = (ConnectionThread) e.nextElement();
        ct.close();
    }
    // End main server socket thread
    if (serverSocket != null) {
        try {
            serverSocket.close();
        } catch (Exception x) {
        }
        serverSocket = null;
    }
}

45. ListingAgent#getParamtereIgnoreCase()

Project: axis2-java
Source File: ListingAgent.java
View license
public String getParamtereIgnoreCase(HttpServletRequest req, String paraName) {
    Enumeration e = req.getParameterNames();
    while (e.hasMoreElements()) {
        String name = (String) e.nextElement();
        if (name.equalsIgnoreCase(paraName)) {
            String value = req.getParameter(name);
            return value;
        }
    }
    return null;
}

46. PropertiesLoaderUtils#loadAllProperties()

Project: bboss
Source File: PropertiesLoaderUtils.java
View license
/**
	 * Load all properties from the given class path resource,
	 * using the given class loader.
	 * <p>Merges properties if more than one resource of the same name
	 * found in the class path.
	 * @param resourceName the name of the class path resource
	 * @param classLoader the ClassLoader to use for loading
	 * (or <code>null</code> to use the default class loader)
	 * @return the populated Properties instance
	 * @throws IOException if loading failed
	 */
public static Properties loadAllProperties(String resourceName, ClassLoader classLoader) throws IOException {
    Assert.notNull(resourceName, "Resource name must not be null");
    ClassLoader clToUse = classLoader;
    if (clToUse == null) {
        clToUse = ClassUtils.getDefaultClassLoader();
    }
    Properties properties = new Properties();
    Enumeration urls = clToUse.getResources(resourceName);
    while (urls.hasMoreElements()) {
        URL url = (URL) urls.nextElement();
        InputStream is = null;
        try {
            URLConnection con = url.openConnection();
            con.setUseCaches(false);
            is = con.getInputStream();
            properties.load(is);
        } finally {
            if (is != null) {
                is.close();
            }
        }
    }
    return properties;
}

47. WebUtils#getTargetPage()

Project: bboss
Source File: WebUtils.java
View license
/**
	 * Return the target page specified in the request.
	 * @param request current servlet request
	 * @param paramPrefix the parameter prefix to check for
	 * (e.g. "_target" for parameters like "_target1" or "_target2")
	 * @param currentPage the current page, to be returned as fallback
	 * if no target page specified
	 * @return the page specified in the request, or current page if not found
	 */
public static int getTargetPage(ServletRequest request, String paramPrefix, int currentPage) {
    Enumeration paramNames = request.getParameterNames();
    while (paramNames.hasMoreElements()) {
        String paramName = (String) paramNames.nextElement();
        if (paramName.startsWith(paramPrefix)) {
            for (int i = 0; i < WebUtils.SUBMIT_IMAGE_SUFFIXES.length; i++) {
                String suffix = WebUtils.SUBMIT_IMAGE_SUFFIXES[i];
                if (paramName.endsWith(suffix)) {
                    paramName = paramName.substring(0, paramName.length() - suffix.length());
                }
            }
            return Integer.parseInt(paramName.substring(paramPrefix.length()));
        }
    }
    return currentPage;
}

48. PathMatchingResourcePatternResolver#findAllClassPathResources()

View license
/**
	 * Find all class location resources with the given location via the ClassLoader.
	 * @param location the absolute path within the classpath
	 * @return the result as Resource array
	 * @throws IOException in case of I/O errors
	 * @see java.lang.ClassLoader#getResources
	 * @see #convertClassLoaderURL
	 */
protected Resource[] findAllClassPathResources(String location) throws IOException {
    String path = location;
    if (path.startsWith("/")) {
        path = path.substring(1);
    }
    Enumeration resourceUrls = getClassLoader().getResources(path);
    Set result = new LinkedHashSet(16);
    while (resourceUrls.hasMoreElements()) {
        URL url = (URL) resourceUrls.nextElement();
        result.add(convertClassLoaderURL(url));
    }
    return (Resource[]) result.toArray(new Resource[result.size()]);
}

49. JarHolder#getEntries()

Project: bboss
Source File: JarHolder.java
View license
/**
     * @return The entries of the jar as a hashtable.
     */
public Hashtable getEntries() {
    Hashtable allEntries = new Hashtable(559);
    Enumeration all = theJar.entries();
    while (all.hasMoreElements()) {
        JarEntry je = (JarEntry) all.nextElement();
        // We don't map plain directory entries
        if (!je.isDirectory()) {
            allEntries.put(je.getName(), this.urlpath);
        }
    }
    return allEntries;
}

50. RuntimeInstance#setProperties()

Project: bboss
Source File: RuntimeInstance.java
View license
/**
     * Add all properties contained in the file fileName to the RuntimeInstance properties
     */
public void setProperties(String fileName) {
    ExtendedProperties props = null;
    try {
        props = new ExtendedProperties(fileName);
    } catch (IOException e) {
        throw new VelocityException("Error reading properties from '" + fileName + "'", e);
    }
    Enumeration en = props.keys();
    while (en.hasMoreElements()) {
        String key = en.nextElement().toString();
        setProperty(key, props.get(key));
    }
}

51. ASN1Sequence#hashCode()

Project: bc-java
Source File: ASN1Sequence.java
View license
public int hashCode() {
    Enumeration e = this.getObjects();
    int hashCode = size();
    while (e.hasMoreElements()) {
        Object o = getNext(e);
        hashCode *= 17;
        hashCode ^= o.hashCode();
    }
    return hashCode;
}

52. ASN1Set#hashCode()

Project: bc-java
Source File: ASN1Set.java
View license
public int hashCode() {
    Enumeration e = this.getObjects();
    int hashCode = size();
    while (e.hasMoreElements()) {
        Object o = getNext(e);
        hashCode *= 17;
        hashCode ^= o.hashCode();
    }
    return hashCode;
}

53. BERConstructedOctetString#fromSequence()

View license
public static BEROctetString fromSequence(ASN1Sequence seq) {
    Vector v = new Vector();
    Enumeration e = seq.getObjects();
    while (e.hasMoreElements()) {
        v.addElement(e.nextElement());
    }
    return new BERConstructedOctetString(v);
}

54. BEROctetString#fromSequence()

Project: bc-java
Source File: BEROctetString.java
View license
static BEROctetString fromSequence(ASN1Sequence seq) {
    ASN1OctetString[] v = new ASN1OctetString[seq.size()];
    Enumeration e = seq.getObjects();
    int index = 0;
    while (e.hasMoreElements()) {
        v[index++] = (ASN1OctetString) e.nextElement();
    }
    return new BEROctetString(v);
}

55. BERSequence#encode()

Project: bc-java
Source File: BERSequence.java
View license
void encode(ASN1OutputStream out) throws IOException {
    out.write(BERTags.SEQUENCE | BERTags.CONSTRUCTED);
    out.write(0x80);
    Enumeration e = getObjects();
    while (e.hasMoreElements()) {
        out.writeObject((ASN1Encodable) e.nextElement());
    }
    out.write(0x00);
    out.write(0x00);
}

56. BERSet#encode()

Project: bc-java
Source File: BERSet.java
View license
void encode(ASN1OutputStream out) throws IOException {
    out.write(BERTags.SET | BERTags.CONSTRUCTED);
    out.write(0x80);
    Enumeration e = getObjects();
    while (e.hasMoreElements()) {
        out.writeObject((ASN1Encodable) e.nextElement());
    }
    out.write(0x00);
    out.write(0x00);
}

57. AttributeTable#copyTable()

Project: bc-java
Source File: AttributeTable.java
View license
private Hashtable copyTable(Hashtable in) {
    Hashtable out = new Hashtable();
    Enumeration e = in.keys();
    while (e.hasMoreElements()) {
        Object key = e.nextElement();
        out.put(key, in.get(key));
    }
    return out;
}

58. Flags#decode()

Project: bc-java
Source File: Flags.java
View license
/* Java 1.5
     String decode(Map<Integer, String> decodeMap)
     {
         StringJoiner joiner = new StringJoiner(" ");
         for (int i : decodeMap.keySet())
         {
             if (isSet(i))
                 joiner.add(decodeMap.get(i));
         }
         return joiner.toString();
     }
     */
String decode(Hashtable decodeMap) {
    StringJoiner joiner = new StringJoiner(" ");
    Enumeration e = decodeMap.keys();
    while (e.hasMoreElements()) {
        Integer i = (Integer) e.nextElement();
        if (isSet(i.intValue())) {
            joiner.add((String) decodeMap.get(i));
        }
    }
    return joiner.toString();
}

59. ECPrivateKey#getObjectInTag()

Project: bc-java
Source File: ECPrivateKey.java
View license
private ASN1Primitive getObjectInTag(int tagNo) {
    Enumeration e = seq.getObjects();
    while (e.hasMoreElements()) {
        ASN1Encodable obj = (ASN1Encodable) e.nextElement();
        if (obj instanceof ASN1TaggedObject) {
            ASN1TaggedObject tag = (ASN1TaggedObject) obj;
            if (tag.getTagNo() == tagNo) {
                return tag.getObject().toASN1Primitive();
            }
        }
    }
    return null;
}

60. ECPrivateKeyStructure#getObjectInTag()

Project: bc-java
Source File: ECPrivateKeyStructure.java
View license
private ASN1Primitive getObjectInTag(int tagNo) {
    Enumeration e = seq.getObjects();
    while (e.hasMoreElements()) {
        ASN1Encodable obj = (ASN1Encodable) e.nextElement();
        if (obj instanceof ASN1TaggedObject) {
            ASN1TaggedObject tag = (ASN1TaggedObject) obj;
            if (tag.getTagNo() == tagNo) {
                return (ASN1Primitive) ((ASN1Encodable) tag.getObject()).toASN1Primitive();
            }
        }
    }
    return null;
}

61. AbstractX500NameStyle#copyHashTable()

Project: bc-java
Source File: AbstractX500NameStyle.java
View license
/**
     * Tool function to shallow copy a Hashtable.
     *
     * @param paramsMap table to copy
     * @return the copy of the table
     */
public static Hashtable copyHashTable(Hashtable paramsMap) {
    Hashtable newTable = new Hashtable();
    Enumeration keys = paramsMap.keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        newTable.put(key, paramsMap.get(key));
    }
    return newTable;
}

62. Extensions#toASN1Primitive()

Project: bc-java
Source File: Extensions.java
View license
/**
     * <pre>
     *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
     *
     *     Extension         ::=   SEQUENCE {
     *        extnId            EXTENSION.&id ({ExtensionSet}),
     *        critical          BOOLEAN DEFAULT FALSE,
     *        extnValue         OCTET STRING }
     * </pre>
     */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector vec = new ASN1EncodableVector();
    Enumeration e = ordering.elements();
    while (e.hasMoreElements()) {
        ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) e.nextElement();
        Extension ext = (Extension) extensions.get(oid);
        vec.add(ext);
    }
    return new DERSequence(vec);
}

63. Extensions#equivalent()

Project: bc-java
Source File: Extensions.java
View license
public boolean equivalent(Extensions other) {
    if (extensions.size() != other.extensions.size()) {
        return false;
    }
    Enumeration e1 = extensions.keys();
    while (e1.hasMoreElements()) {
        Object key = e1.nextElement();
        if (!extensions.get(key).equals(other.extensions.get(key))) {
            return false;
        }
    }
    return true;
}

64. SubjectDirectoryAttributes#toASN1Primitive()

View license
/**
     * Produce an object suitable for an ASN1OutputStream.
     * 
     * Returns:
     * 
     * <pre>
     *      SubjectDirectoryAttributes ::= Attributes
     *      Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
     *      Attribute ::= SEQUENCE 
     *      {
     *        type AttributeType 
     *        values SET OF AttributeValue 
     *      }
     *      
     *      AttributeType ::= OBJECT IDENTIFIER
     *      AttributeValue ::= ANY DEFINED BY AttributeType
     * </pre>
     * 
     * @return a ASN1Primitive
     */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector vec = new ASN1EncodableVector();
    Enumeration e = attributes.elements();
    while (e.hasMoreElements()) {
        vec.add((Attribute) e.nextElement());
    }
    return new DERSequence(vec);
}

65. X509Extensions#toASN1Primitive()

Project: bc-java
Source File: X509Extensions.java
View license
/**
     * <pre>
     *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
     *
     *     Extension         ::=   SEQUENCE {
     *        extnId            EXTENSION.&id ({ExtensionSet}),
     *        critical          BOOLEAN DEFAULT FALSE,
     *        extnValue         OCTET STRING }
     * </pre>
     */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector vec = new ASN1EncodableVector();
    Enumeration e = ordering.elements();
    while (e.hasMoreElements()) {
        ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) e.nextElement();
        X509Extension ext = (X509Extension) extensions.get(oid);
        ASN1EncodableVector v = new ASN1EncodableVector();
        v.add(oid);
        if (ext.isCritical()) {
            v.add(ASN1Boolean.TRUE);
        }
        v.add(ext.getValue());
        vec.add(new DERSequence(v));
    }
    return new DERSequence(vec);
}

66. X509Extensions#equivalent()

Project: bc-java
Source File: X509Extensions.java
View license
public boolean equivalent(X509Extensions other) {
    if (extensions.size() != other.extensions.size()) {
        return false;
    }
    Enumeration e1 = extensions.keys();
    while (e1.hasMoreElements()) {
        Object key = e1.nextElement();
        if (!extensions.get(key).equals(other.extensions.get(key))) {
            return false;
        }
    }
    return true;
}

67. DeferredHash#update()

Project: bc-java
Source File: DeferredHash.java
View license
public void update(byte input) {
    if (buf != null) {
        buf.write(input);
        return;
    }
    Enumeration e = hashes.elements();
    while (e.hasMoreElements()) {
        Digest hash = (Digest) e.nextElement();
        hash.update(input);
    }
}

68. DeferredHash#update()

Project: bc-java
Source File: DeferredHash.java
View license
public void update(byte[] input, int inOff, int len) {
    if (buf != null) {
        buf.write(input, inOff, len);
        return;
    }
    Enumeration e = hashes.elements();
    while (e.hasMoreElements()) {
        Digest hash = (Digest) e.nextElement();
        hash.update(input, inOff, len);
    }
}

69. DeferredHash#reset()

Project: bc-java
Source File: DeferredHash.java
View license
public void reset() {
    if (buf != null) {
        buf.reset();
        return;
    }
    Enumeration e = hashes.elements();
    while (e.hasMoreElements()) {
        Digest hash = (Digest) e.nextElement();
        hash.reset();
    }
}

70. DTLSReliableHandshake#checkInboundFlight()

Project: bc-java
Source File: DTLSReliableHandshake.java
View license
/**
     * Check that there are no "extra" messages left in the current inbound flight
     */
private void checkInboundFlight() {
    Enumeration e = currentInboundFlight.keys();
    while (e.hasMoreElements()) {
        Integer key = (Integer) e.nextElement();
        if (key.intValue() >= next_receive_seq) {
        // TODO Should this be considered an error?
        }
    }
}

71. DTLSReliableHandshake#checkAll()

Project: bc-java
Source File: DTLSReliableHandshake.java
View license
private static boolean checkAll(Hashtable inboundFlight) {
    Enumeration e = inboundFlight.elements();
    while (e.hasMoreElements()) {
        if (((DTLSReassembler) e.nextElement()).getBodyIfComplete() == null) {
            return false;
        }
    }
    return true;
}

72. TlsProtocol#writeSelectedExtensions()

Project: bc-java
Source File: TlsProtocol.java
View license
protected static void writeSelectedExtensions(OutputStream output, Hashtable extensions, boolean selectEmpty) throws IOException {
    Enumeration keys = extensions.keys();
    while (keys.hasMoreElements()) {
        Integer key = (Integer) keys.nextElement();
        int extension_type = key.intValue();
        byte[] extension_data = (byte[]) extensions.get(key);
        if (selectEmpty == (extension_data.length == 0)) {
            TlsUtils.checkUint16(extension_type);
            TlsUtils.writeUint16(extension_type, output);
            TlsUtils.writeOpaque16(extension_data, output);
        }
    }
}

73. SMIMEGenerator#extractHeaders()

Project: bc-java
Source File: SMIMEGenerator.java
View license
private void extractHeaders(MimeBodyPart content, MimeMessage message) throws MessagingException {
    Enumeration e = message.getAllHeaders();
    while (e.hasMoreElements()) {
        Header hdr = (Header) e.nextElement();
        content.addHeader(hdr.getName(), hdr.getValue());
    }
}

74. FileBackedMimeBodyPart#saveStreamToFile()

Project: bc-java
Source File: FileBackedMimeBodyPart.java
View license
private static File saveStreamToFile(InternetHeaders headers, InputStream content, File tempFile) throws IOException {
    OutputStream out = new FileOutputStream(tempFile);
    Enumeration en = headers.getAllHeaderLines();
    while (en.hasMoreElements()) {
        writeHeader(out, (String) en.nextElement());
    }
    writeSeperator(out);
    saveContentToStream(out, content);
    return tempFile;
}

75. DefaultSignedAttributeTableGenerator#copyHashTable()

View license
private static Hashtable copyHashTable(Hashtable paramsMap) {
    Hashtable newTable = new Hashtable();
    Enumeration keys = paramsMap.keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        newTable.put(key, paramsMap.get(key));
    }
    return newTable;
}

76. X509CRLObject#loadCRLEntries()

Project: bc-java
Source File: X509CRLObject.java
View license
private Set loadCRLEntries() {
    Set entrySet = new HashSet();
    Enumeration certs = c.getRevokedCertificateEnumeration();
    // the issuer
    X500Name previousCertificateIssuer = null;
    while (certs.hasMoreElements()) {
        TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry) certs.nextElement();
        X509CRLEntryObject crlEntry = new X509CRLEntryObject(entry, isIndirect, previousCertificateIssuer);
        entrySet.add(crlEntry);
        if (isIndirect && entry.hasExtensions()) {
            Extension currentCaName = entry.getExtensions().getExtension(Extension.certificateIssuer);
            if (currentCaName != null) {
                previousCertificateIssuer = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName());
            }
        }
    }
    return entrySet;
}

77. X509CRLObject#loadCRLEntries()

Project: bc-java
Source File: X509CRLObject.java
View license
private Set loadCRLEntries() {
    Set entrySet = new HashSet();
    Enumeration certs = c.getRevokedCertificateEnumeration();
    // the issuer
    X500Name previousCertificateIssuer = null;
    while (certs.hasMoreElements()) {
        TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry) certs.nextElement();
        X509CRLEntryObject crlEntry = new X509CRLEntryObject(entry, isIndirect, previousCertificateIssuer);
        entrySet.add(crlEntry);
        if (isIndirect && entry.hasExtensions()) {
            Extension currentCaName = entry.getExtensions().getExtension(Extension.certificateIssuer);
            if (currentCaName != null) {
                previousCertificateIssuer = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName());
            }
        }
    }
    return entrySet;
}

78. X509Util#getAlgNames()

Project: bc-java
Source File: X509Util.java
View license
static Iterator getAlgNames() {
    Enumeration e = algorithms.keys();
    List l = new ArrayList();
    while (e.hasMoreElements()) {
        l.add(e.nextElement());
    }
    return l.iterator();
}

79. X509CRLObject#loadCRLEntries()

Project: bc-java
Source File: X509CRLObject.java
View license
private Set loadCRLEntries() {
    Set entrySet = new HashSet();
    Enumeration certs = c.getRevokedCertificateEnumeration();
    X500Name previousCertificateIssuer = c.getIssuer();
    while (certs.hasMoreElements()) {
        TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry) certs.nextElement();
        X509CRLEntryObject crlEntry = new X509CRLEntryObject(entry, isIndirect, previousCertificateIssuer);
        entrySet.add(crlEntry);
        if (isIndirect && entry.hasExtensions()) {
            Extension currentCaName = entry.getExtensions().getExtension(Extension.certificateIssuer);
            if (currentCaName != null) {
                previousCertificateIssuer = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName());
            }
        }
    }
    return entrySet;
}

80. X509Util#getAlgNames()

Project: bc-java
Source File: X509Util.java
View license
static Iterator getAlgNames() {
    Enumeration e = algorithms.keys();
    List l = new ArrayList();
    while (e.hasMoreElements()) {
        l.add(e.nextElement());
    }
    return l.iterator();
}

81. X509CRLObject#loadCRLEntries()

Project: bc-java
Source File: X509CRLObject.java
View license
private Set loadCRLEntries() {
    Set entrySet = new HashSet();
    Enumeration certs = c.getRevokedCertificateEnumeration();
    X500Name previousCertificateIssuer = c.getIssuer();
    while (certs.hasMoreElements()) {
        TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry) certs.nextElement();
        X509CRLEntryObject crlEntry = new X509CRLEntryObject(entry, isIndirect, previousCertificateIssuer);
        entrySet.add(crlEntry);
        if (isIndirect && entry.hasExtensions()) {
            Extension currentCaName = entry.getExtensions().getExtension(Extension.certificateIssuer);
            if (currentCaName != null) {
                previousCertificateIssuer = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName());
            }
        }
    }
    return entrySet;
}

82. X509CRLObject#loadCRLEntries()

Project: bc-java
Source File: X509CRLObject.java
View license
private Set loadCRLEntries() {
    Set entrySet = new HashSet();
    Enumeration certs = c.getRevokedCertificateEnumeration();
    X500Name previousCertificateIssuer = c.getIssuer();
    while (certs.hasMoreElements()) {
        TBSCertList.CRLEntry entry = (TBSCertList.CRLEntry) certs.nextElement();
        X509CRLEntryObject crlEntry = new X509CRLEntryObject(entry, isIndirect, previousCertificateIssuer);
        entrySet.add(crlEntry);
        if (isIndirect && entry.hasExtensions()) {
            Extension currentCaName = entry.getExtensions().getExtension(Extension.certificateIssuer);
            if (currentCaName != null) {
                previousCertificateIssuer = X500Name.getInstance(GeneralNames.getInstance(currentCaName.getParsedValue()).getNames()[0].getName());
            }
        }
    }
    return entrySet;
}

83. X509Util#getAlgNames()

Project: bc-java
Source File: X509Util.java
View license
static Iterator getAlgNames() {
    Enumeration e = algorithms.keys();
    List l = new ArrayList();
    while (e.hasMoreElements()) {
        l.add(e.nextElement());
    }
    return l.iterator();
}

84. JceTestUtil#getRegisteredAlgorithms()

Project: bc-java
Source File: JceTestUtil.java
View license
static String[] getRegisteredAlgorithms(String prefix, String[] exclusionPatterns) {
    final BouncyCastleProvider prov = (BouncyCastleProvider) Security.getProvider("BC");
    List matches = new ArrayList();
    Enumeration algos = prov.keys();
    while (algos.hasMoreElements()) {
        String algo = (String) algos.nextElement();
        if (!algo.startsWith(prefix)) {
            continue;
        }
        String algoName = algo.substring(prefix.length());
        if (!isExcluded(algoName, exclusionPatterns)) {
            matches.add(algoName);
        }
    }
    return (String[]) matches.toArray(new String[matches.size()]);
}

85. ASN1Sequence#hashCode()

Project: bitcoin-android
Source File: ASN1Sequence.java
View license
public int hashCode() {
    Enumeration e = this.getObjects();
    int hashCode = size();
    while (e.hasMoreElements()) {
        Object o = e.nextElement();
        hashCode *= 17;
        if (o != null) {
            hashCode ^= o.hashCode();
        }
    }
    return hashCode;
}

86. ASN1Set#hashCode()

Project: bitcoin-android
Source File: ASN1Set.java
View license
public int hashCode() {
    Enumeration e = this.getObjects();
    int hashCode = size();
    while (e.hasMoreElements()) {
        Object o = e.nextElement();
        hashCode *= 17;
        if (o != null) {
            hashCode ^= o.hashCode();
        }
    }
    return hashCode;
}

87. AttributeTable#copyTable()

Project: bitcoin-android
Source File: AttributeTable.java
View license
private Hashtable copyTable(Hashtable in) {
    Hashtable out = new Hashtable();
    Enumeration e = in.keys();
    while (e.hasMoreElements()) {
        Object key = e.nextElement();
        out.put(key, in.get(key));
    }
    return out;
}

88. DERConstructedSequence#encode()

View license
/*
     * A note on the implementation:
     * <p>
     * As DER requires the constructed, definite-length model to
     * be used for structured types, this varies slightly from the
     * ASN.1 descriptions given. Rather than just outputing SEQUENCE,
     * we also have to specify CONSTRUCTED, and the objects length.
     */
void encode(DEROutputStream out) throws IOException {
    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    DEROutputStream dOut = new DEROutputStream(bOut);
    Enumeration e = this.getObjects();
    while (e.hasMoreElements()) {
        Object obj = e.nextElement();
        dOut.writeObject(obj);
    }
    dOut.close();
    byte[] bytes = bOut.toByteArray();
    out.writeEncoded(SEQUENCE | CONSTRUCTED, bytes);
}

89. DERConstructedSet#encode()

View license
/*
     * A note on the implementation:
     * <p>
     * As DER requires the constructed, definite-length model to
     * be used for structured types, this varies slightly from the
     * ASN.1 descriptions given. Rather than just outputing SET,
     * we also have to specify CONSTRUCTED, and the objects length.
     */
void encode(DEROutputStream out) throws IOException {
    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    DEROutputStream dOut = new DEROutputStream(bOut);
    Enumeration e = this.getObjects();
    while (e.hasMoreElements()) {
        Object obj = e.nextElement();
        dOut.writeObject(obj);
    }
    dOut.close();
    byte[] bytes = bOut.toByteArray();
    out.writeEncoded(SET | CONSTRUCTED, bytes);
}

90. DERSequence#encode()

Project: bitcoin-android
Source File: DERSequence.java
View license
/*
     * A note on the implementation:
     * <p>
     * As DER requires the constructed, definite-length model to
     * be used for structured types, this varies slightly from the
     * ASN.1 descriptions given. Rather than just outputing SEQUENCE,
     * we also have to specify CONSTRUCTED, and the objects length.
     */
void encode(DEROutputStream out) throws IOException {
    // TODO Intermediate buffer could be avoided if we could calculate expected length
    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    DEROutputStream dOut = new DEROutputStream(bOut);
    Enumeration e = this.getObjects();
    while (e.hasMoreElements()) {
        Object obj = e.nextElement();
        dOut.writeObject(obj);
    }
    dOut.close();
    byte[] bytes = bOut.toByteArray();
    out.writeEncoded(SEQUENCE | CONSTRUCTED, bytes);
}

91. DERSet#encode()

Project: bitcoin-android
Source File: DERSet.java
View license
/*
     * A note on the implementation:
     * <p>
     * As DER requires the constructed, definite-length model to
     * be used for structured types, this varies slightly from the
     * ASN.1 descriptions given. Rather than just outputing SET,
     * we also have to specify CONSTRUCTED, and the objects length.
     */
void encode(DEROutputStream out) throws IOException {
    // TODO Intermediate buffer could be avoided if we could calculate expected length
    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    DEROutputStream dOut = new DEROutputStream(bOut);
    Enumeration e = this.getObjects();
    while (e.hasMoreElements()) {
        Object obj = e.nextElement();
        dOut.writeObject(obj);
    }
    dOut.close();
    byte[] bytes = bOut.toByteArray();
    out.writeEncoded(SET | CONSTRUCTED, bytes);
}

92. ECPrivateKeyStructure#getObjectInTag()

View license
private ASN1Object getObjectInTag(int tagNo) {
    Enumeration e = seq.getObjects();
    while (e.hasMoreElements()) {
        DEREncodable obj = (DEREncodable) e.nextElement();
        if (obj instanceof ASN1TaggedObject) {
            ASN1TaggedObject tag = (ASN1TaggedObject) obj;
            if (tag.getTagNo() == tagNo) {
                return (ASN1Object) ((DEREncodable) tag.getObject()).getDERObject();
            }
        }
    }
    return null;
}

93. SubjectDirectoryAttributes#toASN1Object()

View license
/**
     * Produce an object suitable for an ASN1OutputStream.
     * 
     * Returns:
     * 
     * <pre>
     *      SubjectDirectoryAttributes ::= Attributes
     *      Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
     *      Attribute ::= SEQUENCE 
     *      {
     *        type AttributeType 
     *        values SET OF AttributeValue 
     *      }
     *      
     *      AttributeType ::= OBJECT IDENTIFIER
     *      AttributeValue ::= ANY DEFINED BY AttributeType
     * </pre>
     * 
     * @return a DERObject
     */
public DERObject toASN1Object() {
    ASN1EncodableVector vec = new ASN1EncodableVector();
    Enumeration e = attributes.elements();
    while (e.hasMoreElements()) {
        vec.add((Attribute) e.nextElement());
    }
    return new DERSequence(vec);
}

94. X509Extensions#toASN1Object()

Project: bitcoin-android
Source File: X509Extensions.java
View license
/**
     * <pre>
     *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
     *
     *     Extension         ::=   SEQUENCE {
     *        extnId            EXTENSION.&id ({ExtensionSet}),
     *        critical          BOOLEAN DEFAULT FALSE,
     *        extnValue         OCTET STRING }
     * </pre>
     */
public DERObject toASN1Object() {
    ASN1EncodableVector vec = new ASN1EncodableVector();
    Enumeration e = ordering.elements();
    while (e.hasMoreElements()) {
        DERObjectIdentifier oid = (DERObjectIdentifier) e.nextElement();
        X509Extension ext = (X509Extension) extensions.get(oid);
        ASN1EncodableVector v = new ASN1EncodableVector();
        v.add(oid);
        if (ext.isCritical()) {
            v.add(new DERBoolean(true));
        }
        v.add(ext.getValue());
        vec.add(new DERSequence(v));
    }
    return new DERSequence(vec);
}

95. X509Extensions#equivalent()

Project: bitcoin-android
Source File: X509Extensions.java
View license
public boolean equivalent(X509Extensions other) {
    if (extensions.size() != other.extensions.size()) {
        return false;
    }
    Enumeration e1 = extensions.keys();
    while (e1.hasMoreElements()) {
        Object key = e1.nextElement();
        if (!extensions.get(key).equals(other.extensions.get(key))) {
            return false;
        }
    }
    return true;
}

96. LoggingConfiguration#closeNonexistingAsyncAppenders()

Project: blitz4j
Source File: LoggingConfiguration.java
View license
/**
     * Closes any asynchronous appenders that were not removed during configuration.
     */
private void closeNonexistingAsyncAppenders() {
    org.apache.log4j.Logger rootLogger = LogManager.getRootLogger();
    if (NFLockFreeLogger.class.isInstance(rootLogger)) {
        ((NFLockFreeLogger) rootLogger).reconcileAppenders();
    }
    Enumeration enums = LogManager.getCurrentLoggers();
    while (enums.hasMoreElements()) {
        Object myLogger = enums.nextElement();
        if (NFLockFreeLogger.class.isInstance(myLogger)) {
            ((NFLockFreeLogger) myLogger).reconcileAppenders();
        }
    }
}

97. Forward#init()

Project: browsermob-proxy
Source File: Forward.java
View license
/* ------------------------------------------------------------ */
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    Enumeration enm = config.getInitParameterNames();
    while (enm.hasMoreElements()) {
        String path = (String) enm.nextElement();
        String forward = config.getInitParameter(path);
        _forwardMap.put(path, forward);
    }
}

98. EchoServlet#service()

Project: browsermob-proxy
Source File: EchoServlet.java
View license
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.setStatus(200);
    PrintWriter writer = resp.getWriter();
    writer.println("Method: " + req.getMethod());
    writer.println("Request Headers:");
    Enumeration headerNames = req.getHeaderNames();
    while (headerNames.hasMoreElements()) {
        String hdr = (String) headerNames.nextElement();
        Enumeration headers = req.getHeaders(hdr);
        while (headers.hasMoreElements()) {
            String val = (String) headers.nextElement();
            writer.println(hdr + ": " + val);
        }
    }
    writer.close();
}

99. CamelKarafTestSupport#explode()

Project: camel
Source File: CamelKarafTestSupport.java
View license
/*
    * Explode the dictionary into a ,-delimited list of key=value pairs
    */
private static String explode(Dictionary dictionary) {
    Enumeration keys = dictionary.keys();
    StringBuilder sb = new StringBuilder();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        sb.append(String.format("%s=%s", key, dictionary.get(key)));
        if (keys.hasMoreElements()) {
            sb.append(", ");
        }
    }
    return sb.toString();
}

100. AbstractPreferencePanel#notifyOfLookAndFeelChange()

View license
public void notifyOfLookAndFeelChange() {
    SwingUtilities.updateComponentTreeUI(this);
    Enumeration enumeration = ((DefaultMutableTreeNode) prefTree.getModel().getRoot()).breadthFirstEnumeration();
    while (enumeration.hasMoreElements()) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) enumeration.nextElement();
        if (node.getUserObject() instanceof Component) {
            Component c = (Component) node.getUserObject();
            SwingUtilities.updateComponentTreeUI(c);
        }
    }
}