java.util.Enumeration

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

1. 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);
}

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. 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);
            }
        }
    }
}

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. 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);
}

9. 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();
}

10. 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);
}

11. 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();
    }
}

12. 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
	 * {@link 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;
}

13. 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;
}

14. 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;
}

15. 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());
    }
}

16. 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();
}

17. 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();
}

18. 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();
}

19. 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();
}

20. 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();
}

21. 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();
}

22. 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());
    }
}

23. 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()));
}

24. 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());
}

25. 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());
        }
    }
}

26. 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 {@link 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. JarFileClassLoader#findResources()

View license
/**
     * {@inheritDoc}
     */
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;
}

28. 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);
}

29. 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);
}

30. IntKeyMap#toString()

Project: scouter
Source File: IntKeyMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        IntKeyEntry e = (IntKeyEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

31. PropertyResourceBundleTest#test_getKeys()

View license
/**
     * java.util.PropertyResourceBundle#getKeys()
     */
@SuppressWarnings("unchecked")
public void test_getKeys() {
    Enumeration keyEnum = prb.getKeys();
    Vector test = new Vector();
    int keyCount = 0;
    while (keyEnum.hasMoreElements()) {
        test.addElement(keyEnum.nextElement());
        keyCount++;
    }
    assertEquals("Returned the wrong number of keys", 2, keyCount);
    assertTrue("Returned the wrong keys", test.contains("p1") && test.contains("p2"));
}

32. IntLongLinkedMap#toString()

Project: scouter
Source File: IntLongLinkedMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        IntLongLinkedEntry e = (IntLongLinkedEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

33. LongFloatLinkedMap#toString()

Project: scouter
Source File: LongFloatLinkedMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        LongFloatLinkedEntry e = (LongFloatLinkedEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

34. LongIntLinkedMap#toString()

Project: scouter
Source File: LongIntLinkedMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        LongIntLinkedEntry e = (LongIntLinkedEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

35. LongIntMap#toString()

Project: scouter
Source File: LongIntMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        LongIntEntry e = (LongIntEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

36. LongKeyLinkedMap#toString()

Project: scouter
Source File: LongKeyLinkedMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        LongKeyLinkedEntry e = (LongKeyLinkedEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

37. LongKeyMap#toString()

Project: scouter
Source File: LongKeyMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        LongKeyEntry e = (LongKeyEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

38. LongLongLinkedMap#toString()

Project: scouter
Source File: LongLongLinkedMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        LongLongLinkedEntry e = (LongLongLinkedEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

39. StringHashCacheMap#toString()

Project: scouter
Source File: StringHashCacheMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = myEntries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        ENTRY e = (ENTRY) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

40. StringHashCacheMap#toFormatString()

Project: scouter
Source File: StringHashCacheMap.java
View license
public String toFormatString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = myEntries();
    buf.append("{\n");
    while (it.hasMoreElements()) {
        ENTRY e = (ENTRY) it.nextElement();
        buf.append("\t").append(e.getKey() + "=" + e.getValue()).append("\n");
    }
    buf.append("}");
    return buf.toString();
}

41. StringIntLinkedMap#toString()

Project: scouter
Source File: StringIntLinkedMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        StringIntLinkedEntry e = (StringIntLinkedEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

42. StringIntMap#toString()

Project: scouter
Source File: StringIntMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        StringIntEntry e = (StringIntEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

43. StringKeyLinkedMap#toString()

Project: scouter
Source File: StringKeyLinkedMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        StringKeyLinkedEntry e = (StringKeyLinkedEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

44. StringLongLinkedMap#toString()

Project: scouter
Source File: StringLongLinkedMap.java
View license
public String toString() {
    StringBuffer buf = new StringBuffer();
    Enumeration it = entries();
    buf.append("{");
    for (int i = 0; it.hasMoreElements(); i++) {
        StringLongLinkedEntry e = (StringLongLinkedEntry) (it.nextElement());
        if (i > 0)
            buf.append(", ");
        buf.append(e.getKey() + "=" + e.getValue());
    }
    buf.append("}");
    return buf.toString();
}

45. Catalog#copyReaders()

Project: servicemix-bundles
Source File: Catalog.java
View license
/**
   * Copies the reader list from the current Catalog to a new Catalog.
   *
   * <p>This method is used internally when constructing a new catalog.
   * It copies the current reader associations over to the new catalog.
   * </p>
   *
   * @param newCatalog The new Catalog.
   */
protected void copyReaders(Catalog newCatalog) {
    // Have to copy the readers in the right order...convert hash to arr
    Vector mapArr = new Vector(readerMap.size());
    // Pad the mapArr out to the right length
    for (int count = 0; count < readerMap.size(); count++) {
        mapArr.add(null);
    }
    Enumeration en = readerMap.keys();
    while (en.hasMoreElements()) {
        String mimeType = (String) en.nextElement();
        Integer pos = (Integer) readerMap.get(mimeType);
        mapArr.set(pos.intValue(), mimeType);
    }
    for (int count = 0; count < mapArr.size(); count++) {
        String mimeType = (String) mapArr.get(count);
        Integer pos = (Integer) readerMap.get(mimeType);
        newCatalog.addReader(mimeType, (CatalogReader) readerArr.get(pos.intValue()));
    }
}

46. Catalog#resolveDocument()

Project: servicemix-bundles
Source File: Catalog.java
View license
/**
   * Return the applicable DOCUMENT entry.
   *
   * @return The system identifier to use for the doctype.
   *
   * @throws MalformedURLException The formal system identifier of a
   * subordinate catalog cannot be turned into a valid URL.
   * @throws IOException Error reading subordinate catalog file.
   */
public String resolveDocument() throws MalformedURLException, IOException {
    // If there's a DOCUMENT entry, return it
    catalogManager.debug.message(3, "resolveDocument");
    Enumeration en = catalogEntries.elements();
    while (en.hasMoreElements()) {
        CatalogEntry e = (CatalogEntry) en.nextElement();
        if (e.getEntryType() == DOCUMENT) {
            return e.getEntryArg(0);
        }
    }
    return resolveSubordinateCatalogs(DOCUMENT, null, null, null);
}

47. Catalog#copyReaders()

Project: servicemix4-bundles
Source File: Catalog.java
View license
/**
   * Copies the reader list from the current Catalog to a new Catalog.
   *
   * <p>This method is used internally when constructing a new catalog.
   * It copies the current reader associations over to the new catalog.
   * </p>
   *
   * @param newCatalog The new Catalog.
   */
protected void copyReaders(Catalog newCatalog) {
    // Have to copy the readers in the right order...convert hash to arr
    Vector mapArr = new Vector(readerMap.size());
    // Pad the mapArr out to the right length
    for (int count = 0; count < readerMap.size(); count++) {
        mapArr.add(null);
    }
    Enumeration en = readerMap.keys();
    while (en.hasMoreElements()) {
        String mimeType = (String) en.nextElement();
        Integer pos = (Integer) readerMap.get(mimeType);
        mapArr.set(pos.intValue(), mimeType);
    }
    for (int count = 0; count < mapArr.size(); count++) {
        String mimeType = (String) mapArr.get(count);
        Integer pos = (Integer) readerMap.get(mimeType);
        newCatalog.addReader(mimeType, (CatalogReader) readerArr.get(pos.intValue()));
    }
}

48. Catalog#resolveDocument()

Project: servicemix4-bundles
Source File: Catalog.java
View license
/**
   * Return the applicable DOCUMENT entry.
   *
   * @return The system identifier to use for the doctype.
   *
   * @throws MalformedURLException The formal system identifier of a
   * subordinate catalog cannot be turned into a valid URL.
   * @throws IOException Error reading subordinate catalog file.
   */
public String resolveDocument() throws MalformedURLException, IOException {
    // If there's a DOCUMENT entry, return it
    catalogManager.debug.message(3, "resolveDocument");
    Enumeration en = catalogEntries.elements();
    while (en.hasMoreElements()) {
        CatalogEntry e = (CatalogEntry) en.nextElement();
        if (e.getEntryType() == DOCUMENT) {
            return e.getEntryArg(0);
        }
    }
    return resolveSubordinateCatalogs(DOCUMENT, null, null, null);
}

49. Headers#printHeaders()

Project: servicemix4-kernel
Source File: Headers.java
View license
protected void printHeaders(Bundle bundle) throws Exception {
    String title = Util.getBundleName(bundle);
    io.out.println("\n" + title);
    io.out.println(Util.getUnderlineString(title));
    Dictionary dict = bundle.getHeaders();
    Enumeration keys = dict.keys();
    while (keys.hasMoreElements()) {
        Object k = (String) keys.nextElement();
        Object v = dict.get(k);
        io.out.println(k + " = " + Util.getValueString(v));
    }
}

50. ActionServlet#initModulePrefixes()

Project: sonarqube
Source File: ActionServlet.java
View license
/**
     * <p>Saves a String[] of module prefixes in the ServletContext under
     * Globals.MODULE_PREFIXES_KEY.  <strong>NOTE</strong> - the "" prefix for
     * the default module is not included in this list.</p>
     *
     * @param context The servlet context.
     * @since Struts 1.2
     */
protected void initModulePrefixes(ServletContext context) {
    ArrayList prefixList = new ArrayList();
    Enumeration names = context.getAttributeNames();
    while (names.hasMoreElements()) {
        String name = (String) names.nextElement();
        if (!name.startsWith(Globals.MODULE_KEY)) {
            continue;
        }
        String prefix = name.substring(Globals.MODULE_KEY.length());
        if (prefix.length() > 0) {
            prefixList.add(prefix);
        }
    }
    String[] prefixes = (String[]) prefixList.toArray(new String[prefixList.size()]);
    context.setAttribute(Globals.MODULE_PREFIXES_KEY, prefixes);
}

51. BaseConfig#inheritProperties()

Project: sonarqube
Source File: BaseConfig.java
View license
/**
     * <p>Compare the properties of this config with that of the given and
     * copy those that are not present.  This method is used by subclasses
     * that support configuration inheritance.</p>
     *
     * @param baseConfig The config object to copy properties from.
     */
protected void inheritProperties(BaseConfig baseConfig) {
    throwIfConfigured();
    // Inherit forward properties
    Properties baseProperties = baseConfig.getProperties();
    Enumeration keys = baseProperties.propertyNames();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        // Check if we have this property before copying it
        String value = this.getProperty(key);
        if (value == null) {
            value = baseProperties.getProperty(key);
            setProperty(key, value);
        }
    }
}

52. BaseConfig#copyProperties()

Project: sonarqube
Source File: BaseConfig.java
View license
/**
     * <p>Return a copy of the properties held by this object.</p>
     */
protected Properties copyProperties() {
    Properties copy = new Properties();
    Enumeration keys = properties.propertyNames();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        copy.setProperty(key, properties.getProperty(key));
    }
    return copy;
}

53. MultipartRequestWrapper#getParameterNames()

View license
/**
     * <p> Returns the names of the parameters for this request. The
     * enumeration consists of the normal request parameter names plus the
     * parameters read from the multipart request </p>
     */
public Enumeration getParameterNames() {
    Enumeration baseParams = getRequest().getParameterNames();
    Vector list = new Vector();
    while (baseParams.hasMoreElements()) {
        list.add(baseParams.nextElement());
    }
    Collection multipartParams = parameters.keySet();
    Iterator iterator = multipartParams.iterator();
    while (iterator.hasNext()) {
        list.add(iterator.next());
    }
    return Collections.enumeration(list);
}

54. DistCache#findContainingJar()

Project: crunch
Source File: DistCache.java
View license
/**
   * Finds the path to a jar that contains the class provided, if any. There is no guarantee that
   * the jar returned will be the first on the classpath to contain the file. This method is
   * basically lifted out of Hadoop's {@link org.apache.hadoop.mapred.JobConf} class.
   *
   * @param jarClass The class the jar file should contain.
   * @return The path to a jar file that contains the class, or <code>null</code> if no such jar
   *     exists.
   * @throws IOException If there is a problem searching for the jar file.
   */
public static String findContainingJar(Class jarClass) throws IOException {
    ClassLoader loader = jarClass.getClassLoader();
    String classFile = jarClass.getName().replaceAll("\\.", "/") + ".class";
    for (Enumeration itr = loader.getResources(classFile); itr.hasMoreElements(); ) {
        URL url = (URL) itr.nextElement();
        if ("jar".equals(url.getProtocol())) {
            String toReturn = url.getPath();
            if (toReturn.startsWith("file:")) {
                toReturn = toReturn.substring("file:".length());
            }
            // URLDecoder is a misnamed class, since it actually decodes
            // x-www-form-urlencoded MIME type rather than actual
            // URL encoding (which the file path has). Therefore it would
            // decode +s to ' 's which is incorrect (spaces are actually
            // either unencoded or encoded as "%20"). Replace +s first, so
            // that they are kept sacred during the decoding process.
            toReturn = toReturn.replaceAll("\\+", "%2B");
            toReturn = URLDecoder.decode(toReturn, "UTF-8");
            return toReturn.replaceAll("!.*$", "");
        }
    }
    return null;
}

55. HTTPMUSocket#getLocalAddress()

Project: cybergarage-upnp
Source File: HTTPMUSocket.java
View license
////////////////////////////////////////////////
//	bindAddr
////////////////////////////////////////////////
public String getLocalAddress() {
    if (ssdpMultiGroup == null || ssdpMultiIf == null)
        return "";
    InetAddress mcastAddr = ssdpMultiGroup.getAddress();
    Enumeration addrs = ssdpMultiIf.getInetAddresses();
    while (addrs.hasMoreElements()) {
        InetAddress addr = (InetAddress) addrs.nextElement();
        if (mcastAddr instanceof Inet6Address && addr instanceof Inet6Address)
            return addr.getHostAddress();
        if (mcastAddr instanceof Inet4Address && addr instanceof Inet4Address)
            return addr.getHostAddress();
    }
    return "";
}

56. Database#appendAttrString()

Project: derby
Source File: Database.java
View license
// Create string to pass to DataSource.setConnectionAttributes
String appendAttrString(Properties p) {
    if (p == null)
        return null;
    Enumeration pKeys = p.propertyNames();
    while (pKeys.hasMoreElements()) {
        String key = (String) pKeys.nextElement();
        attrString += ";" + key + "=" + p.getProperty(key);
    }
    return attrString;
}

57. PropertyValidation#verifyPropertySet()

Project: derby
Source File: PropertyValidation.java
View license
public synchronized void verifyPropertySet(Properties p, Properties ignore) throws StandardException {
    for (Enumeration e = p.propertyNames(); e.hasMoreElements(); ) {
        String pn = (String) e.nextElement();
        //Ignore the ones we are told to ignore.
        if (ignore.getProperty(pn) != null)
            continue;
        Serializable pv = p.getProperty(pn);
        validateSingleProperty(pn, pv, p);
    }
}

58. DataDictionaryImpl#createSPSSet()

Project: derby
Source File: DataDictionaryImpl.java
View license
/**
		Create a set of stored prepared statements from a properties file.
		Key is the statement name, value is the SQL statement.
	*/
protected void createSPSSet(TransactionController tc, boolean net, UUID schemaID) throws StandardException {
    Properties p = getQueryDescriptions(net);
    Enumeration e = p.keys();
    //statement will get compiled on first execution
    //Note: Don't change this to FALSE LCC is not available for compiling
    boolean nocompile = true;
    while (e.hasMoreElements()) {
        String spsName = (String) e.nextElement();
        String spsText = p.getProperty(spsName);
        SPSDescriptor spsd = new SPSDescriptor(this, spsName, getUUIDFactory().createUUID(), schemaID, schemaID, SPSDescriptor.SPS_TYPE_REGULAR, // it is valid, unless nocompile
        !nocompile, //sps text
        spsText, !nocompile);
        addSPSDescriptor(spsd, tc);
    }
}

59. RunList#setSpecialProps()

Project: derby
Source File: RunList.java
View license
private static void setSpecialProps(Properties p, boolean isTop) {
    // Just build  string for RunTest to parse (^ is the separator)
    // and determine which special flags are for ij or for server
    // These special flags come from specialProperties, not from
    // the usual properties (RunSuite will give these for the top suite)
    String tmp = "";
    for (Enumeration e = p.propertyNames(); e.hasMoreElements(); ) {
        String key = (String) e.nextElement();
        // Note: RunSuite will already have excluded
        // suites, useoutput, usesystem,keepfiles from these
        tmp += key + "=" + p.getProperty(key) + "^";
    }
    if (tmp.length() > 0) {
        if (// This is the top level suite
        isTop == true)
            topSpecialProps = tmp.substring(0, tmp.lastIndexOf('^'));
        else
            // This is a nested suite, do not apply to all the suites
            otherSpecialProps = tmp.substring(0, tmp.lastIndexOf('^'));
    }
}

60. DriverUnloader#unload()

Project: derby
Source File: DriverUnloader.java
View license
/**
     * Deregister all Derby drivers accessible from the class loader in which
     * this class lives.
     *
     * @return {@code true} if a driver was unloaded, {@code false} otherwise
     */
public static boolean unload() throws SQLException {
    boolean ret = false;
    Enumeration e = DriverManager.getDrivers();
    while (e.hasMoreElements()) {
        Driver driver = (Driver) e.nextElement();
        if (driver.getClass().getName().startsWith("org.apache.derby.")) {
            DriverManager.deregisterDriver(driver);
            ret = true;
        }
    }
    return ret;
}

61. TestConfiguration#getConnectionAttributesString()

Project: derby
Source File: TestConfiguration.java
View license
/**
     * Get a flat string representation of the connection attributes. To
     * be used in the connectionAttributes property of a data source.
     *
     * @return all connection attributes concatenated ({@code null} if there
     * are no attributes)
     */
String getConnectionAttributesString() {
    StringBuffer sb = new StringBuffer();
    Enumeration e = connectionAttributes.propertyNames();
    boolean first = true;
    while (e.hasMoreElements()) {
        if (!first) {
            sb.append(';');
        }
        String key = (String) e.nextElement();
        sb.append(key);
        sb.append('=');
        sb.append(connectionAttributes.getProperty(key));
        first = false;
    }
    if (first) {
        // No connection attributes.
        return null;
    }
    return sb.toString();
}

62. mtTestSuite#loadCases()

Project: derby
Source File: mtTestSuite.java
View license
/**
	** @return boolean indicates if there was a problem loading
	** 	the file
	*/
private boolean loadCases(Vector cases) {
    if (cases == null)
        return false;
    boolean gotError = false;
    Enumeration e = cases.elements();
    mtTestCase tcase;
    while (e.hasMoreElements()) {
        tcase = (mtTestCase) e.nextElement();
        try {
            tcase.initialize(rootDir);
        } catch (Throwable t) {
            gotError = true;
        }
    }
    return gotError;
}

63. ASN1Sequence#hashCode()

View license
public int hashCode() {
    Enumeration e = this.getObjects();
    int hashCode = 0;
    while (e.hasMoreElements()) {
        Object o = e.nextElement();
        if (o != null) {
            hashCode ^= o.hashCode();
        }
    }
    return hashCode;
}

64. ASN1Set#hashCode()

Project: Direct-File-Downloader
Source File: ASN1Set.java
View license
public int hashCode() {
    Enumeration e = this.getObjects();
    int hashCode = 0;
    while (e.hasMoreElements()) {
        hashCode ^= e.nextElement().hashCode();
    }
    return hashCode;
}

65. 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);
}

66. 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);
}

67. DERSequence#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);
}

68. DERSet#encode()

Project: Direct-File-Downloader
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 {
    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);
}

69. 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;
}

70. 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);
}

