Then test it because the only difference is that instead put the "if
(log.IsDebugEnabled)" everywhere I'm putting it before Log4Net will call the
ToString.
The fix prevents the same bug for all logs we have in NH.
The problem was fixed at the root ;)

On Tue, May 3, 2011 at 5:10 PM, MarcGerritsen <[email protected]>wrote:

> I saw te commit you made to fix this bug on all NHibernate code but i
> don't think this will work.
> On the call to logger.Debug the parameters are initialized.
> This also initialises the message string.
> The construction of the message string triggers the call to ToString
> on the proxy
> This way the proxy is still initialized.
> It does not fix the problem as far as i know.
> Must say that i did not test it as i am quite busy these days.
>
> On 2 mei, 10:29, MarcGerritsen <[email protected]> wrote:
> > JIRA createdhttp://216.121.112.228/browse/NH-2685
> >
> > On 2 mei, 10:14, "Richard Brown \(gmail\)" <[email protected]>
> > wrote:
> >
> >
> >
> > > Hmm ... maybe it's a DNS issue then ... I take it the direct IP address
> link
> > > works ok?
> >
> > >http://216.121.112.228/
> >
> > > -----Original Message-----
> > > From: Richard Wilde
> > > Sent: Monday, May 02, 2011 9:08 AM
> > > To: [email protected]
> > > Subject: RE: [nhibernate-development] Re: Bug: unnecessary proxy
> >
> > > initialisation in CriteriaQueryTranslator
> >
> > > It's down for me...
> >
> > >http://jira.nhforge.org/
> >
> > > -----Original Message-----
> > > From: [email protected]
> > > [mailto:[email protected]] On Behalf Of Richard
> Brown
> > > (gmail)
> > > Sent: 02 May 2011 08:56
> > > To: nhibernate-development
> > > Subject: Re: [nhibernate-development] Re: Bug: unnecessary proxy
> > > initialisation in CriteriaQueryTranslator
> >
> > > That link works for me? ... and redirects me to:
> >
> > >http://216.121.112.228/
> >
> > > -----Original Message-----
> > > From: MarcGerritsen
> > > Sent: Monday, May 02, 2011 8:54 AM
> > > To: nhibernate-development
> > > Subject: [nhibernate-development] Re: Bug: unnecessary proxy
> initialisation
> > > in CriteriaQueryTranslator
> >
> > > Is the JIRA down or am i looking in the wrong place?
> http://jira.nhforge.org/
> >
> > > On 2 mei, 00:30, Fabio Maulo <[email protected]> wrote:
> > > > Please, can you file a new JIRA ticket ?
> > > > Thanks.
> >
> > > > On Sun, May 1, 2011 at 6:10 PM, MarcGerritsen
> > > > <[email protected]>wrote:
> >
> > > > > Hello,
> >
> > > > > I found a bug in the CriteriaQueryTranslator.
> > > > > For the construction of a debug string the ToString method is calld
> on
> > > > > a proxy.
> > > > > This initializes the proxy unnecessary.
> > > > > To make sure this does not happen anymore i wrapped the logger
> lines
> > > > > with if (logger.IsDebugEnabled).
> > > > > Below I give you the patch created to fix the bug.
> >
> > > > > Marc Gerritsen
> >
> > > > > Index: CriteriaQueryTranslator.cs
> > > > > ===================================================================
> > > > > --- CriteriaQueryTranslator.cs  (revision 5792)
> > > > > +++ CriteriaQueryTranslator.cs  (working copy)
> > > > > @@ -313,7 +313,8 @@
> > > > >                {
> > > > >                        ICriteria result;
> > > > >                        associationPathCriteriaMap.TryGetValue(path,
> out
> > > > > result);
> > > > > -                       logger.DebugFormat("getCriteria for
> path={0}
> > > > > crit={1}", path,
> > > > > result);
> > > > > +            if (logger.IsDebugEnabled)
> > > > > +                           logger.DebugFormat("getCriteria for
> path={0}
> > > > > crit={1}", path,
> > > > > result);
> > > > >                        return result;
> > > > >                }
> >
> > > > > @@ -498,7 +499,8 @@
> > > > >                        foreach (string token in tokens)
> > > > >                        {
> > > > >                                componentPath += token;
> > > > > -                               logger.DebugFormat("searching for
> {0}",
> > > > > componentPath);
> > > > > +                if (logger.IsDebugEnabled)
> > > > > +                                   logger.DebugFormat("searching
> for
> > > > > {0}",
> > > > > componentPath);
> > > > >                                IType type =
> > > > > provider.GetType(componentPath);
> > > > >                                if (type.IsAssociationType)
> > > > >                                {
> > > > > @@ -535,9 +537,9 @@
> > > > >                                        throw new
> QueryException("not an
> > > > > association: " +
> > > > > componentPath);
> > > > >                                }
> > > > >                        }
> > > > > -
> > > > > -                       logger.DebugFormat("returning entity
> name={0}
> > > > > for
> > > > > path={1}
> > > > > class={2}",
> > > > > -                               provider.Name, path,
> > > > > provider.GetType().Name);
> > > > > +            if (logger.IsDebugEnabled)
> > > > > +                           logger.DebugFormat("returning entity
> > > > > name={0}
> > > > > for path={1}
> > > > > class={2}",
> > > > > +                                   provider.Name, path,
> > > > > provider.GetType().Name);
> > > > >                        return provider;
> > > > >                }
> >
> > > > > @@ -554,8 +556,9 @@
> > > > >                                        alias = me.Value.Name; //
> the
> > > > > entity name
> > > > >                                }
> > > > >                                criteriaSQLAliasMap[crit] =
> > > > > StringHelper.GenerateAlias(alias, i+
> > > > > +);
> > > > > -                               logger.DebugFormat("put
> criteria={0}
> > > > > alias={1}",
> > > > > -                                       crit,
> > > > > criteriaSQLAliasMap[crit]);
> > > > > +                if(logger.IsDebugEnabled)
> > > > > +                                   logger.DebugFormat("put
> criteria={0}
> > > > > alias={1}",
> > > > > +                                           crit,
> > > > > criteriaSQLAliasMap[crit]);
> > > > >                        }
> > > > >                        criteriaSQLAliasMap[rootCriteria] =
> rootSQLAlias;
> > > > >                }
> > > > > @@ -568,7 +571,8 @@
> > > > >                public string GetSQLAlias(ICriteria criteria)
> > > > >                {
> > > > >                        String alias =
> criteriaSQLAliasMap[criteria];
> > > > > -                       logger.DebugFormat("returning alias={0} for
> > > > > criteria={1}", alias,
> > > > > criteria);
> > > > > +            if (logger.IsDebugEnabled)
> > > > > +                           logger.DebugFormat("returning alias={0}
> for
> > > > > criteria={1}",
> > > > > alias, criteria);
> > > > >                        return alias;
> > > > >                }
> >
> > > > --
> > > > Fabio Maulo- Tekst uit oorspronkelijk bericht niet weergeven -
> >
> > - Tekst uit oorspronkelijk bericht weergeven -




-- 
Fabio Maulo

Reply via email to