MCPcopy Create free account
hub / github.com/apache/tomcat / getType

Method getType

java/jakarta/el/StaticFieldELResolver.java:139–166  ·  view source on GitHub ↗
(ELContext context, Object base, Object property)

Source from the content-addressed store, hash-verified

137 }
138
139 @Override
140 public Class<?> getType(ELContext context, Object base, Object property) {
141 Objects.requireNonNull(context);
142
143 if (base instanceof ELClass && property instanceof String name) {
144 context.setPropertyResolved(base, property);
145
146 Class<?> clazz = ((ELClass) base).getKlass();
147 Exception exception = null;
148 try {
149 Field field = clazz.getField(name);
150 int modifiers = field.getModifiers();
151 if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers) && Util.canAccess(null, field)) {
152 // Resolver is read-only so returns null for resolved fields
153 return null;
154 }
155 } catch (IllegalArgumentException | NoSuchFieldException | SecurityException e) {
156 exception = e;
157 }
158 String msg = Util.message(context, "staticFieldELResolver.notFound", name, clazz.getName());
159 if (exception == null) {
160 throw new PropertyNotFoundException(msg);
161 } else {
162 throw new PropertyNotFoundException(msg, exception);
163 }
164 }
165 return null;
166 }
167
168
169 @Override

Callers 5

testGetType01Method · 0.95
testGetType02Method · 0.95
testGetType09Method · 0.95
doNegativeTestMethod · 0.95
doThrowableTestMethod · 0.95

Calls 6

canAccessMethod · 0.95
messageMethod · 0.95
getKlassMethod · 0.80
getNameMethod · 0.65
setPropertyResolvedMethod · 0.45
getFieldMethod · 0.45

Tested by 5

testGetType01Method · 0.76
testGetType02Method · 0.76
testGetType09Method · 0.76
doNegativeTestMethod · 0.76
doThrowableTestMethod · 0.76