db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alejandro Rodríguez González <alejan...@alejandrorg.com>
Subject Re: Problem inserting
Date Tue, 16 Apr 2013 20:45:05 GMT
Hi!

Thanks John, I will take a look tomorrow to the code to see if this is the
problem.

Thanks!


On 16 April 2013 19:36, John English <john.foreign@gmail.com> wrote:

> On 16/04/2013 14:46, Alejandro Rodríguez González wrote:
>
>> Basically, I insert using this code:
>>
>>          public void insertInputs(Set<Input> ri) throws Exception {
>> [...snip...]
>>
>
> Don't know if it's relevant, but have you checked what ri contains on
> entry? I had a stupid bug once along these lines...
>
>   Set remove = oldResources;
>   Set add    = newResources;
>   if (add != null && oldResources != null) {
>     add.removeAll(oldResources);
>   }
>   if (remove != null && newResources != null) {
>     remove.removeAll(newResources)**;
>   }
>   ... insert the contents of "add", delete the contents of "remove" ...
>
> which doesn't work correctly because newResources is the same set as add,
> so the first "if" has already updated it... (sometimes I hate references!)
>
> With any luck, you'll have made a similar mistake, and it'll be an easy
> fix. If you're smarter than I was and have avoided this particular bug,
> then you'll need to post the less "interesting" parts of your code.
>
> HTH,
> --
> John English
>



-- 
Dr. Alejandro Rodríguez González - PhD

Bioinformatics at Centre for Plant Biotechnology and Genomics UPM-INIA
Polytechnic University of Madrid
http://www.alejandrorg.com
Phone: +34 914524900 . Ext: 25550


*Once the game is over, the king and the pawn go back in the same box. -
Italian proverb*

Mime
View raw message