2009/3/24 Matthew Toseland <[email protected]>:
> On Tuesday 17 March 2009 00:13:58 Daniel Cheng wrote:
>> On Mon, Mar 16, 2009 at 11:39 PM,  <[email protected]> wrote:
>> > Author: saces
>> > Date: 2009-03-16 15:39:05 +0000 (Mon, 16 Mar 2009)
>> > New Revision: 26046
>> >
>> > Modified:
>> >   branches/db4o/freenet/src/freenet/client/async/SingleFileInserter.java
>> > Log:
>> > fix npe on transient put
>> >
>> > Modified:
> branches/db4o/freenet/src/freenet/client/async/SingleFileInserter.java
>> > ===================================================================
>> > ---
> branches/db4o/freenet/src/freenet/client/async/SingleFileInserter.java      
> 2009-03-16
> 14:27:05 UTC (rev 26045)
>> > +++
> branches/db4o/freenet/src/freenet/client/async/SingleFileInserter.java      
> 2009-03-16
> 15:39:05 UTC (rev 26046)
>> > @@ -338,7 +338,7 @@
>> >                                container.deactivate(sfi, 1);
>> >                        }
>> >                        block.nullData();
>> > -                       removeFrom(container, context);
>> > +                       if(persistent) removeFrom(container, context);
>>
>> Instead of adding  "if (persistent) " everywhere,
>> why not just add it at the beginning of removeFrom() ?
>
> Because it's cheaper not to call it in the first place.

I think this is a fair trade to give up a little performance for
cleaner and less buggy code,
-- considering the number of patches and time spent on debugging these NPE.

>>
>> >                } else {
>> >                        SplitHandler sh = new SplitHandler();
>> >                        SplitFileInserter sfi = new
> SplitFileInserter(parent, sh, data, bestCodec, origSize,
> block.clientMetadata, ctx, getCHKOnly, metadata, token, archiveType,
> shouldFreeData, persistent, container, context);
>
> _______________________________________________
> Devl mailing list
> [email protected]
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
>
_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to