cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: svn commit: r123825 - in cocoon/branches/BRANCH_2_1_X/src: blocks/naming/java/org/apache/cocoon/components/naming blocks/portal/java/org/apache/cocoon/components/modules/input blocks/portal/java/org/apache/cocoon/environment/portlet blocks/portal/java/org/apache/cocoon/portal/pluto/services/factory blocks/portal/java/org/apache/cocoon/portal/pluto/test java/org/apache/cocoon/acting java/org/apache/cocoon/components/modules/output java/org/apache/cocoon/components/notification java/org/apache/cocoon/components/treeprocessor java/org/apache/cocoon/util java/org/apache/cocoon/xml/dom
Date Fri, 31 Dec 2004 22:17:30 GMT
On 31.12.2004 22:18, antonio@apache.org wrote:

> URL: http://svn.apache.org/viewcvs?view=rev&rev=123825

> Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java?view=diff&rev=123825&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java&r1=123824&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/naming/java/org/apache/cocoon/components/naming/LDAPEntryManager.java&r2=123825
> ==============================================================================

>  	private Attributes map2Attributes (Map map) {
>  		Attributes attrs = new BasicAttributes (false);
> -		Iterator keys = map.keySet ().iterator ();
> -		while (keys.hasNext ()) {
> -			String key = (String)keys.next ();
> -			Iterator vals = ((List)map.get (key)).iterator ();
> -			Attribute attr = new BasicAttribute (key);
> -			while (vals.hasNext ()) {
> -				attr.add(vals.next());
> -			}
> -			attrs.put (attr);
> -		}
> +        for (Iterator i = map.entrySet().iterator(); i.hasNext(); ) {
> +            Map.Entry me = (Map.Entry)i.next();
> +            String key = (String)me.getKey();
> +            Attribute attr = new BasicAttribute(key);
> +            for (Iterator vals = ((List)me.getValue()).iterator(); vals.hasNext(); )
{
> +                attr.add(vals.next());
> +            }
> +        }
>  		return attrs;
>  	}

1. Iterators with for-loop really read bad, using while is much more 
expected IMO.

2. The file is tab-contaminated.

3. There is a "attrs.put(attr);" missing in your new code I think.

I wish you all a happy new year!

Joerg

Mime
View raw message