• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Strange EOF exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange EOF exception


  • Subject: Re: Strange EOF exception
  • From: Jonathan Rochkind <email@hidden>
  • Date: Thu, 22 Jan 2004 11:01:32 -0600

Whether 'val' is a to-one relationship, or a simple attribute, setVal(null) should be quite acceptable to EOF. I do it all the time. I've never tried or thought of manually setting a relationship or attribute to EOKeyValueCoding.NullValue---I would have suspected that would lead to problems down the line. But if you've been doing it no problem, it may be that it ends up being just the same as using 'null' as the argument.

In general, EOF (or the foundation framework) uses EOKeyValueCoding.NullValue (which is actually the same as NSKeyValueCoding.NullValue) to represent a 'null' db value _in data structures where an ordinary 'null' value wouldn't ordinarily be allowed_ like an NSDictionary. For actual EOs, an ordinary null value is usually used, both for a return value or for an argument.

--Jonathan

At 5:34 PM +0100 1/22/04, Ulrich Kvster wrote:
Hi,

may be I'm totally wrong but shouldn't  it be

eo.setVal(EOKeyValueCoding.NullValue);

instead of

eo.setVal(null);

Ulrich

Am 22.01.2004 um 17:23 schrieb Pierre Bernard:

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
http://www.omnigroup.com/mailman/listinfo/webobjects-dev

_______________________________________________ WebObjects-dev mailing list email@hidden http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
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.

References: 
 >RE: Strange EOF exception (From: "Pierre Bernard" <email@hidden>)
 >Re: Strange EOF exception (From: Ulrich Köster <email@hidden>)

  • Prev by Date: RE: Strange EOF exception
  • Next by Date: changing an application project to a framework?
  • Previous by thread: Re: Strange EOF exception
  • Next by thread: RE: Strange EOF exception
  • Index(es):
    • Date
    • Thread