lukaszlenart commented on code in PR #1405:
URL: https://github.com/apache/struts/pull/1405#discussion_r2642683949
##########
core/src/main/java/org/apache/struts2/ognl/XWorkTypeConverterWrapper.java:
##########
@@ -36,6 +37,11 @@ public XWorkTypeConverterWrapper(ognl.TypeConverter conv) {
@Override
public Object convertValue(Map context, Object target, Member member,
String propertyName, Object value, Class toType) {
- return typeConverter.convertValue(context, target, member,
propertyName, value, toType);
+ // Cast context to OgnlContext for OGNL 3.4.8+ compatibility
+ OgnlContext ognlContext = (context instanceof OgnlContext oc) ? oc :
null;
+ if (ognlContext == null) {
+ throw new IllegalArgumentException("Context must be an OgnlContext
for OGNL 3.4.8+");
+ }
+ return typeConverter.convertValue(ognlContext, target, member,
propertyName, value, toType);
Review Comment:
Refactored
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]