71. X509Extensions#toASN1Object()

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);
}

72. X509Extensions#equivalent()

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;
}

73. X509Name#hashCode()

View license
public int hashCode() {
    ASN1Sequence seq = (ASN1Sequence) this.getDERObject();
    Enumeration e = seq.getObjects();
    int hashCode = 0;
    while (e.hasMoreElements()) {
        hashCode ^= e.nextElement().hashCode();
    }
    return hashCode;
}

74. DirectMemoryOsgiTestSupport#explode()

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

75. EnumerationSerializer#writeObject()

Project: dubbo
Source File: EnumerationSerializer.java
View license
public void writeObject(Object obj, AbstractHessianOutput out) throws IOException {
    Enumeration iter = (Enumeration) obj;
    boolean hasEnd = out.writeListBegin(-1, null);
    while (iter.hasMoreElements()) {
        Object value = iter.nextElement();
        out.writeObject(value);
    }
    if (hasEnd)
        out.writeListEnd();
}

76. LoggingResetter#resetRootLogLevel()

Project: eucalyptus
Source File: LoggingResetter.java
View license
private static void resetRootLogLevel(Logger rootLogger, SmallLoggingConfiguration smallLoggingConfiguration) {
    if (rootLogger == null) {
        throw new IllegalArgumentException("root logger is null");
    }
    Level level = smallLoggingConfiguration.rootLogLevel;
    if (level != null) {
        LOG.debug("Resetting root logger level to " + level);
        rootLogger.setLevel(level);
    } else {
        LOG.debug("Root logger level unspecified, leaving as is.");
    }
    Enumeration appenders = rootLogger.getAllAppenders();
    while (appenders.hasMoreElements()) {
        resetLogLevel((Appender) appenders.nextElement(), smallLoggingConfiguration);
    }
}

