Tim, When "post" is null or the responseBody is null, then you're going to get this problem. I'd make the line:
lazy val reader: BufferedReader ... That way, the getResponseBodyAsStream method is called when the reader is used, rather than when the instance is created. Thanks, David On Sat, Oct 11, 2008 at 4:06 AM, Tim Perrett <[EMAIL PROTECTED]> wrote: > > Hey guys, > > Im working on the paypal response processing in my paypal module and I > have the following code: > > val reader: BufferedReader = new BufferedReader( > new InputStreamReader( > post.getResponseBodyAsStream() > ) > ) > var line: String = null > try { > while ({line = reader.readLine(); line != null}){ > println("########## " + line) > } > } finally { > if(reader != null){ > reader.close > } > } > > I keep getting this stack trace: > > java.lang.NullPointerException > at java.io.Reader.<init>(Reader.java:61) > at java.io.InputStreamReader.<init>(InputStreamReader.java:55) > at > net.liftweb.paypal.PaypalResponse.getProcessedResponse(Paypal.scala: > 99) > at net.liftweb.paypal.PaypalResponse.<init>(Paypal.scala:92) > at > net.liftweb.paypal.PaypalDataTransferReponse.<init>(Paypal.scala:198) > at net.liftweb.paypal.PaypalDataTransfer.execute(Paypal.scala: > 178) > > Now then, line 99 in my code is: > > new InputStreamReader( > > I've tried all manner of things to work around this but keep hitting a > brick wall. The strange thing is that the loop prints out the lines in > the stream no problem, but then as it hits the end of the stream I > *always* get this NPE. > > Does anyone have any words of wisdom? > > 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 liftweb@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---