It's very doubtful that a subclass is causing the constructor on its
superclass to be called twice.  But, if you're using the immutable pattern,
you're creating two instances of a given class.

Try my original suggestion of making the val into a lazy val.  That way, it
will be constructed only when it's accessed the first time, not when the
instance is created.

Second, I'd strongly suggest looking at how RequestState is initialized in
Lift.  RequestState is immutable, but it represents the mutable state of the
underlying HTTPRequest object.

On Sat, Oct 11, 2008 at 4:31 PM, Tim Perrett <[EMAIL PROTECTED]> wrote:

>
> Ok I've found the issue. My class is a case class that has subclasses,
> and when I create a subclass it appears the init stuff is getting
> called twice; however, as the readLine method is destructive, there is
> nothing to read and i then get an NPE. Bugger.
>
> Any suggestions for a solution would be great. Ideally, I don't want
> to have to check if its cool to call other methods on that instance
> and possibly having to invoke the stream processing manually, it
> should really be done automatically by the super class.
>
> If I created a companion ojbect, with an apply method like:
>
> def apply(p: PostMethod) = PaypalResponse(p).withProcessedResponse
>
> might that solve the problem?
>
> Cheers
>
> Tim
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to