Skip to content

Commit

Permalink
WW-3714 Replace deprecated APIs in new ActionSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
kusalk committed Oct 22, 2024
1 parent f95f9a7 commit deb6c09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
*/
package com.opensymphony.xwork2;

import com.opensymphony.xwork2.interceptor.ValidationAware;

/**
* @deprecated since 6.7.0, use {@link org.apache.struts2.ActionSupport} instead.
*/
@Deprecated
public class ActionSupport extends org.apache.struts2.ActionSupport {
public class ActionSupport extends org.apache.struts2.ActionSupport implements Action, Validateable, ValidationAware {
}
11 changes: 4 additions & 7 deletions core/src/main/java/org/apache/struts2/ActionSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,18 @@
*/
package org.apache.struts2;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.LocaleProviderFactory;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.TextProviderFactory;
import com.opensymphony.xwork2.Validateable;
import com.opensymphony.xwork2.ValidationAwareSupport;
import com.opensymphony.xwork2.conversion.impl.ConversionData;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.interceptor.ValidationAware;
import com.opensymphony.xwork2.util.ValueStack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.interceptor.ValidationAware;

import java.io.Serializable;
import java.util.Arrays;
Expand All @@ -46,7 +43,7 @@
* Provides a default implementation for the most common actions.
* See the documentation for all the interfaces this class implements for more detailed information.
*/
public class ActionSupport implements com.opensymphony.xwork2.Action, Validateable, ValidationAware, TextProvider, LocaleProvider, Serializable {
public class ActionSupport implements Action, Validateable, ValidationAware, TextProvider, LocaleProvider, Serializable {

private static final Logger LOG = LogManager.getLogger(ActionSupport.class);

Expand Down Expand Up @@ -165,12 +162,12 @@ public String getText(String key, String defaultValue, String[] args, ValueStack
* @return formatted expr with format specified by key
*/
public String getFormatted(String key, String expr) {
Map<String, ConversionData> conversionErrors = com.opensymphony.xwork2.ActionContext.getContext().getConversionErrors();
Map<String, ConversionData> conversionErrors = ActionContext.getContext().getConversionErrors();
if (conversionErrors.containsKey(expr)) {
String[] vals = (String[]) conversionErrors.get(expr).getValue();
return vals[0];
} else {
final ValueStack valueStack = com.opensymphony.xwork2.ActionContext.getContext().getValueStack();
final ValueStack valueStack = ValueStack.adapt(ActionContext.getContext().getValueStack());
final Object val = valueStack.findValue(expr);
return getText(key, Arrays.asList(val));
}
Expand Down

0 comments on commit deb6c09

Please sign in to comment.