Re: Objects don't get initialized sometimes
Re: Objects don't get initialized sometimes
- Subject: Re: Objects don't get initialized sometimes
- From: Gennady Kushnir <email@hidden>
- Date: Thu, 14 Jan 2010 01:05:24 +0300
2010/1/13 Chuck Hill <email@hidden>:
>
> On Jan 13, 2010, at 4:04 AM, Gennady Kushnir wrote:
>
>> may this be the reason?
>>
>> public void setWeight(BigDecimal aValue) {
>> if(weight().compareTo(aValue) != 0) {
>> if(weight().compareTo(BigDecimal.ZERO) == 0
>> || aValue.compareTo(BigDecimal.ZERO) == 0)
>> _integralPresenter = null;
>> super.setWeight(aValue);
>> }
>> }
>>
>> public BigDecimal weight() {
>> BigDecimal weight = super.weight();
>> if(weight == null) return null;
>> if(weight.compareTo(BigDecimal.ZERO) == 0)
>> return BigDecimal.ZERO;
>> weight = weight.stripTrailingZeros();
>> if(weight.scale() < 0)
>> weight.setScale(0);
>> return weight;
>> }
>>
>> where weight is EO attribute
>
> I don't think that will cause this problem.
That's too sad... I did hope I found a fault...
It looks like direct violation of commandment to avoid modification of
returned values in getter methods.
Well anyway, I think I'll get rid of it and see what happens. Sadly I
can not give up searching my code for such faults...
>
>
>> And another guess: fetching from the same ec for setting default
>> values in awakeFromInsertion?
>
> That is OK.
In fact I'm glad to hear that. I wouldn't like to look for alternative
solutions.
>
> Chuck
>
>
>>
>> 2010/1/12 Chuck Hill <email@hidden>:
>>>
>>> On Jan 11, 2010, at 2:14 PM, Gennady Kushnir wrote:
>>>
>>>> I am on MySQL 5.0.x
>>>> I don't use change notification framework.
>>>> Stack trace of exception says it is raised during ec.saveChanges().
>>>>
>>>> May it be caused by using nested editing contexts?
>>>
>>> Maybe if you are using them incorrectly.
>>>
>>>
>>>> Unfortunately I have no idea how to isolate a problem. I can not even
>>>> reproduce it.
>>>> Myself I have only seen it once "in action". Mostly I can only see it
>>>> in logs. And I can't afford to limit functionality of a working
>>>> system.
>>>> Furthermore I assume it is in the most actively employed part of a
>>>> system. As most errors take place there. But maybe it is only because
>>>> the majority of saves are performed there...
>>>>
>>>> Maybe I could diagnose the problem injecting some testing somewhere?
>>>> Maybe in editingContext subclass?
>>>
>>> I'd start by taking a careful look at the full exception stack traces to
>>> see
>>> if you can isolate where this is happening and then go back and very
>>> carefully review that code.
>>>
>>> After that, you would need to start disassembling the Java to see where
>>> things go wrong and try and get some information logged out. That may
>>> require replacing parts of EOF. This is far easier with Wonder but it is
>>> still not easy. I have had the most success by carefully looking at the
>>> code after looking at the stack traces.
>>>
>>>
>>> Chuck
>>>
>>>
>>>>
>>>>
>>>> 2010/1/11 Kieran Kelleher <email@hidden>:
>>>>>
>>>>> On Jan 11, 2010, at 1:59 PM, Chuck Hill wrote:
>>>>>
>>>>>> On Jan 11, 2010, at 10:33 AM, Kieran Kelleher wrote:
>>>>>>>
>>>>>>> On Jan 11, 2010, at 1:03 PM, Chuck Hill wrote:
>>>>>>>>
>>>>>>>> On Jan 11, 2010, at 4:26 AM, 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?
>>>>>>>>
>>>>>>>> There are many, many ways in which things can be done wrong. I
>>>>>>>> don't
>>>>>>>> know of any easy way to find the source. If you can isolate and
>>>>>>>> reproduce
>>>>>>>> the problem in a minimum set of steps, that will reduce the amount
>>>>>>>> of
>>>>>>>> code
>>>>>>>> you have to look at.
>>>>>>>>
>>>>>>>>
>>>>>>>>> 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.
>>>>>>>>
>>>>>>>> Something else is happening in your code then. Perhaps this is not
>>>>>>>> from
>>>>>>>> a save? Nothing should get written to the database if this happens
>>>>>>>> during a
>>>>>>>> saveChanges. Maybe this is happening in your app just after
>>>>>>>> saveChanges()?
>>>>>>>
>>>>>>> Hmmm ....... half-saving transactions is a common problem when you
>>>>>>> don't
>>>>>>> use a transactional database and no "transaction rollback" is
>>>>>>> available
>>>>>>> when
>>>>>>> ec fails during a save. What database engine are you using?
>>>>>>
>>>>>>
>>>>>> Now who would use a squirrelly mock database like that?!!?
>>>>>
>>>>>
>>>>> Someone who acquires a Ferrari and drives it in first gear because they
>>>>> have
>>>>> never used a "stick-shift" car before! :-P
>>>>>
>>>>>
>>>>>>
>>>>>> :-P
>>>>>>
>>>>>> Chuck
>>>>>>
>>>>>> --
>>>>>> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>
>>> --
>>> 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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>
> --
> 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