RE: Strange EOF exception
RE: Strange EOF exception
- Subject: RE: Strange EOF exception
- From: "Pierre Bernard" <email@hidden>
- Date: Thu, 22 Jan 2004 17:23:11 +0100
- Thread-topic: Strange EOF exception
Hi!
My colleague's sample code reads like this:
private void testEditingContext() {
boolean isLocking = true;
EOEditingContext ec = new EOEditingContext();
try {
if (isLocking)
ec.lock();
NSArray allEOs = EOUtilities.objectsForEntityNamed(ec, "TestEntity");
NSLog.out.appendln("fetched " + allEOs.count() + " objects");
TestEntity eo = (TestEntity) allEOs.lastObject();
NSLog.out.appendln("eo = " + eo);
eo.setVal(null);
try {
ec.saveChanges();
} catch (NSValidation.ValidationException ve) {
ve.printStackTrace();
}
NSLog.out.appendln("ec.hasChanges ? " + ec.hasChanges());
NSLog.out.appendln("ec.updatedObjects = " + ec.updatedObjects());
ec.deleteObject(eo);
ec.saveChanges();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (isLocking)
ec.unlock();
}
}
TestEntity has a validateForSave() method which always throws a validation exception. Thus the first save attempt will always fail.
We unfortunately have no longer have WO 5.2.1 installed anywhere.
I guess the problem is with some clean-up happening or not as the first attempt at saveChanges() fails. Looks like some field is reset to null.If we are unlucky it might even be related to garbage collection. That would make the problem only randomly reproducible.
I have no workaround, but will be glad to hear about any.
Pierre.
-----Original Message-----
From: Ben Ketteridge [mailto:email@hidden]
Sent: Thursday, January 22, 2004 5:11 PM
To: Pierre Bernard
Cc: WebObjects Developers; Apple WO Dev
Subject: Re: Strange EOF exception
Pierre Bernard wrote:
> I was just about to write a bug report about this. Well, I will within
> the next few days...
>
> I am seeing this if after saving an object failed over a validation error
> I attempt to delete the offinding object. A colleage has written a test > case I still have to look into. It appears that the bug cannot be
> reproduced on a WebObjects 5.1.3 machine.
>
> I'd be glad to have more information about this. Let's hope someone at
> Apple will feel this is worth a quick fix. Such unexpected crashes are no
> no good ... at all.
Can you reproduce it under WO5.2.1?
The operation where we see this error is certainly one where EOs are being deleted, though I'm not sure what validation our delete might be failing!
Could it be contention? (I doubt it myself)
Are you aware of any kind of workaround?
--
Kind Regards
Ben.
Dr Ben Ketteridge
email@hidden
Team Leader,
ProAct International,
PO Box 100, Denbigh, UK.
Tel: 01745 817161 ext. 322
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
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.