Re: Funky behavior...
Re: Funky behavior...
- Subject: Re: Funky behavior...
- From: Art Isbell <email@hidden>
- Date: Tue, 12 Aug 2003 10:57:03 -1000
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.