Results 1 to 2 of 2
  1. #1
    BlankMan is offline Member
    Join Date
    Sep 2008
    Rep Power

    Default Help determing NamingEnumeration type/cast

    It appears I've got a cast problem. Everything was fine using Eclipse Europa, but now Eclipse Ganymede is throwing out warnings for casts. The following is a snapshot of the problem code.

    List<String> appAttrs = new ArrayList<String>();
    Hashtable<String, String> env = new Hashtable<String, String>();
    DirContext dirContext = new InitialDirContext(env);
    Attributes attrs = dirContext.getAttributes(rdn);
    NamingEnumeration Values = attrs.get(appAttr).getAll();

    The above NamingEnumeration is giving the following warning:

    NamingEnumeration is a raw type. References to generic type NamingEnumeration<T> should be parameterized CASLDAPAuthN/src/com/authn line 117 Java Problem

    It wants a cast but I can't figure out which it wants. I've got this in another spot:

    NamingEnumeration<SearchResult> results =,andFilter.encode(),search Controls);

    that works there. But for NamingEnumeration Values SearchResult won't work as the cast, this indirectly references dirContext for Attributes attrs, and I can't cast Attributes so I need to figure out what the correct cast is for NamingEnumeration Values in this case.

    This is the type/cast I think it needs, well at least what the yellow info thingy on the left is telling me: NamingEnumeration<capture#1-of ?> at least that's what the warning is telling me the problem is, but I don't know the correct match.


  2. #2
    BlankMan is offline Member
    Join Date
    Sep 2008
    Rep Power



    This got rid of the warning:

    NamingEnumeration<?> Values = attrs.get(appAttr).getAll();

    Thought I tried that. Oh well. Works now.

Similar Threads

  1. [SOLVED] Cast string type to int type
    By GilaMonster in forum New To Java
    Replies: 9
    Last Post: 09-17-2008, 10:43 AM
  2. class cast exception
    By venkatallu in forum New To Java
    Replies: 2
    Last Post: 09-02-2008, 09:50 PM
  3. How to cast an Object into a specific type (Integer/String) at runtime
    By in forum Advanced Java
    Replies: 2
    Last Post: 12-03-2007, 02:04 PM
  4. Replies: 1
    Last Post: 08-02-2007, 04:07 PM
  5. How can I cast Object as an int
    By romina in forum New To Java
    Replies: 1
    Last Post: 07-18-2007, 11:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts