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 <[email protected]>wrote: > > Guys, > > I think i might have just found a bug in the > defaultLocaleCalculator... By simply adding S.?("mykey") to a comet > actor, it bombs in spectacular style. > > I worked the bug back as it was originally getting an NPE from my > code, so I shoved everything into boxes - that appears to have now > moved the issue down into LiftRules... > > The default calculator looks like: > > request.flatMap(_.getLocale() match {case null => Empty case l: Locale > => Full(l)}).openOr(Locale.getDefault()) > > where request is Box[HttpServletRequest]. So then, flatMap is a method > on Box, thats fine, but then: > > _.getLocale() match {...} > > The issue im seeing suggests that _ is actually null in this context > and then throwing an NPE. This is easily solvable but involves shoving > the placeholder into a box: > > > request.flatMap(r => { > Box.!!(r.getLocale()) match { > case l: java.util.Locale => Full(loc) > case _ => Empty > } > }).openOr(Locale.getDefault()) > > > Thoughts? > > Cheers, Tim > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