77. LoggingResetter#resetLogLevel()

Project: eucalyptus
Source File: LoggingResetter.java
View license
private static void resetLogLevel(Logger logger, SmallLoggingConfiguration smallLoggingConfiguration) {
    if (logger == null) {
        throw new IllegalArgumentException("logger is null");
    }
    String name = logger.getName();
    if (name == null) {
        throw new IllegalArgumentException("logger name is null");
    }
    Level level = smallLoggingConfiguration.loggerLoggingLevels.get(name);
    if (level != null) {
        LOG.debug("Resetting logger " + name + " level to " + level);
        logger.setLevel(level);
    } else {
        LOG.debug("Logger " + name + " level unspecified, leaving as is.");
    }
    Enumeration appenders = logger.getAllAppenders();
    while (appenders.hasMoreElements()) {
        resetLogLevel((Appender) appenders.nextElement(), smallLoggingConfiguration);
    }
}

78. ExhibitorServletContextListener#applyProperties()

View license
private void applyProperties(Map<String, String> argsBuilder, Properties properties) {
    Enumeration parameterNames = properties.propertyNames();
    while (parameterNames.hasMoreElements()) {
        String name = String.valueOf(parameterNames.nextElement());
        if (name.startsWith(OUR_PREFIX)) {
            String value = properties.getProperty(name);
            String argName = name.substring(OUR_PREFIX.length());
            argsBuilder.put("-" + argName, value);
            log.info(String.format("Setting property %s=%s", argName, value));
        }
    }
}

