[jboss-user] [JNDI/Naming/Network] - Re: How to determine what is in an InitialContext?

bsheward do-not-reply at jboss.com
Mon Aug 14 16:37:53 EDT 2006


I've written code which dumps out an InitialContext using the list() method. I used an empty String and "java:" as the inputs which seems to give me decent results. Are there any other names which would make sense?

Also, I found that in some circumstances, as I recurse through the tree of objects within the context, the Enumeration returns by the list() method sometimes returns a String object, rather than a NameClassPair object:


  | private static void dumpContextList( Logger lgr, Level lvl, Context ctx, String name, String prefix)
  | {
  |         ...
  | 	for( Enumeration e = ctx.list( name ); e.hasMoreElements(); ) {
  | 		Object o = e.nextElement();
  | 		if ( o instanceof NameClassPair ) {
  |                         ...
  | 		} else {
  | 		        lgr.log( "Found object of Class " + o.getClass().getName() + " = \"" + o.toString() + "\"" );
  | 		}
  | 	}
  | }
  | 

Am I missing something here, or is this a bug?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965108#3965108

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965108



More information about the jboss-user mailing list