View | Details | Raw Unified | Return to bug 23950
Collapse All | Expand All

(-)D:/workspace/jakarta-tomcat-naming/org/apache/naming/NamingContextBindingsEnumeration.java (-6 / +36 lines)
Lines 17-27 Link Here
17
17
18
package org.apache.naming;
18
package org.apache.naming;
19
19
20
import java.util.Hashtable;
20
import java.util.Iterator;
21
import java.util.Iterator;
21
22
22
import javax.naming.Binding;
23
import javax.naming.Binding;
24
import javax.naming.CompositeName;
25
import javax.naming.Context;
23
import javax.naming.NamingEnumeration;
26
import javax.naming.NamingEnumeration;
24
import javax.naming.NamingException;
27
import javax.naming.NamingException;
28
import javax.naming.spi.NamingManager;
25
29
26
/**
30
/**
27
 * Naming enumeration implementation.
31
 * Naming enumeration implementation.
Lines 37-44 Link Here
37
    // ----------------------------------------------------------- Constructors
41
    // ----------------------------------------------------------- Constructors
38
42
39
43
40
    public NamingContextBindingsEnumeration(Iterator entries) {
44
    public NamingContextBindingsEnumeration(Iterator entries, Context ctx, Hashtable env) {
41
    	iterator = entries;
45
    	iterator = entries;
46
    	this.ctx = ctx;
47
    	this.env = env;
42
    }
48
    }
43
49
44
50
Lines 49-56 Link Here
49
     * Underlying enumeration.
55
     * Underlying enumeration.
50
     */
56
     */
51
    protected Iterator iterator;
57
    protected Iterator iterator;
58
    private Context ctx;
59
    private Hashtable env;
52
60
53
54
    // --------------------------------------------------------- Public Methods
61
    // --------------------------------------------------------- Public Methods
55
62
56
63
Lines 59-65 Link Here
59
     */
66
     */
60
    public Object next()
67
    public Object next()
61
        throws NamingException {
68
        throws NamingException {
62
        return nextElement();
69
    	try {
70
    		return nextElementInternal();
71
    	} catch (RuntimeException e) {
72
    		throw (RuntimeException)e;
73
    	} catch (Exception e) {
74
    		NamingException ne = new NamingException();
75
    		ne.setRootCause(e);
76
    		throw ne;
77
    	}
63
    }
78
    }
64
79
65
80
Lines 85-95 Link Here
85
    }
100
    }
86
101
87
102
88
    public Object nextElement() {
103
    private Object nextElementInternal() throws Exception {
89
        NamingEntry entry = (NamingEntry) iterator.next();
104
        NamingEntry entry = (NamingEntry) iterator.next();
90
        return new Binding(entry.name, entry.value.getClass().getName(), 
105
91
                           entry.value, true);
106
        String name = entry.name;
107
        Object obj = NamingManager.getObjectInstance(entry.value,
108
                new CompositeName(name), ctx, env);
109
        return new Binding(name, obj.getClass().getName(), 
110
        		obj, true);
92
    }
111
    }
112
    
113
    public Object nextElement() {
114
    	try {
115
    		return nextElementInternal();
116
    	} catch (RuntimeException e) {
117
    		throw (RuntimeException)e;
118
    	} catch (Exception e) {
119
    		//TODO: better handling for nested Exceptions pre 1.4
120
    		throw new RuntimeException(e.getMessage());
121
    	}
122
    }
93
123
94
124
95
}
125
}
(-)D:/workspace/jakarta-tomcat-naming/org/apache/naming/NamingContext.java (-1 / +1 lines)
Lines 387-393 Link Here
387
        while ((!name.isEmpty()) && (name.get(0).length() == 0))
387
        while ((!name.isEmpty()) && (name.get(0).length() == 0))
388
            name = name.getSuffix(1);
388
            name = name.getSuffix(1);
389
        if (name.isEmpty()) {
389
        if (name.isEmpty()) {
390
            return new NamingContextBindingsEnumeration(bindings.values().iterator());
390
            return new NamingContextBindingsEnumeration(bindings.values().iterator(), this, env);
391
        }
391
        }
392
        
392
        
393
        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
393
        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
(-)D:/workspace/jakarta-tomcat-naming/org/apache/naming/resources/FileDirContext.java (-1 / +1 lines)
Lines 334-340 Link Here
334
            throw new NamingException
334
            throw new NamingException
335
                (sm.getString("resources.notFound", name));
335
                (sm.getString("resources.notFound", name));
336
336
337
        return new NamingContextBindingsEnumeration(list(file).iterator());
337
        return new NamingContextBindingsEnumeration(list(file).iterator(), this, env);
338
338
339
    }
339
    }
340
340
(-)D:/workspace/jakarta-tomcat-naming/org/apache/naming/resources/WARDirContext.java (-2 / +2 lines)
Lines 322-333 Link Here
322
    public NamingEnumeration listBindings(Name name)
322
    public NamingEnumeration listBindings(Name name)
323
        throws NamingException {
323
        throws NamingException {
324
        if (name.isEmpty())
324
        if (name.isEmpty())
325
            return new NamingContextBindingsEnumeration(list(entries).iterator());
325
            return new NamingContextBindingsEnumeration(list(entries).iterator(), this, env);
326
        Entry entry = treeLookup(name);
326
        Entry entry = treeLookup(name);
327
        if (entry == null)
327
        if (entry == null)
328
            throw new NamingException
328
            throw new NamingException
329
                (sm.getString("resources.notFound", name));
329
                (sm.getString("resources.notFound", name));
330
        return new NamingContextBindingsEnumeration(list(entry).iterator());
330
        return new NamingContextBindingsEnumeration(list(entry).iterator(), this, env);
331
    }
331
    }
332
332
333
333

Return to bug 23950