Skip to content

Commit

Permalink
WW-4408 Delays call to get instance of LocaleProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlenart committed Oct 15, 2014
1 parent 381e927 commit cc11cc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ protected Container createBootstrapContainer(List<ContainerProvider> providers)

builder.factory(TextParser.class, OgnlTextParser.class, Scope.SINGLETON);
builder.factory(TextProvider.class, "system", DefaultTextProvider.class, Scope.SINGLETON);
builder.factory(LocaleProvider.class, DefaultLocaleProvider.class, Scope.SINGLETON);

builder.factory(ObjectTypeDeterminer.class, DefaultObjectTypeDeterminer.class, Scope.SINGLETON);
builder.factory(PropertyAccessor.class, CompoundRoot.class.getName(), CompoundRootAccessor.class, Scope.SINGLETON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.LocaleProvider;
import com.opensymphony.xwork2.conversion.TypeConverter;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.ognl.XWorkTypeConverterWrapper;

Expand Down Expand Up @@ -60,7 +61,7 @@ public abstract class DefaultTypeConverter implements TypeConverter {

private static final Map<Class, Object> primitiveDefaults;

private LocaleProvider localeProvider;
private Container container;

static {
Map<Class, Object> map = new HashMap<Class, Object>();
Expand All @@ -78,8 +79,8 @@ public abstract class DefaultTypeConverter implements TypeConverter {
}

@Inject
public void setLocaleProvider(LocaleProvider localeProvider) {
this.localeProvider = localeProvider;
public void setContainer(Container container) {
this.container = container;
}

public Object convertValue(Map<String, Object> context, Object value, Class toType) {
Expand Down Expand Up @@ -346,7 +347,7 @@ protected Locale getLocale(Map<String, Object> context) {
locale = (Locale) context.get(ActionContext.LOCALE);
}
if (locale == null) {
locale = localeProvider.getLocale();
locale = container.getInstance(LocaleProvider.class).getLocale();
}
return locale;
}
Expand Down

0 comments on commit cc11cc2

Please sign in to comment.