OO Rules state that memory allocation (new) should never take place in constructor
or init methods.
You want your original object to completely allocate and initialise itself before

constructing any more objects. The same would apply for all 'new' objects down
the hierarchy chain.

Make Sense?

Martin Gainty

______________________________________________

Disclaimer and confidentiality note

Everything in this e-mail and any attachments relating to the official business of Laconia Data Systems (LDS) is proprietary to the company. It is confidential, legally privileged and protected by law. LDS does not own and endorse any other content.

<
>From: "Ceron, Jay" <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: code snippet...
>Date: Wed, 2 Apr 2003 16:20:33 -0500
>MIME-Version: 1.0
>Received: from mc5-f41.law1.hotmail.com ([65.54.252.48]) by mc5-s19.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Wed, 2 Apr 2003 13:22:52 -0800
>Received: from swjscmail2.java.sun.com ([192.18.99.108]) by mc5-f41.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Wed, 2 Apr 2003 13:21:25 -0800
>Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by swjscmail2.java.sun.com (Postfix) with ESMTPid 484DC22CFC; Wed, 2 Apr 2003 14:17:04 -0700 (MST)
>Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8d) with spool id 6476942 for [EMAIL PROTECTED]; Wed, 2 Apr 2003 14:14:19 -0700
>Received: from insws8501.gs.com (insws8501.gs.com [204.4.182.10]) by swjscmail1.java.sun.com (Postfix) with ESMTP id C4C7A4950; Wed, 2 Apr 2003 14:14:19 -0700 (MST)
>Received: from insvsod01.inz.gs.com (unknown [207.17.36.78]) by insws8501.gs.com (Postfix) with ESMTP id C69611C7B7; Wed, 2 Apr 2003 16:20:35 -0500 (EST)
>Received: from gsnmp03es.ny.fw.gs.com by insvsod01.inz.gs.com with ESMTP; Wed, 2 Apr 2003 16:20:35 -0500
>Received: by gsnmp03es.ny.fw.gs.com with Internet Mail Service (5.5.2655.55) id ; Wed, 2 Apr 2003 16:20:42 -0500
>X-Message-Info: HQbIehuYceTG3lK8qEopaa0XObMOo5hD
>Delivered-To: [EMAIL PROTECTED]
>X-Mailer: Internet Mail Service (5.5.2655.55)
>Message-ID: <[EMAIL PROTECTED]>
>Sender: A mailing list about Java Server Pages specification and reference <[EMAIL PROTECTED]>
>Comments: To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
>Return-Path: [EMAIL PROTECTED]
>X-OriginalArrivalTime: 02 Apr 2003 21:21:26.0468 (UTC) FILETIME=[D1AA7840:01C2F95D]
>
>The following snippet works without a problem:
>
>try
>{
> ...
>
> ReferenceDataBean ref = new ReferenceDataBean();
> ref.connect();
>
> session.setAttribute("resultsbean", ref);
>
>
>getServletContext().getRequestDispatcher("/idpayCreateDist.jsp").forward(req
>uest, response);
>}
>
>But when I make the reference bean a member of the servlet class, allocating
>with new in the init() function, I get a null exception.
>
>try
>{
> ...
>
> session.setAttribute("resultsbean", ref); // ref is a class
>attribute
>
>
>getServletContext().getRequestDispatcher("/idpayCreateDist.jsp").forward(req
>uest, response);
>}
>
>Does anyone know why?
>
> > ________________________________________________
> > Goldman, Sachs & Co.
> > 10 Hanover Square 16th Floor | New York, New York 10005
> > Tel: 212-902-7887 | Fax: 212-357-3045
> > email: [EMAIL PROTECTED]
> >
> > Jay C. Ceron
> > Financial Technology Division Goldman Sachs
> >
> > __________________________________________________
> >
> >
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>
>Some relevant archives, FAQs and Forums on JSPs can be found at:
>
> http://java.sun.com/products/jsp
> http://archives.java.sun.com/jsp-interest.html
> http://forums.java.sun.com
> http://www.jspinsider.com


Help STOP SPAM with the new MSN 8 and get 2 months FREE* =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com

Reply via email to