Repository: struts Updated Branches: refs/heads/master 50a0a72e9 -> fe31a24b7
WW-4861 Makes code more re-usable Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/fe31a24b Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/fe31a24b Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/fe31a24b Branch: refs/heads/master Commit: fe31a24b74719b5583c38139f64532b51bb6e915 Parents: 50a0a72 Author: Lukasz Lenart <lukaszlen...@apache.org> Authored: Tue Sep 19 10:27:57 2017 +0200 Committer: Lukasz Lenart <lukaszlen...@apache.org> Committed: Tue Sep 19 10:27:57 2017 +0200 ---------------------------------------------------------------------- core/src/main/java/com/opensymphony/xwork2/ActionSupport.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/fe31a24b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java index 7d79471..434e699 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java +++ b/core/src/main/java/com/opensymphony/xwork2/ActionSupport.java @@ -279,8 +279,8 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex * @return reference to field with TextProvider */ protected TextProvider getTextProvider() { - checkContainer(); if (textProvider == null) { + Container container = getContainer(); TextProviderFactory tpf = container.getInstance(TextProviderFactory.class); textProvider = tpf.createInstance(getClass()); } @@ -288,8 +288,8 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex } protected LocaleProvider getLocaleProvider() { - checkContainer(); if (localeProvider == null) { + Container container = getContainer(); LocaleProviderFactory localeProviderFactory = container.getInstance(LocaleProviderFactory.class); localeProvider = localeProviderFactory.createLocaleProvider(); } @@ -299,7 +299,7 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex /** * TODO: This a temporary solution, maybe we should consider stop injecting container into beans */ - private void checkContainer() { + protected Container getContainer() { if (container == null) { container = ActionContext.getContext().getContainer(); if (container != null) { @@ -313,6 +313,7 @@ public class ActionSupport implements Action, Validateable, ValidationAware, Tex LOG.warn("Container is null, action was created out of ActionContext scope?!?"); } } + return container; } @Inject