79. FlexClientConfigService#getAttributes()

View license
public List getAttributes() {
    FlexClient flexClient = FlexContext.getFlexClient();
    List attributes = new ArrayList();
    Enumeration attrNames = flexClient.getAttributeNames();
    while (attrNames.hasMoreElements()) {
        String attrName = (String) attrNames.nextElement();
        attributes.add(new Attribute(attrName, flexClient.getAttribute(attrName)));
    }
    return attributes;
}

80. HTTPRequestLog#outputHeaders()

Project: flex-blazeds
Source File: HTTPRequestLog.java
View license
/**
     * Display the request header.
     */
private static void outputHeaders(FileWriter fw, LoggingHttpServletRequestWrapper req) throws IOException {
    // Get the header
    Enumeration reqHeaderNum = req.getHeaderNames();
    // Do nothing if there is no header
    if (reqHeaderNum == null) {
        fw.write("No headers" + "\n");
        return;
    }
    // Repeat the header element
    while (reqHeaderNum.hasMoreElements()) {
        // Get the key
        String key = (String) reqHeaderNum.nextElement();
        // Output the header information
        outputHeaderElements(fw, req, key);
    }
}

81. HTTPRequestLog#outputHeaderElements()

Project: flex-blazeds
Source File: HTTPRequestLog.java
View license
/**
     * Output header information.
     */
