2009/3/24 Matthew Toseland <toad at amphibian.dyndns.org>:
> On Tuesday 17 March 2009 00:13:58 Daniel Cheng wrote:
>> On Mon, Mar 16, 2009 at 11:39 PM, ?<saces at freenetproject.org> 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
> Devl at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
>