From deb6c09bce253f25f8d47a5eac2552b05ba38d71 Mon Sep 17 00:00:00 2001 From: Kusal Kithul-Godage Date: Tue, 22 Oct 2024 10:58:50 +1100 Subject: [PATCH] WW-3714 Replace deprecated APIs in new ActionSupport --- .../java/com/opensymphony/xwork2/ActionSupport.java | 4 +++- .../main/java/org/apache/struts2/ActionSupport.java | 11 ++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java index a775c9bb74..be9cc29cad 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java +++ b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java @@ -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 { } diff --git a/core/src/main/java/org/apache/struts2/ActionSupport.java b/core/src/main/java/org/apache/struts2/ActionSupport.java index 3f2715731d..04c513f3a2 100644 --- a/core/src/main/java/org/apache/struts2/ActionSupport.java +++ b/core/src/main/java/org/apache/struts2/ActionSupport.java @@ -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; @@ -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); @@ -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 conversionErrors = com.opensymphony.xwork2.ActionContext.getContext().getConversionErrors(); + Map 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)); }