private static void outputHeaderElements(FileWriter fw, LoggingHttpServletRequestWrapper req, String key) throws IOException {
    // Output the header information
    Enumeration e = req.getHeaders(key);
    String keyname = key;
    while (e.hasMoreElements()) {
        fw.write(keyname + " : " + e.nextElement() + "\n");
        // Output key name only for the first time
        keyname = "        ";
    }
}

82. ForrestConfModule#getAttributeNames()

Project: forrest
Source File: ForrestConfModule.java
View license
public Iterator getAttributeNames(Configuration modeConf, Map objectModel) throws ConfigurationException {
    SortedSet matchset = new TreeSet();
    Enumeration enumeration = filteringProperties.keys();
    while (enumeration.hasMoreElements()) {
        String key = (String) enumeration.nextElement();
        matchset.add(key);
    }
    Iterator iterator = super.getAttributeNames(modeConf, objectModel);
    while (iterator.hasNext()) matchset.add(iterator.next());
    return matchset.iterator();
}

83. SolrQueryTransformer#setup()

Project: forrest
Source File: SolrQueryTransformer.java
View license
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException {
    super.setup(resolver, objectModel, src, par);
    this.attributes = new AttributesImpl();
    String userRows = request.getParameter("rows");
    if (null != userRows)
        rows = Integer.parseInt(userRows);
    else
        rows = 10;
    LinkedHashSet set = new LinkedHashSet();
    Enumeration keys = request.getParameterNames();
    while (keys.hasMoreElements()) {
        String element = (String) keys.nextElement();
        if (!"start".equals(element)) {
            String value = (String) request.getParameter(element);
            set.add(element + "=" + value);
        }
    }
    StringBuffer buffer = new StringBuffer();
    for (Iterator iter = set.iterator(); iter.hasNext(); ) {
        String element = (String) iter.next();
        buffer.append(element);
        buffer.append("&");
    }
    queryString = buffer.toString();
}

