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

(-)java/javax/servlet/jsp/el/ImplicitObjectELResolver.java (-10 / +18 lines)
Lines 20-27 Link Here
20
import java.beans.FeatureDescriptor;
20
import java.beans.FeatureDescriptor;
21
import java.util.AbstractMap;
21
import java.util.AbstractMap;
22
import java.util.ArrayList;
22
import java.util.ArrayList;
23
import java.util.Arrays;
24
import java.util.Enumeration;
23
import java.util.Enumeration;
24
import java.util.HashMap;
25
import java.util.HashSet;
25
import java.util.HashSet;
26
import java.util.Iterator;
26
import java.util.Iterator;
27
import java.util.List;
27
import java.util.List;
Lines 73-78 Link Here
73
73
74
    private static final int SESSION_SCOPE = 10;
74
    private static final int SESSION_SCOPE = 10;
75
75
76
    private static final Map<String, Integer> scopeMap = new HashMap<>();
77
78
    static {
79
        for (int i = 0; i < SCOPE_NAMES.length; i++) {
80
            scopeMap.put(SCOPE_NAMES[i], Integer.valueOf(i));
81
        }
82
    }
83
76
    public ImplicitObjectELResolver() {
84
    public ImplicitObjectELResolver() {
77
        super();
85
        super();
78
    }
86
    }
Lines 85-97 Link Here
85
        }
93
        }
86
94
87
        if (base == null && property != null) {
95
        if (base == null && property != null) {
88
            int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
96
            Integer idx = scopeMap.get(property.toString());
89
97
90
            if (idx >= 0) {
98
            if (idx != null) {
91
                PageContext page = (PageContext) context
99
                PageContext page = (PageContext) context
92
                        .getContext(JspContext.class);
100
                        .getContext(JspContext.class);
93
                context.setPropertyResolved(true);
101
                context.setPropertyResolved(true);
94
                switch (idx) {
102
                switch (idx.intValue()) {
95
                case APPLICATIONSCOPE:
103
                case APPLICATIONSCOPE:
96
                    return ScopeManager.get(page).getApplicationScope();
104
                    return ScopeManager.get(page).getApplicationScope();
97
                case COOKIE:
105
                case COOKIE:
Lines 129-136 Link Here
129
        }
137
        }
130
138
131
        if (base == null && property != null) {
139
        if (base == null && property != null) {
132
            int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
140
            Integer idx = scopeMap.get(property.toString());
133
            if (idx >= 0) {
141
            if (idx != null) {
134
                context.setPropertyResolved(true);
142
                context.setPropertyResolved(true);
135
            }
143
            }
136
        }
144
        }
Lines 147-154 Link Here
147
        }
155
        }
148
156
149
        if (base == null && property != null) {
157
        if (base == null && property != null) {
150
            int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
158
            Integer idx = scopeMap.get(property.toString());
151
            if (idx >= 0) {
159
            if (idx != null) {
152
                context.setPropertyResolved(true);
160
                context.setPropertyResolved(true);
153
                throw new PropertyNotWritableException();
161
                throw new PropertyNotWritableException();
154
            }
162
            }
Lines 163-170 Link Here
163
        }
171
        }
164
172
165
        if (base == null && property != null) {
173
        if (base == null && property != null) {
166
            int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
174
            Integer idx = scopeMap.get(property.toString());
167
            if (idx >= 0) {
175
            if (idx != null) {
168
                context.setPropertyResolved(true);
176
                context.setPropertyResolved(true);
169
                return true;
177
                return true;
170
            }
178
            }

Return to bug 53895