Re: XMLEncoder problem
- From: "Ken T." <nowhere@xxxxxxxx>
- Date: 21 Dec 2008 23:00:00 GMT
On Sun, 21 Dec 2008 20:41:58 +0000, Arved Sandstrom wrote:
On Sun, 21 Dec 2008 06:27:37 +0000, Ken T. wrote:
On Sat, 20 Dec 2008 20:35:44 -0800, Mark Space wrote:
Ken T. wrote:
Thus the XMLEncode will notice that the property "words" (defined by
set/getWords) is actually different compared to the state after the
default constructor and writes the List to the output.
It is actually the variable, words, that doesn't seem to be being
saved.
Have I gone blind again? I don't see any setters or getters for words
at all, just word list. Even the add() method adds a world to
wordList, not words. Nothing that I see even touches "words".
If the method setWords() is called it initializes both wordList and
words. The only time words is really used is when a word is added to
the list. If it already exists, it is in words, then it isn't added
and an exception is thrown.
So when I use XMLDecoder I get all the words in wordList, but I'm still
able to add a word that already exists in wordList since words is not
updated. Somehow XMLDecoder is initializing wordList without calling
the setter. At least that is the best guess I have.
Based on the XML I saw, and printouts, I believe that the decoder is
creating an empty wordList, then calling add(Word word) on it for each
word. That's why you never see the setter called.
AHS
It doesn't hit a breakpoint there either. It must be accessing the
private member variables. I'll put together an sample program that shows
exactly what I'm talking about.
--
Ken T.
The question of whether computers can think is just like the question
of whether submarines can swim.
-- Edsger W. Dijkstra
.
- Follow-Ups:
- Re: XMLEncoder problem
- From: Arved Sandstrom
- Re: XMLEncoder problem
- References:
- XMLEncoder problem
- From: Ken T.
- Re: XMLEncoder problem
- From: Mark Space
- Re: XMLEncoder problem
- From: Thomas Kellerer
- Re: XMLEncoder problem
- From: Ken T.
- Re: XMLEncoder problem
- From: Mark Space
- Re: XMLEncoder problem
- From: Ken T.
- Re: XMLEncoder problem
- From: Arved Sandstrom
- XMLEncoder problem
- Prev by Date: Re: XMLEncoder problem
- Next by Date: Re: KeyEvent for % key?
- Previous by thread: Re: XMLEncoder problem
- Next by thread: Re: XMLEncoder problem
- Index(es):
Relevant Pages
|