Re: [Cocoa-Java] Seeking some explanations around anNotSerializableException
Re: [Cocoa-Java] Seeking some explanations around anNotSerializableException
- Subject: Re: [Cocoa-Java] Seeking some explanations around anNotSerializableException
- From: Frédéric BLANC <email@hidden>
- Date: Mon, 24 Jan 2005 21:17:05 +0100
Hi Glen. And thanks for your answer.
> | Note: I hadn't put the trace in my former post since I'm not sure it helps :( !
> The rule is, include information unless you're *sure* it *won't* help. (If you don't know the problem, you don't know what information is important, and it's always better to err on the side of too much than too little.) Invariably, it's *critical* to know what specific action your code is doing at the time it fails.
You're plain right; sorry for the loss of time. But I thought it
wouldn't help ;) ! (See below because I'm still not sure it helps...)
> Here, the stack trace explains it all: You're calling "clone()" (...)
I'm not (explicitely) calling "clone()"; the underlying
framework/wrapper/system surely might, but I don't have any occurence
of the word "clone" in my project. (Just done the search--to be
SURE--before replying.)
> and the clone method clearly creates the duplicate by serializing the original and deserializing the resulting data into a new object. This approach requires that everything to be cloned is serializable. Your class isn't, so the cloning process breaks.
I agree; then, your explanation which followed was rather clear. But I
still don't get what "it" is doing when I invoke the "Customize
Toolbar..." action. It might clone toolbar items, sure (to save state
of whatever); but I haven't found any mention of this in Apple's
documentation, any note that warns the developer to make his/her
toolbar controller serializable. (Perhaps I should have listened to my
e-friends not to follow the Cocoa-Java path ;) !)
> (Why does it try to clone the delegate? Probably because it doesn't know not to
"Because it doesn't know not to..." what? Not to... serialize? Sorry,
I didn't get your last sentence.
> If you want the controller to be cloned, you'll have to make it serializable.
I agree with you; but I didn't want it to be cloned, so I didn't make
it serializable. I've understood by reading the log what "it" was
trying to do, but not why.
> Otherwise, set the delegate to null before doing the clone, clone the toolbar, then set the delegate for *both* toolbars (original and clone) to the original's delegate.
Argh! This would be simple if I had asked the toolbar to be cloned ;)
! But I didn't :( ! Now, I'm not sure what to do...
I think an Xcode project will be helpful here... I'll try to build
something simple around this issue and post a link soon. Otherwise,
since reflecting the selection's state in my toolbar item is not
crucial (but "just" an attention-to-details task), I may just drop my
idea for the time being :( !
Thanks again, Glen. And sorry for the inconvenience, but it's very
frustrating not to completely understand what happens "below" :) !
— Frédéric BLANC (email@hidden)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden