• 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
deep down NPE in EOF
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

deep down NPE in EOF


  • Subject: deep down NPE in EOF
  • From: Zak Burke <email@hidden>
  • Date: Sun, 04 Nov 2007 11:09:19 -0500

I'm getting a strange NPE from deep down in EOF that I can't figure out. I think it might be related to some slightly funky modeling I'm doing, but my EOs work fine in other places so I'm not sure why they're broken here.

Here's the funkiness: I have two models -- NameStore and MyApp. NameStore contains a single EO, StoredName. MyApp has an EO MyAppPerson that extends StoredName, but the restricting qualifier is just "id > 0", that is, all StoredName EOs are MyAppPerson EOs. Basically, we have lots of (non-WO) apps that use the StoredName table and have their own tables joined to it. I modeled it in WO this way to keep the NameStore EO pristine -- all it does is hand out names -- while allowing other apps to tack things onto a local EO that extends StoredName.

What I want to do is retrieve a StoredName and then bless it into existence by re-fetching it as a MyAppPerson so I can access all its related objects. Because the StoredName and the MyAppPerson share the same primary key value, I'm just passing storedName.id() to a MyAppPerson method that retrieves items by their PKs.

try {
return (MyAppPerson) EOUtilities.objectMatchingKeyAndValue(ec, MyAppPerson.ENTITY_NAME, MyAppPerson.ID_KEY, id);
} catch (EOObjectNotAvailableException e) {
throw new RuntimeException("An MyAppPerson identified by " + id + " could not be found.");
} catch (EOUtilities.MoreThanOneException e) {
throw new RuntimeException("More than one MyAppPerson identified by " + id + " was found.");
}


The fetch works fine; I get an object back. But EOF explodes when I true access it, even just item.toString() to print it to a log (stacktrace below). It appears to be exploding after traversing an optional to-many join. I can use MyAppPerson items elsewhere so I don't think I have modeling errors, but, well, I'm totally stumped. Any ideas?

TIA,

zak.


[2007-11-04 10:18:08 EST] <WorkerThread0> java.lang.NullPointerException
at com.webobjects.eoaccess.EODatabaseContext.arrayFaultWithSourceGlobalID(EODatabaseContext.java:3664)
at com.webobjects.eoaccess.EODatabaseContext._fireDeferredFaultWithSourceObject(EODatabaseContext.java:2551)
at com.webobjects.eoaccess.EOAccessDeferredFaultHandler.createFaultForDeferredFault(EOAccessDeferredFaultHandler.java:45)
at com.webobjects.eocontrol.EOCustomObject.willReadRelationship(EOCustomObject.java:1302)
at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer$_LazyGenericRecordBinding.valueInObject(_EOMutableKnownKeyDictionary.java:560)
at com.webobjects.eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:1736)
at edu.dartmouth.dltg.authorization.eos._AuthzPerson.roles(_AuthzPerson.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor$1.methodValue(NSKeyValueCoding.java:684)
at com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject(NSKeyValueCoding.java:1160)
at com.webobjects.eocontrol.EOCustomObject.valueForKey(EOCustomObject.java:1559)
at com.webobjects.eocontrol.EOCustomObject.eoDescription(EOCustomObject.java:793)
at com.webobjects.eocontrol.EOCustomObject.toString(EOCustomObject.java:239)
at java.lang.String.valueOf(String.java:2615)
at java.lang.StringBuffer.append(StringBuffer.java:220)
at edu.dartmouth.dltg.authorization.pages.RoleEditPeople.doSaveDnd(RoleEditPeople.java:138)


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: deep down NPE in EOF
      • From: Chuck Hill <email@hidden>
  • Prev by Date: WO 5.3/5.4 switch script for Leopard.
  • Next by Date: [philosophical question] Direct component access: does it have any use at all?
  • Previous by thread: Re: WO 5.3/5.4 switch script for Leopard.
  • Next by thread: Re: deep down NPE in EOF
  • Index(es):
    • Date
    • Thread