eclipse-ee4j / eclipse-ee4j/wasp

a ClassCastException is thrown when EL is used in conjunction with a custom PageContext wrapper

Open
#7 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
8
Forks
11
PR merge metrics
No merged PRs in 30d

Description

The following method in org.apache.jasper.runtime.PageContextImpl

```
private static ExpressionFactory getExpressionFactory(
PageContext pageContext) {

PageContextImpl pc =
(PageContextImpl) JspContextWrapper.getRootPageContext(pageContext);
return pc.getJspApplicationContext().getExpressionFactory();
}
```

results in the exception.

However, it's possible to accomplish the exact same thing in a compliant way, without a cast, using:

```
JspApplicationContext jspApplicationContext =
JspFactory.getDefaultFactory().getJspApplicationContext(
pageContext.getServletContext());

return jspApplicationContext.getExpressionFactory();
```
#### Environment
any
#### Affected Versions
[current]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.