Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[maven-scm] copy for tag cocoon-core-2.2.0-M1

git-svn-id: https://svn.apache.org/repos/asf/cocoon/tags/cocoon-core-2.2.0-M1@427554 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 3888c9bfd1d8f5ea73d6d726592bf8c05ce4b0e0 2 parents 3472d08 + d4efa32
Reinhard Pötz reinhard authored
6 pom.xml
@@ -98,6 +98,12 @@
98 98
99 99 <dependencies>
100 100
  101 + <dependency>
  102 + <groupId>org.apache.cocoon</groupId>
  103 + <artifactId>cocoon-licenses</artifactId>
  104 + <version>1.0.0-M1</version>
  105 + </dependency>
  106 +
101 107 <!-- bootstrap -->
102 108 <dependency>
103 109 <groupId>org.apache.cocoon</groupId>
18 src/main/java/org/apache/cocoon/i18n/I18nUtils.java
@@ -52,23 +52,21 @@ private I18nUtils() {
52 52
53 53 /**
54 54 * Parses given locale string to Locale object. If the string is null
55   - * then the given locale is returned.
  55 + * or empty then the given locale is returned.
56 56 *
57   - * @param localeString a string containing locale in
58   - * <code>language_country_variant</code> format.
59   - * @param defaultLocale returned if localeString is <code>null</code>
  57 + * @param localeString - a string containing locale in
  58 + * <code>language_country_variant</code> format.
  59 + * @param defaultLocale - returned if localeString is <code>null</code>
  60 + * or <code>""</code>
60 61 */
61 62 public static Locale parseLocale(String localeString, Locale defaultLocale) {
62   - if (localeString != null) {
63   - StringTokenizer st = new StringTokenizer(localeString,
64   - LOCALE_DELIMITER);
65   - String l = st.hasMoreElements() ? st.nextToken()
66   - : defaultLocale.getLanguage();
  63 + if (localeString != null && localeString.length() > 0) {
  64 + StringTokenizer st = new StringTokenizer(localeString, LOCALE_DELIMITER);
  65 + String l = st.hasMoreElements() ? st.nextToken() : defaultLocale.getLanguage();
67 66 String c = st.hasMoreElements() ? st.nextToken() : "";
68 67 String v = st.hasMoreElements() ? st.nextToken() : "";
69 68 return new Locale(l, c, v);
70 69 }
71   -
72 70 return defaultLocale;
73 71 }
74 72

0 comments on commit 3888c9b

Please sign in to comment.
Something went wrong with that request. Please try again.