(ELContext context, String name, Object... props)
| 50 | |
| 51 | |
| 52 | static String message(ELContext context, String name, Object... props) { |
| 53 | Locale locale = null; |
| 54 | if (context != null) { |
| 55 | locale = context.getLocale(); |
| 56 | } |
| 57 | if (locale == null) { |
| 58 | locale = Locale.getDefault(); |
| 59 | if (locale == null) { |
| 60 | return ""; |
| 61 | } |
| 62 | } |
| 63 | ResourceBundle bundle = ResourceBundle.getBundle("jakarta.el.LocalStrings", locale); |
| 64 | try { |
| 65 | String template = bundle.getString(name); |
| 66 | if (props != null) { |
| 67 | template = MessageFormat.format(template, props); |
| 68 | } |
| 69 | return template; |
| 70 | } catch (MissingResourceException e) { |
| 71 | return "Missing Resource: '" + name + "' for Locale " + locale.getDisplayName(); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | private static final ExpressionFactoryCache factoryCache = new ExpressionFactoryCache(); |
| 76 |
no test coverage detected