Lines 99-118
Link Here
|
99 |
* Gets an ExpressionEvaluator from the cache, or seeds the cache |
99 |
* Gets an ExpressionEvaluator from the cache, or seeds the cache |
100 |
* if we haven't seen a particular ExpressionEvaluator before. |
100 |
* if we haven't seen a particular ExpressionEvaluator before. |
101 |
*/ |
101 |
*/ |
102 |
public static synchronized |
102 |
public static |
103 |
ExpressionEvaluator getEvaluatorByName(String name) |
103 |
ExpressionEvaluator getEvaluatorByName(String name) |
104 |
throws JspException { |
104 |
throws JspException { |
105 |
try { |
|
|
106 |
|
105 |
|
107 |
Object oEvaluator = nameMap.get(name); |
106 |
Object oEvaluator = nameMap.get(name); |
108 |
if (oEvaluator == null) { |
107 |
if (oEvaluator != null) { |
|
|
108 |
return ((ExpressionEvaluator) oEvaluator); |
109 |
} |
110 |
try { |
111 |
synchronized (nameMap) { |
112 |
oEvaluator = nameMap.get(name); |
113 |
if (oEvaluator != null) { |
114 |
return ((ExpressionEvaluator) oEvaluator); |
115 |
} |
109 |
ExpressionEvaluator e = (ExpressionEvaluator) |
116 |
ExpressionEvaluator e = (ExpressionEvaluator) |
110 |
Class.forName(name).newInstance(); |
117 |
Class.forName(name).newInstance(); |
111 |
nameMap.put(name, e); |
118 |
nameMap.put(name, e); |
112 |
return (e); |
119 |
return (e); |
113 |
} else |
120 |
} |
114 |
return ((ExpressionEvaluator) oEvaluator); |
|
|
115 |
|
116 |
} catch (ClassCastException ex) { |
121 |
} catch (ClassCastException ex) { |
117 |
// just to display a better error message |
122 |
// just to display a better error message |
118 |
throw new JspException("invalid ExpressionEvaluator: " + |
123 |
throw new JspException("invalid ExpressionEvaluator: " + |