You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by tv...@apache.org on 2008/04/08 10:51:25 UTC

svn commit: r645797 - in /turbine/core/branches/TURBINE_2_3_BRANCH: src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java xdocs/changes.xml

Author: tv
Date: Tue Apr  8 01:51:24 2008
New Revision: 645797

URL: http://svn.apache.org/viewvc?rev=645797&view=rev
Log:
Initialize the locale of RunData, the ParameterParser and the CookieParser 
from the HttpServletRequest. Make RunData.setLocale propagate the locale setting to the parsers.

Modified:
    turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
    turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java
    turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml

Modified: turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java
URL: http://svn.apache.org/viewvc/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java?rev=645797&r1=645796&r2=645797&view=diff
==============================================================================
--- turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java (original)
+++ turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java Tue Apr  8 01:51:24 2008
@@ -971,6 +971,17 @@
     public void setLocale(Locale locale)
     {
         this.locale = locale;
+        
+        // propagate the locale to the parsers
+        if (this.parameters != null)
+        {
+            parameters.setLocale(locale);
+        }
+
+        if (this.cookies != null)
+        {
+            cookies.setLocale(locale);
+        }
     }
 
     /**

Modified: turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java
URL: http://svn.apache.org/viewvc/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java?rev=645797&r1=645796&r2=645797&view=diff
==============================================================================
--- turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java (original)
+++ turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java Tue Apr  8 01:51:24 2008
@@ -21,6 +21,7 @@
 
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Map;
 
 import javax.servlet.ServletConfig;
@@ -217,12 +218,21 @@
             data = (TurbineRunData) pool.getInstance(cfg[0]);
             
             ParameterParser pp = (ParameterParser) pool.getInstance(cfg[1]);
-            pp.setLocale(data.getLocale());
             data.setParameterParser(pp);
             
             CookieParser cp = (CookieParser) pool.getInstance(cfg[2]);
-            cp.setLocale(data.getLocale());
             data.setCookieParser(cp);
+
+            Locale locale = req.getLocale();
+            
+            if (locale == null)
+            {
+                // get the default from the Turbine configuration
+                locale = data.getLocale();
+            }
+            
+            // set the locale detected and propagate it to the parsers
+            data.setLocale(locale);
         }
         catch (ClassCastException x)
         {

Modified: turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml?rev=645797&r1=645796&r2=645797&view=diff
==============================================================================
--- turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml (original)
+++ turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml Tue Apr  8 01:51:24 2008
@@ -29,6 +29,17 @@
 <body>
   <release version="2.3.3-dev" date="in Subversion">
     <action type="update" dev="tv">
+      Important change: The BaseValueParser now consistently returns null for 
+      all get-methods that return an Object, if the parameter name does not exist.
+      This changes the behaviour of getBigDecimal which used to return 0 in this 
+      case.
+    </action>
+    <action type="update" dev="tv">
+      Initialize the locale of RunData, the ParameterParser and the CookieParser 
+      from the HttpServletRequest. Make RunData.setLocale propagate the locale 
+      setting to the parsers.
+    </action>
+    <action type="update" dev="tv">
       Set the locale of the ParameterParser and the CookieParser from the default
       locale of RunData.
     </action>