84. ASN1Sequence#hashCode()

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

85. ASN1Set#hashCode()

Project: geronimo
Source File: ASN1Set.java
View license
public int hashCode() {
    Enumeration e = this.getObjects();
    int hashCode = 0;
    while (e.hasMoreElements()) {
        hashCode ^= e.nextElement().hashCode();
    }
    return hashCode;
}

86. 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);
}

87. DERConstructedSet#encode()

Project: geronimo
Source File: DERConstructedSet.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 {
    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);
}

88. DERSequence#encode()

Project: geronimo
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 {
    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. DERSet#encode()

Project: geronimo
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 {
    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. X509Extensions#toASN1Object()

Project: geronimo
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);
}

91. X509Extensions#hashCode()

Project: geronimo
Source File: X509Extensions.java
View license
public int hashCode() {
    Enumeration e = extensions.keys();
    int hashCode = 0;
    while (e.hasMoreElements()) {
        Object o = e.nextElement();
        hashCode ^= o.hashCode();
        hashCode ^= extensions.get(o).hashCode();
    }
    return hashCode;
}

92. X509Name#hashCode()

Project: geronimo
Source File: X509Name.java
View license
public int hashCode() {
    ASN1Sequence seq = (ASN1Sequence) this.getDERObject();
    Enumeration e = seq.getObjects();
    int hashCode = 0;
    while (e.hasMoreElements()) {
        hashCode ^= e.nextElement().hashCode();
    }
    return hashCode;
}

