On Tue, Mar 10, 2009 at 4:58 PM, Derek Chen-Becker <[email protected]>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 that triggers your problem? That way we can fix the problem and make sure it doesn't happen again. > > > On Tue, Mar 10, 2009 at 11:39 AM, Derek Chen-Becker <[email protected] > > wrote: > >> 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 >>> >>> >> > > > > -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
