freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java
changeset 271 aa1c63b58149
parent 264 d60370059c3c
child 278 3a472605338f
     1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Tue Sep 14 08:56:13 2010 +0200
     1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java	Sat Oct 23 22:51:43 2010 +0200
     1.3 @@ -32,6 +32,7 @@
     1.4  import java.io.StringWriter;
     1.5  import java.net.URI;
     1.6  import java.text.MessageFormat;
     1.7 +import java.text.ParseException;
     1.8  import java.util.ArrayList;
     1.9  import java.util.Arrays;
    1.10  import java.util.Date;
    1.11 @@ -51,6 +52,7 @@
    1.12  import javax.ws.rs.PathParam;
    1.13  import javax.ws.rs.Produces;
    1.14  import javax.ws.rs.QueryParam;
    1.15 +import javax.ws.rs.WebApplicationException;
    1.16  import javax.ws.rs.core.CacheControl;
    1.17  import javax.ws.rs.core.Context;
    1.18  import javax.ws.rs.core.Cookie;
    1.19 @@ -558,16 +560,20 @@
    1.20              }
    1.21          }
    1.22          if (rb == null) {
    1.23 -            for (Locale l : headers.getAcceptableLanguages()) {
    1.24 -                try {
    1.25 -                    rb = ResourceBundle.getBundle("cz.xelfi.quoridor.freemarkerdor.UI.Bundle", l);
    1.26 -                    if (locale != null) {
    1.27 -                        locale[0] = l;
    1.28 +            try {
    1.29 +                for (Locale l : headers.getAcceptableLanguages()) {
    1.30 +                    try {
    1.31 +                        rb = ResourceBundle.getBundle("cz.xelfi.quoridor.freemarkerdor.UI.Bundle", l);
    1.32 +                        if (locale != null) {
    1.33 +                            locale[0] = l;
    1.34 +                        }
    1.35 +                        break;
    1.36 +                    } catch (MissingResourceException e) {
    1.37 +                        // OK
    1.38                      }
    1.39 -                    break;
    1.40 -                } catch (MissingResourceException e) {
    1.41 -                    // OK
    1.42                  }
    1.43 +            } catch (WebApplicationException ex) {
    1.44 +                // OK, can't parse header
    1.45              }
    1.46          }
    1.47          if (rb == null) {