jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: svn commit: r1380337 - /jmeter/trunk/src/components/org/apache/jmeter/assertions/XMLSchemaAssertion.java
Date Mon, 03 Sep 2012 21:50:06 GMT
Right, sorry for mistake

On Monday, September 3, 2012, sebb wrote:

> On 3 September 2012 21:09,  <pmouawad@apache.org <javascript:;>> wrote:
> > Author: pmouawad
> > Date: Mon Sep  3 20:09:10 2012
> > New Revision: 1380337
> >
> > URL: http://svn.apache.org/viewvc?rev=1380337&view=rev
> > Log:
> > Add final to field
> > Add logger.isDebugEnabled
> >
> > Modified:
> >
> jmeter/trunk/src/components/org/apache/jmeter/assertions/XMLSchemaAssertion.java
> >
> > Modified:
> jmeter/trunk/src/components/org/apache/jmeter/assertions/XMLSchemaAssertion.java
> > URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/XMLSchemaAssertion.java?rev=1380337&r1=1380336&r2=1380337&view=diff
> >
> ==============================================================================
> > ---
> jmeter/trunk/src/components/org/apache/jmeter/assertions/XMLSchemaAssertion.java
> (original)
> > +++
> jmeter/trunk/src/components/org/apache/jmeter/assertions/XMLSchemaAssertion.java
> Mon Sep  3 20:09:10 2012
> > @@ -163,7 +163,7 @@ public class XMLSchemaAssertion extends
> >       * SAXErrorHandler class
> >       */
> >      private static class SAXErrorHandler implements ErrorHandler {
> > -        private AssertionResult result;
> > +        private final AssertionResult result;
> >
> >          public SAXErrorHandler(AssertionResult result) {
> >              this.result = result;
> > @@ -175,7 +175,9 @@ public class XMLSchemaAssertion extends
> >          public void error(SAXParseException exception) throws
> SAXParseException {
> >
> >              String msg = "error: " + errorDetails(exception);
> > -            log.debug(msg);
> > +            if(log.isDebugEnabled()) {
> > +                log.debug(msg);
> > +            }
>
> There's no point checking the debug setting here, as log.debug has to
> recheck the setting anyway.
>
> It's only worth protecting expensive operations with a check of
> isDebugEnabled(), e.g. where the log parameter has to calculated only
> for the the debug message.
>
> In this case, the calculation of the String has to be done anyway -
> that's why it's saved in a variable, so it can also be logged cheaply.
>
> >              result.setFailureMessage(msg);
> >              result.setError(true);
> >              throw exception;
> > @@ -188,7 +190,9 @@ public class XMLSchemaAssertion extends
> >          public void fatalError(SAXParseException exception) throws
> SAXParseException {
> >
> >              String msg = "fatal: " + errorDetails(exception);
> > -            log.debug(msg);
> > +            if(log.isDebugEnabled()) {
> > +                log.debug(msg);
> > +            }
> >              result.setFailureMessage(msg);
> >              result.setError(true);
> >              throw exception;
> > @@ -200,7 +204,9 @@ public class XMLSchemaAssertion extends
> >          public void warning(SAXParseException exception) throws
> SAXParseException {
> >
> >              String msg = "warning: " + errorDetails(exception);
> > -            log.debug(msg);
> > +            if(log.isDebugEnabled()) {
> > +                log.debug(msg);
> > +            }
> >              result.setFailureMessage(msg);
> >              // result.setError(true); // TODO is this the correct
> strategy?
> >              // throw exception; // allow assertion to pass
> >
> >
>


-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message