Re: Funky behavior...
Re: Funky behavior...
- Subject: Re: Funky behavior...
- From: Chuck Hill <email@hidden>
- Date: Tue, 12 Aug 2003 14:27:02 -0700
- Organization: Global Village Consulting, Inc.
The object bound to the item of a WORepetition will be set to null
after the last item in the repetition is processed.
If your submit button is below the list then I would expect the
exception you are getting. If you have one submit button per guest
(with a multiple submit form) then it should be OK.
What are you trying to do, just select an item from a list? If so, a
WOHyperlink might be more appropriate.
>>((Application)application()).addGuest(currentGuest);
Setting page/session level stuff into the application seems like a
very bad idea. You are going to end up with a list of selections from
different users which are in different editing contexts.
Chuck
Art Isbell wrote:
On Tuesday, August 12, 2003, at 07:35 AM, THOMAS PETERS wrote:
I said NullPointerException but am really getting
java.lang.IllegalArgumentException: Attempt to insert null.
'currentGuest' is a Key on the Main component and is assigned to the
WORepetition.item.
// here is the constructor for my Main WOComponent
public Main(WOContext context) {
super(context);
currentGuest = new Guest();
}
// here is the action method for the submit button in my form.
public WOComponent submitGuestForm() {
((Application)application()).addGuest(currentGuest);
currentGuest = new Guest();
return null;
}
If currentGuest is bound to your repetition's "item" key, then I
don't understand why your code is assigning a new Guest object to it.
WORepetition will set the currentGuest value as it iterates through the
objects in the object bound to its "list" key. But this isn't likely
related to the exception you're experiencing. Maybe if the object
bound to "list" is an empty array, currentGuest might not be assigned,
so maybe assigning a new Guest object to it would prevent a null
currentGuest from being added in the addGuest() method. But would
merely testing for currentGuest being null in addGuest() be a better
approach? If it's null at that point, you could create a new Guest
object if that's what you need.
java.lang.IllegalArgumentException: Attempt to insert null into an
com.webobjects.foundation.NSMutableArray.
[2003-08-12 13:30:08 EDT] <WorkerThread2>
java.lang.IllegalArgumentException: Attempt to insert null into an
com.webobjects.foundation.NSMutableArray.
at
com.webobjects.foundation.NSMutableArray.addObject(NSMutableArray.java:
211)
at Application.addGuest(Application.java:28)
It appears that currentGuest is null at line 28 in addGuest(). You
could avoid adding a null object by testing for currentGuest being null
prior to adding it to the array. Or if currentGuest should never be
null, you would need to debug your app to find out why it is null.
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
Progress is the mother of all problems.
- G. K. Chesterton
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.