[ https://issues.apache.org/jira/browse/WW-3714?focusedWorklogId=938600&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-938600 ]
ASF GitHub Bot logged work on WW-3714: -------------------------------------- Author: ASF GitHub Bot Created on: 17/Oct/24 08:11 Start Date: 17/Oct/24 08:11 Worklog Time Spent: 10m Work Description: github-advanced-security[bot] commented on code in PR #1086: URL: https://github.com/apache/struts/pull/1086#discussion_r1804312035 ########## core/src/main/java/com/opensymphony/xwork2/validator/ValidatorContext.java: ########## @@ -18,23 +18,175 @@ */ package com.opensymphony.xwork2.validator; -import com.opensymphony.xwork2.LocaleProvider; -import com.opensymphony.xwork2.TextProvider; +import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.interceptor.ValidationAware; +import com.opensymphony.xwork2.util.ValueStack; + +import java.util.Collection; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.ResourceBundle; /** - * The context for validation. This interface extends others to provide methods for reporting - * errors and messages as well as looking up error messages in a resource bundle using a specific locale. - * - * @author Jason Carreira + * @deprecated since 6.7.0, use {@link org.apache.struts2.validator.ValidatorContext} instead. */ -public interface ValidatorContext extends ValidationAware, TextProvider, LocaleProvider { - - /** - * Translates a simple field name into a full field name in OGNL syntax. - * - * @param fieldName the field name to lookup. - * @return the full field name in OGNL syntax. - */ - String getFullFieldName(String fieldName); +@Deprecated +public interface ValidatorContext extends org.apache.struts2.validator.ValidatorContext, ValidationAware { + + static ValidatorContext adapt(org.apache.struts2.validator.ValidatorContext actualContext) { + if (actualContext instanceof ActionContext) { + return (ValidatorContext) actualContext; + } + return actualContext != null ? new LegacyAdapter(actualContext) : null; + } + + class LegacyAdapter implements ValidatorContext { + + private final org.apache.struts2.validator.ValidatorContext adaptee; + + public LegacyAdapter(org.apache.struts2.validator.ValidatorContext adaptee) { + this.adaptee = adaptee; + } + + @Override + public String getFullFieldName(String fieldName) { + return adaptee.getFullFieldName(fieldName); + } + + @Override + public Locale getLocale() { + return adaptee.getLocale(); + } + + @Override + public boolean isValidLocaleString(String localeStr) { + return adaptee.isValidLocaleString(localeStr); + } + + @Override + public boolean isValidLocale(Locale locale) { + return adaptee.isValidLocale(locale); + } + + @Override + public boolean hasKey(String key) { + return adaptee.hasKey(key); + } + + @Override + public String getText(String key) { + return adaptee.getText(key); + } + + @Override + public String getText(String key, String defaultValue) { + return adaptee.getText(key, defaultValue); + } + + @Override + public String getText(String key, String defaultValue, String obj) { + return adaptee.getText(key, defaultValue, obj); + } + + @Override + public String getText(String key, List<?> args) { + return adaptee.getText(key, args); + } + + @Override + public String getText(String key, String[] args) { + return adaptee.getText(key, args); + } + + @Override + public String getText(String key, String defaultValue, List<?> args) { + return adaptee.getText(key, defaultValue, args); + } + + @Override + public String getText(String key, String defaultValue, String[] args) { + return adaptee.getText(key, defaultValue, args); + } + + @Override + public String getText(String key, String defaultValue, List<?> args, ValueStack stack) { + return adaptee.getText(key, defaultValue, args, stack); Review Comment: ## OGNL Expression Language statement with user-controlled input OGNL Expression Language statement depends on a [user-provided value](1). OGNL Expression Language statement depends on a [user-provided value](2). [Show more details](https://github.com/apache/struts/security/code-scanning/669) Issue Time Tracking ------------------- Worklog Id: (was: 938600) Time Spent: 6h (was: 5h 50m) > Rename org.opensymphony.xwork2 to org.apache.struts2.xwork2 > ----------------------------------------------------------- > > Key: WW-3714 > URL: https://issues.apache.org/jira/browse/WW-3714 > Project: Struts 2 > Issue Type: Task > Components: Core Actions > Affects Versions: 2.2.3.1 > Reporter: Lukasz Lenart > Assignee: Lukasz Lenart > Priority: Minor > Fix For: 7.0.0 > > Time Spent: 6h > Remaining Estimate: 0h > > To finish acquisition of XWork project, all the packages have to be renamed > to match current Struts 2 package hierarchy -- This message was sent by Atlassian Jira (v8.20.10#820010)