🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16336

Re: Serialization

#16336
From: Paul Furbacher
Date: Tue, 02 Mar 1999 00:00
48 lines
2040 bytes
Bobby Healy wrote:
> 
> I want to be able to save to disk the entire state of a
> piece of my dialog. It's basically a listbox defined
> as follows-:
> 
> public class rwd_writablevectormodel extends
>   ListControl implements WritableVectorModel,Serializable

Do you really need to implement WritableVectorModel since
ListControl essentially implements the methods of this interface?
I suspect that the "VectorModel" in the "implements" phrase
of ListControl is a typo.  See the comment just above the
method, ListControl.canSet().
 
>[...]
>          out.writeObject(cListbox);

           out.flush();  ????

>          out.close();
> 
> and reloading it as follows-:

>             rwd_writablevectormodel rc=(rwd_writablevectormodel)in.readObject();

Do you test for ( rwd_writablevectormodel != null ) after this
before doing anything with it?

> When I try to work with the loaded object (to add a listner),
> I get the following exception-:
> 
> [...]
> System Error:   java.lang.NullPointerException
> 
> The code to add the handler is as follows-:
> 
>       jPanelList.addSelectionListener(...);

Are "cListBox" and "jPanelList" of type "rwd_writablevectormodel"?

Such serialization should work.  If not, then you have mixed
types, or you've put code in the wrong place and you are trying
to invoke methods on a non-existant object.  Can't really
tell from the incomplete and a bit incoherent snippets presented.


Paul Furbacher
Technical Details
Message-ID: <36DB7BEE.BDEBC9CA@bilbo.bio.purdue.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36D94AF3.850A8893@vti.ie>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,973a663a06213fa8
X-Google-Attributes: gidf74b3,public
From: Paul Furbacher <pf@bilbo.bio.purdue.edu>
Subject: Re: Serialization
Date: 1999/03/02
Message-ID: <36DB7BEE.BDEBC9CA@bilbo.bio.purdue.edu>
X-Deja-AN: 450256966
Content-Transfer-Encoding: 7bit
References: <36D94AF3.850A8893@vti.ie>
Content-Type: text/plain; charset=us-ascii
Organization: Reverse Alchemy, Inc.
Mime-Version: 1.0
Reply-To: pf@bilbo.bio.purdue.edu
Newsgroups: borland.public.jbuilder.java.language