geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacek Laskowski" <ja...@laskowski.net.pl>
Subject Re: svn commit: r465917 - in /geronimo/server/trunk/modules: geronimo-client/src/main/java/org/apache/geronimo/client/ geronimo-naming/src/main/java/org/apache/geronimo/naming/enc/ geronimo-naming/src/test/java/org/apache/geronimo/gjndi/
Date Fri, 20 Oct 2006 06:19:23 GMT
On 10/20/06, dain@apache.org <dain@apache.org> wrote:
> Author: dain
> Date: Thu Oct 19 15:44:24 2006
> New Revision: 465917
...
> +        boolean containsEnv = false;
> +        for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
> +            Map.Entry entry = (Map.Entry) iterator.next();
> +            String name = (String) entry.getKey();
> +            Object value = entry.getValue();
> +
> +            if (name.startsWith("env/")) {
> +                containsEnv = true;
> +            }
>              if (value instanceof KernelAwareReference) {
>                  ((KernelAwareReference) value).setKernel(kernel);
>              }
>              if (value instanceof ClassLoaderAwareReference) {
>                  ((ClassLoaderAwareReference) value).setClassLoader(classLoader);
>              }
> +        }
> +
> +        if (!containsEnv) {
> +            Context env = new ImmutableContext("java:comp/env", Collections.EMPTY_MAP,
false);
> +            map.put("env", env);
>          }

I haven't tested it out, but...reading the code seems to set
containsEnv to false every time. It's because name.startsWith("env/")
checks whether env + '/' whereas map contains only env (with no
trailing slash).

BTW, why doesn't it simply use map.get("env") to verify whether
java:comp/env is available?

-- 
Jacek Laskowski
http://www.jaceklaskowski.pl

Mime
View raw message