Re: Objects don't get initialized sometimes
Re: Objects don't get initialized sometimes
- Subject: Re: Objects don't get initialized sometimes
- From: Guido Neitzer <email@hidden>
- Date: Mon, 11 Jan 2010 08:51:09 -0800
Are you using a change notification framework?
Take care,
Guido
On 11. Jan. 2010, at 04:26 , Gennady Kushnir wrote:
> Hello again.
> I've got it that I was doing something wrong. I've found and removed
> several commandments violations, employed MultiECLockManager for
> properly locking everything... but I am still getting these errors!
> How could I track where is that violation hidden within over 5000 rows of code?
>
> These errors raise without any visible dependencies.
> Users report that even when system says that it could not save
> something (because of that strange error), actually data is saved and
> can be reviewed after logging out and in again.
>
> I tried to find the source of error adding logging to awakeFromFetch
> when snapshot is uninitialized. But this log has never fired yet
> whereas I have already seen errors related to empty snapshot of object
> of that class...
> I am confused now...
>
> 2009/11/3 Chuck Hill <email@hidden>:
>> Start here:
>> http://wiki.objectstyle.org/confluence/display/WO/EOF-Using+EOF-Breaking+EOF
>>
>> Then
>> http://www.google.com/search?q=llegalStateException+rowDiffsForAttributes+snapshot
>>
>>
>> Chuck
>>
>>
>> On Nov 3, 2009, at 2:02 AM, Gennady Kushnir wrote:
>>
>>> Hello list!
>>> I have an occasionally occurring problem which I can not reproduce but
>>> regularly meet in usage logs.
>>> Editing context fails to save changes and reports:
>>>
>>> java.lang.IllegalStateException: rowDiffsForAttributes: snapshot in
>>> com.webobjects.eoaccess.EODatabaseOperation {_dbSnapshot = {}; ..... }
>>> does not contain value for attribute named colorNoWeight with snapshot
>>> key: colorNoWeight
>>>
>>> it also happens for different objects mentioning another attributes,
>>> but as I see a common situation is that _dbSnapshot value is empty
>>> dictionary so no matter what attribute is mentioned. Why could this
>>> happen?
>>> Object in question was surely in database, not just created or deleted.
>>>
>>> Also sometimes I get NullPointerException when accessing attributes
>>> described as not null, so it seems like object was not initialized on
>>> fetch.
>>>
>>> May it be because these objects were fetched or created and saved in
>>> child editing context and after that used (with
>>> EOUtilities.localInstanceOfObject() ) in parent ?
>>>
>>> Once I got reproducible malfunction working with temporary
>>> EOEditingContext.
>>> EOUtilities.localInstanceOfObject(ec, this) was returning an objects
>>> with all attributes set to null whereas original object was fine and
>>> was stored in database even before app launch.
>>>
>>> try {
>>> boolean cache = ec.hasChanges()
>>> if(cache) {
>>> ec = new EOEditingContext();
>>> ec.lock();
>>> AutoItog ai =
>>> (AutoItog)EOUtilities.localInstanceOfObject(ec, this);
>>> course =
>>> (EduCourse)EOUtilities.localInstanceOfObject(ec, course);
>>> result =
>>> calculator().collectRelated(course, ai,
>>>
>>> !namedFlags().flagForKey("runningTotal"),true);
>>> } else {
>>> ec.lock();
>>> result =
>>> calculator().collectRelated(course, this,
>>>
>>> !namedFlags().flagForKey("runningTotal"),true);
>>> }
>>> ec.saveChanges();
>>> if(cache)
>>> result =
>>> EOUtilities.localInstancesOfObjects(editingContext(), result);
>>> } catch (RuntimeException e) {
>>> logger.log(LogLevel.WARNING,"Error
>>> collecting related", new
>>> Object[] {this,e});
>>> } finally {
>>> ec.unlock();
>>> }
>>> _______________________________________________
>>> 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
>>
>> --
>> Chuck Hill Senior Consultant / VP Development
>>
>> Practical WebObjects - for developers who want to increase their overall
>> knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/products/practical_webobjects
>>
>>
>>
>>
>>
>>
>>
>>
> _______________________________________________
> 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
--
http://www.event-s.net
_______________________________________________
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