93. LoggingHelper#addConsoleNDCLogRemoverFilter()

Project: gocd
Source File: LoggingHelper.java
View license
private static void addConsoleNDCLogRemoverFilter() {
    Enumeration allAppenders = Logger.getRootLogger().getAllAppenders();
    while (allAppenders.hasMoreElements()) {
        Appender appender = (Appender) allAppenders.nextElement();
        if (isConsoleNdcAppender(appender)) {
            continue;
        }
        Filter filter = getConsoleNDCFilter(appender);
        if (filter != CONSOLE_NDC_REJECT_FILTER) {
            appender.addFilter(CONSOLE_NDC_REJECT_FILTER);
        }
    }
}

94. AuthSSLKeyManagerFactory#logKeyStore()

Project: gocd
Source File: AuthSSLKeyManagerFactory.java
View license
private void logKeyStore(KeyStore store) throws KeyStoreException {
    LOG.trace("Certificates count: " + store.size());
    Enumeration aliases = store.aliases();
    while (aliases.hasMoreElements()) {
        String alias = (String) aliases.nextElement();
        Certificate[] certs = store.getCertificateChain(alias);
        if (certs != null) {
            LOG.debug("Certificate chain '" + alias + "':");
            for (int c = 0; c < certs.length; c++) {
                if (certs[c] instanceof X509Certificate) {
                    X509Certificate cert = (X509Certificate) certs[c];
                    LOG.trace(" Certificate " + (c + 1) + ":");
                    LOG.trace("  Subject DN: " + cert.getSubjectDN());
                    LOG.trace("  Signature Algorithm: " + cert.getSigAlgName());
                    LOG.trace("  Valid from: " + cert.getNotBefore());
                    LOG.trace("  Valid until: " + cert.getNotAfter());
                    LOG.trace("  Issuer: " + cert.getIssuerDN());
                }
            }
        }
    }
}

95. AuthSSLX509TrustManagerFactory#logKeyStore()

