Author: jleroux
Date: Sun Mar 25 13:44:42 2012
New Revision: 1305033
URL: http://svn.apache.org/viewvc?rev=1305033&view=rev
Log:
My user name on Windows is "Jacques Le Roux" I get a an exception when creating
shopping list cookie. This is because <<if the cookie name contains illegal
characters (for example, a comma, space, or semicolon) or it is one of the
tokens reserved for use by the cookie protocol>>
http://docs.oracle.com/javaee/6/api/javax/servlet/http/Cookie.html
This fixes it (I did not handle comma not semicolon, I don't think any name use
them)
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=1305033&r1=1305032&r2=1305033&view=diff
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
Sun Mar 25 13:44:42 2012
@@ -640,7 +640,7 @@ public class ShoppingListEvents {
ShoppingCart cart = (ShoppingCart)
session.getAttribute("shoppingCart");
GenericValue userLogin = (GenericValue)
session.getAttribute("userLogin");
Properties systemProps = System.getProperties();
- String guestShoppingUserName = "GuestShoppingListId_" +
systemProps.getProperty("user.name");
+ String guestShoppingUserName = "GuestShoppingListId_" +
systemProps.getProperty("user.name").replace(" ", "_");
String productStoreId = ProductStoreWorker.getProductStoreId(request);
int cookieAge = (60 * 60 * 24 * 30);
String autoSaveListId = null;
@@ -698,7 +698,7 @@ public class ShoppingListEvents {
*/
public static String clearGuestShoppingListCookies (HttpServletRequest
request, HttpServletResponse response){
Properties systemProps = System.getProperties();
- String guestShoppingUserName = "GuestShoppingListId_" +
systemProps.getProperty("user.name");
+ String guestShoppingUserName = "GuestShoppingListId_" +
systemProps.getProperty("user.name").replace(" ", "_");
Cookie guestShoppingListCookie = new Cookie(guestShoppingUserName,
null);
guestShoppingListCookie.setMaxAge(0);
guestShoppingListCookie.setPath("/");