summaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/terminal/gwt/server
diff options
context:
space:
mode:
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>2009-04-12 09:50:09 +0000
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>2009-04-12 09:50:09 +0000
commitd0fdb4c63b9a89ae4b58e8956aab47d3e38bac12 (patch)
treee6cc6bf314a9c13e39272d6c324dcdafa071ec14 /src/com/itmill/toolkit/terminal/gwt/server
parent050ee582add077199cbf28b395104c6cfc027f5a (diff)
downloadvaadin-framework-d0fdb4c63b9a89ae4b58e8956aab47d3e38bac12.tar.gz
vaadin-framework-d0fdb4c63b9a89ae4b58e8956aab47d3e38bac12.zip
Committing Arturs patch to #2840
svn changeset:7389/svn branch:6.0
Diffstat (limited to 'src/com/itmill/toolkit/terminal/gwt/server')
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java
index 4905b858c5..cd4fcae766 100644
--- a/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java
+++ b/src/com/itmill/toolkit/terminal/gwt/server/CommunicationManager.java
@@ -17,6 +17,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.security.GeneralSecurityException;
+import java.text.DateFormat;
import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -854,10 +855,6 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
* -----------------------------
*/
- // Store JVM default locale for later restoration
- // (we'll have to change the default locale for a while)
- final Locale jvmDefault = Locale.getDefault();
-
// Send locale informations to client
outWriter.print(", \"locales\":[");
for (; pendingLocalesIndex < locales.size(); pendingLocalesIndex++) {
@@ -916,10 +913,17 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
/*
* Date formatting (MM/DD/YYYY etc.)
*/
- // Force our locale as JVM default for a while (SimpleDateFormat
- // uses JVM default)
- Locale.setDefault(l);
- final String df = new SimpleDateFormat().toPattern();
+
+ DateFormat dateFormat = DateFormat.getDateTimeInstance(
+ DateFormat.SHORT, DateFormat.SHORT, l);
+ if (!(dateFormat instanceof SimpleDateFormat)) {
+ System.err
+ .println("Unable to get default date pattern for locale "
+ + l.toString());
+ dateFormat = new SimpleDateFormat();
+ }
+ final String df = ((SimpleDateFormat) dateFormat).toPattern();
+
int timeStart = df.indexOf("H");
if (timeStart < 0) {
timeStart = df.indexOf("h");
@@ -963,9 +967,6 @@ public class CommunicationManager implements Paintable.RepaintRequestListener,
}
}
outWriter.print("]"); // Close locales
-
- // Restore JVM default locale
- Locale.setDefault(jvmDefault);
}
/**