On 2015-01-21, 1:00 PM, "OC" wrote:

It is more likely that the EC got reverted after the insert and your code still 
has a reference to the EO, or the EO got deleted and your code still has a 
reference to it.  Can the users backtrack?

Is there a way to really prevent the disaster?

Not unless amputation is an option.  :-)


Anyway my app does contain

setPageRefreshOnBacktrackEnabled(YES);

but still there are occassional problems (especially with Safari some time ago 
I've encountered at least one case when my server simply was not informed at 
all that user did backtrack -- it was all right in other browsers --, and then 
I got a completely nonsense action from the page).

I've seen this sort of thing caused by backtracking.  It is usually unexpected 
code paths, rather than obviously incorrect code

thanks a lot!
OC

On 2015-01-21, 12:20 PM, "OC" wrote:
I believe you both, but my problem is
(a) far as I remember, I create my EOs using 
EOUtilities.createAndInsertInstance, exclusively;
(b) since my memory is not reliable, I've used grep, and there's not one "new 
DBRecord" nor "new DBAuction" in my whole project
(c) I happen to override toString for my EOs and log the EC there, and in my 
logs, there's not one null EC.
Actually the (very probably, can't be entirely sure from the log) offending 
DBRecord has been logged out shortly before the NPE, with null PK (for it was 
newly created, which makes sense), and... a non-null EC.
That all said, of course it is still possible I've got either a DBRecord or its 
related DBAuction with null EC due to some strange bug, but darn, it's weird :-O
Thanks a lot,
OC
On 21. 1. 2015, at 18:26, Chuck Hill 
<[email protected]<mailto:[email protected]>> wrote:
I am pretty sure that Hugi is right here.
On 2015-01-21, 6:04 AM, "Hugi Thordarson" wrote:
Are you sure your object is in an editing context?
Cheers,
- hugi
// Hugi Thordarson
// http://www.loftfar.is/
// s. 895-6688
On 21. jan. 2015, at 14:01, OC <[email protected]<mailto:[email protected]>> wrote:
Hello there,
how on earth can this happen?!?
===
Caused by: java.lang.NullPointerException
at 
com.webobjects.eocontrol.EOCustomObject.willReadRelationship(EOCustomObject.java:1270)
at 
er.extensions.eof.ERXGenericRecord.willReadRelationship(ERXGenericRecord.java:380)
at 
com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer$_LazyGenericRecordBinding.valueInObject(_EOMutableKnownKeyDictionary.java:614)
at 
er.extensions.eof.ERXGenericRecord$TouchingBinding.valueInObject(ERXGenericRecord.java:209)
at 
com.webobjects.eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:1634)
at 
com.webobjects.eocontrol.EOCustomObject$storedValueForKey$0.callCurrent(Unknown 
Source)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at 
com.webobjects.eocontrol.EOCustomObject$storedValueForKey$0.callCurrent(Unknown 
Source)
at model._DBRecord.auction(_DBRecord.groovy:61)
===
The _DBRecord thing is one of the pretty old legacy parts, standard EO code as 
generated in an Eclipse project by its eogenerator, as it used to work a couple 
of years ago when I used Eclipse the last time:
===
   public static final ERXKey<model.DBAuction> AUCTION = new 
ERXKey<model.DBAuction>("auction");
...
   public static final String AUCTION_KEY = AUCTION.key();
...
   public model.DBAuction auction() {
     (model.DBAuction)storedValueForKey(_DBRecord.AUCTION_KEY) // <== line 61
   }
===
The relationship should be nonempty, but even if it was empty, it should simply 
return null from storedValueForKey, and not NPE?!? :-O
Thanks for any insight,
OC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      
([email protected]<mailto:[email protected]>)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is
This email sent to [email protected]<mailto:[email protected]>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to