View license
private void logKeyStore(KeyStore store) throws KeyStoreException {
    Enumeration aliases = store.aliases();
    while (aliases.hasMoreElements()) {
        String alias = (String) aliases.nextElement();
        LOG.debug("Trusted certificate '" + alias + "':");
        Certificate trustedcert = store.getCertificate(alias);
        if (trustedcert != null && trustedcert instanceof X509Certificate) {
            X509Certificate cert = (X509Certificate) trustedcert;
            LOG.trace("  Subject DN: " + cert.getSubjectDN());
            LOG.trace("  Signature Algorithm: " + cert.getSigAlgName());
            LOG.trace("  Valid from: " + cert.getNotBefore());
            LOG.trace("  Valid until: " + cert.getNotAfter());
            LOG.trace("  Issuer: " + cert.getIssuerDN());
        }
    }
}

96. HsqlDatabaseProperties#filterLoadedProperties()

Project: h-store
Source File: HsqlDatabaseProperties.java
View license
void filterLoadedProperties() {
    Enumeration en = stringProps.propertyNames();
    while (en.hasMoreElements()) {
        String key = (String) en.nextElement();
        boolean accept = meta.containsKey(key);
        if (!accept) {
            stringProps.remove(key);
        }
    }
}

97. HsqlProperties#addProperties()

Project: h-store
Source File: HsqlProperties.java
View license
public void addProperties(Properties props) {
    if (props == null) {
        return;
    }
    Enumeration keys = props.keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        this.stringProps.put(key, props.get(key));
    }
}

98. ProxyServlet#copyRequestHeader()

View license
/**
   * Copy a request header from the servlet client to the proxy request.
   * This is easily overwritten to filter out certain headers if desired.
   */
protected void copyRequestHeader(HttpServletRequest servletRequest, HttpRequest proxyRequest, String headerName) {
    //Instead the content-length is effectively set via InputStreamEntity
    if (headerName.equalsIgnoreCase(HttpHeaders.CONTENT_LENGTH))
        return;
    if (hopByHopHeaders.containsHeader(headerName))
        return;
    Enumeration headers = servletRequest.getHeaders(headerName);
    while (headers.hasMoreElements()) {
        //sometimes more than one value
        String headerValue = (String) headers.nextElement();
        // the correct virtual server
        if (headerName.equalsIgnoreCase(HttpHeaders.HOST)) {
            HttpHost host = getTargetHost(servletRequest);
            headerValue = host.getHostName();
            if (host.getPort() != -1)
                headerValue += ":" + host.getPort();
        } else if (headerName.equalsIgnoreCase(org.apache.http.cookie.SM.COOKIE)) {
            headerValue = getRealCookie(headerValue);
        }
        proxyRequest.addHeader(headerName, headerValue);
    }
}

99. AdminWhitelistRule#doSubmit()

Project: hudson
Source File: AdminWhitelistRule.java
View license
@RequirePOST
public HttpResponse doSubmit(StaplerRequest req) throws IOException {
    jenkins.checkPermission(Jenkins.RUN_SCRIPTS);
    String whitelist = Util.fixNull(req.getParameter("whitelist"));
    if (!whitelist.endsWith("\n"))
        whitelist += "\n";
    Enumeration e = req.getParameterNames();
    while (e.hasMoreElements()) {
        String name = (String) e.nextElement();
        if (name.startsWith("class:")) {
            whitelist += name.substring(6) + "\n";
        }
    }
    whitelisted.set(whitelist);
    String newRules = Util.fixNull(req.getParameter("filePathRules"));
    // test first before writing a potentially broken rules
    filePathRules.parseTest(newRules);
    filePathRules.set(newRules);
    return HttpResponses.redirectToDot();
}

100. TestReporting#writeReport()

Project: CodenameOne
Source File: TestReporting.java
View license
/**
     * Writes a test report to the given stream
     * @param os the destination stream
     */
public void writeReport(OutputStream os) throws IOException {
    Enumeration e = testsExecuted.elements();
    while (e.hasMoreElements()) {
        String key = (String) e.nextElement();
        Boolean v = (Boolean) testsExecuted.get(key);
        if (v.booleanValue()) {
            os.write((key + " passed\n").getBytes());
        } else {
            os.write((key + " failed\n").getBytes());
        }
    }
}