Commit 9c93817a1881257e528de873e54cb47bfc80408d
1 parent
0d573518
Fixed bug with MissingResourceException when user is using locale that is not de…
…fined in stock message bundles.
Showing
1 changed file
with
11 additions
and
2 deletions
... | ... | @@ -36,12 +36,18 @@ public class ScheduleMessages extends ClientScript { |
36 | 36 | FacesContext facesContext = FacesContext.getCurrentInstance(); |
37 | 37 | Application application = facesContext.getApplication(); |
38 | 38 | StringBuilder out = new StringBuilder(); |
39 | - out.append("RichFaces.Schedule.prototype.messages=jQuery.extend(RichFaces.Schedule.prototype.messages,{"); | |
39 | +// space at the end is crucial if no locale is supported | |
40 | + out.append("RichFaces.Schedule.prototype.messages=jQuery.extend(RichFaces.Schedule.prototype.messages,{ "); | |
40 | 41 | Iterator<Locale> supportedLocales = application.getSupportedLocales(); |
41 | 42 | while (supportedLocales.hasNext()) { |
42 | 43 | Locale locale = supportedLocales.next(); |
43 | 44 | ResourceBundle applicationBundle = ResourceBundle.getBundle(application.getMessageBundle(), locale, loader); |
44 | - ResourceBundle stockBundle = ResourceBundle.getBundle(BUNDLE_NAME, locale, loader); | |
45 | + ResourceBundle stockBundle = null; | |
46 | + try { | |
47 | + stockBundle = ResourceBundle.getBundle(BUNDLE_NAME, locale, loader); | |
48 | + } catch (MissingResourceException e) { | |
49 | + LOG.debug("No bundle " + BUNDLE_NAME + " for locale " + locale + " found."); | |
50 | + } | |
45 | 51 | String[] months = new String[]{"JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", |
46 | 52 | "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"}; |
47 | 53 | String[] days = new String[]{"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"}; |
... | ... | @@ -121,6 +127,9 @@ public class ScheduleMessages extends ClientScript { |
121 | 127 | try { |
122 | 128 | return applicationBundle.getString(key); |
123 | 129 | } catch (MissingResourceException e) { |
130 | + if (stockBundle == null) { | |
131 | + throw e; | |
132 | + } | |
124 | 133 | try { |
125 | 134 | return stockBundle.getString(key); |
126 | 135 | } catch (MissingResourceException e1) { | ... | ... |
Please
register
or
login
to post a comment