You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Glen Mazza <gl...@verizon.net> on 2007/11/09 23:24:38 UTC

Re: svn commit: r593444 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/addressing/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ systests/src/test/java/org/apache/cxf/systest/ws/add...

Am Freitag, den 09.11.2007, 07:48 +0000 schrieb mmao@apache.org:

> Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java?rev=593444&r1=593443&r2=593444&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java (original)
> +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingInInterceptor.java Thu Nov  8 23:48:19 2007
> @@ -37,16 +37,29 @@
>  public class LoggingInInterceptor extends AbstractPhaseInterceptor<Message> {
>  
>      private static final Logger LOG = LogUtils.getL7dLogger(LoggingInInterceptor.class);
> +    private final LoggingMessage buffer = new LoggingMessage("Inbound Message\n----------------------------");
>  
>      private int limit = 100 * 1024;
> +    private boolean enabled;

While it may be that "enabled" will be false by default, it is usually
better for readability to initialize that explicitly.  The reader is
never sure if "false" was the coder's intent, or that they simply forgot
to initialize this variable.


> Modified:
> incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java?rev=593444&r1=593443&r2=593444&view=diff
> ==============================================================================
> --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java (original)
> +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/LoggingOutInterceptor.java Thu Nov  8 23:48:19 2007
> @@ -37,18 +37,24 @@
>  
> +    public LoggingMessage getBuffer() {
> +        return this.buffer;
> +    }
>      
>      public void handleMessage(Message message) throws Fault {
>          final OutputStream os = message.getContent(OutputStream.class);
>          if (os == null) {
>              return;
>          }
> -        if (!LOG.isLoggable(Level.INFO)) {
> -            return;
> +
> +        if (LOG.isLoggable(Level.INFO) || enabled) {

&& enabled ?

Regards,
Glen




Re: svn commit: r593444 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/addressing/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ systests/src/test/java/org/apache/cxf/systest/ws/add...

Posted by Glen Mazza <gl...@verizon.net>.
I see:  http://www.javapractices.com/Topic14.cjp.  Never mind.

Glen

Am Freitag, den 09.11.2007, 17:33 -0500 schrieb Daniel Kulp:
> On Friday 09 November 2007, Glen Mazza wrote:
> > Am Freitag, den 09.11.2007, 07:48 +0000 schrieb mmao@apache.org:
> > >      private int limit = 100 * 1024;
> > > +    private boolean enabled;
> >
> > While it may be that "enabled" will be false by default, it is usually
> > better for readability to initialize that explicitly.  The reader is
> > never sure if "false" was the coder's intent, or that they simply
> > forgot to initialize this variable.
> 
> The PMD rules will prevent that.  Initializing values to the default 
> values just wastes processor time at construction time.
> 
> 


Re: svn commit: r593444 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/addressing/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ systests/src/test/java/org/apache/cxf/systest/ws/add...

Posted by Daniel Kulp <dk...@apache.org>.
On Friday 09 November 2007, Glen Mazza wrote:
> Am Freitag, den 09.11.2007, 07:48 +0000 schrieb mmao@apache.org:
> >      private int limit = 100 * 1024;
> > +    private boolean enabled;
>
> While it may be that "enabled" will be false by default, it is usually
> better for readability to initialize that explicitly.  The reader is
> never sure if "false" was the coder's intent, or that they simply
> forgot to initialize this variable.

The PMD rules will prevent that.  Initializing values to the default 
values just wastes processor time at construction time.


-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog