Skip to content

MessageSourceSupport and StaticMessageSource uses invalid caches for MessageFormat [SPR-9607] #14241

@spring-projects-issues

Description

@spring-projects-issues

Diogo Quintela opened SPR-9607 and commented

Hello,

org.springframework.context.support.MessageSourceSupport and
org.springframework.context.support.StaticMessageSource

maintains a map to cache MessageFormat instances:

Map<String, MessageFormat> cachedMessageFormats = new HashMap<String, MessageFormat>();

The problem is that MessageFormat are created with locale information
and the caches don't honor that.

I propose that it should be used instead.

Map<String, Map<Locale,MessageFormat>> cachedMessageFormats = new HashMap<String, Map<Locale,MessageFormat>>();

btw, since spring is now only Java5
why not replace all maps and synchronized blocks
with ConcurrentMap and Lock's ?

Best regards
Diogo Quintela


Affects: 3.1.2

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions