[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-11 Thread Timothy Perrett
For group benifit, the fix to Req solves the comet issue. Awesome. Cheers Tim Sent from my iPhone On 11 Mar 2009, at 22:51, David Pollak wrote: > > > On Wed, Mar 11, 2009 at 3:43 PM, Derek Chen-Becker > wrote: > The git diff makes it hard to see what happened (it looks like Req > was rep

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-11 Thread David Pollak
On Wed, Mar 11, 2009 at 3:43 PM, Derek Chen-Becker wrote: > The git diff makes it hard to see what happened (it looks like Req was > replaced wholesale). What did it end up being? > We were not always doing null testing for request.request. I fixed that. There are cases where the HttpServletReq

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-11 Thread marius d.
Ohh goody goody goody ... I won't have to fix it :D ... so back on the book work ... On Mar 11, 5:15 pm, David Pollak wrote: > Fixed in the 1.1 branch.  It might make sense to back-port to the 1.0 branch > > > > On Wed, Mar 11, 2009 at 1:49 PM, marius d. wrote: > > > I'll look on it this evenin

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-11 Thread Derek Chen-Becker
The git diff makes it hard to see what happened (it looks like Req was replaced wholesale). What did it end up being? Thanks, Derek On Wed, Mar 11, 2009 at 9:15 AM, David Pollak wrote: > Fixed in the 1.1 branch. It might make sense to back-port to the 1.0 > branch > > > On Wed, Mar 11, 2009 a

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-11 Thread David Pollak
Fixed in the 1.1 branch. It might make sense to back-port to the 1.0 branch On Wed, Mar 11, 2009 at 1:49 PM, marius d. wrote: > > I'll look on it this evening ... > > On Mar 11, 1:12 pm, Timothy Perrett wrote: > > Just realised i had not posted the stack trace: > > > > java.lang.NullPointerExc

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-11 Thread marius d.
I'll look on it this evening ... On Mar 11, 1:12 pm, Timothy Perrett wrote: > Just realised i had not posted the stack trace: > > java.lang.NullPointerException >         at net.liftweb.http.LiftRules$$anonfun$defaultLocaleCalculator > $1.apply(LiftRules.scala:316) >         at net.liftweb.http.

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-11 Thread Timothy Perrett
Just realised i had not posted the stack trace: java.lang.NullPointerException at net.liftweb.http.LiftRules$$anonfun$defaultLocaleCalculator $1.apply(LiftRules.scala:316) at net.liftweb.http.LiftRules$$anonfun$defaultLocaleCalculator $1.apply(LiftRules.scala:316) at net.l

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-10 Thread Timothy Perrett
For sure ­ im not sure how to write a spec test for something like this? Is there anything I can use / copy as a starting point? Cheers, Tim On 10/03/2009 17:11, "David Pollak" wrote: > > They do have S and LiftSession. > > The case null => guard should catch a null. > > Tim... can you add

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-10 Thread David Pollak
On Tue, Mar 10, 2009 at 4:58 PM, Derek Chen-Becker wrote: > Actually, I'm trying to remember whether COMET actors have an associated > LiftSession (and therefore access to S)... They do have S and LiftSession. The case null => guard should catch a null. Tim... can you add a test to the code th

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-10 Thread Derek Chen-Becker
Can you see what the value of S.request is in your code? That's called by the locale def: def locale: Locale = LiftRules.localeCalculator(request.map(_.request)) The request.map(...) should either be an Empty or Full(HttpServletRequest). I can't find anything obvious that would get a null into a

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-10 Thread Timothy Perrett
Good question I hadn¹t thought about it like that. IMO, they need something ­ as if you want to localize it makes it nearly impossible otherwise... Cheers, Tim On 10/03/2009 16:58, "Derek Chen-Becker" wrote: > Actually, I'm trying to remember whether COMET actors have an associated > Lift

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-10 Thread Derek Chen-Becker
Actually, I'm trying to remember whether COMET actors have an associated LiftSession (and therefore access to S)... On Tue, Mar 10, 2009 at 11:39 AM, Derek Chen-Becker wrote: > Somewhere request is being set to Full(null) instead of Empty, I would > suspect. Otherwise, the flatMap would work corr

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-10 Thread Derek Chen-Becker
Somewhere request is being set to Full(null) instead of Empty, I would suspect. Otherwise, the flatMap would work correctly. Let me see if I can find anything. Derek On Tue, Mar 10, 2009 at 11:16 AM, Tim Perrett wrote: > > Guys, > > I think i might have just found a bug in the > defaultLocaleCal

[Lift] Re: Bug in LiftRules defaultLocaleCalculator

2009-03-10 Thread Timothy Perrett
Actually, probally more like this (which actually compiles!): def defaultLocaleCalculator(request: Box[HttpServletRequest]): Locale = request.flatMap(r => { tryo(r.getLocale()) match { case x @ Full(_) => x case _ => Empty } }).openOr(Locale.getDefault()) Cheers, Tim On