You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Jeff MAURY <je...@gmail.com> on 2013/07/25 16:37:13 UTC

Re: git commit: fixed sonar violations

There is still one line of commented code in CoapDecoder


Jeff
—
Sent from Mailbox for iPhone

On Thu, Jul 25, 2013 at 3:00 PM, null <ap...@apache.org> wrote:

> Updated Branches:
>   refs/heads/trunk 51dd5213d -> 52009f32f
> fixed sonar violations
> Project: http://git-wip-us.apache.org/repos/asf/mina/repo
> Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/52009f32
> Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/52009f32
> Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/52009f32
> Branch: refs/heads/trunk
> Commit: 52009f32fb0329129d12f3812b4ee886c8a9fbac
> Parents: 51dd521
> Author: paliwalashish <pa...@gmail.com>
> Authored: Thu Jul 25 18:29:45 2013 +0530
> Committer: paliwalashish <pa...@gmail.com>
> Committed: Thu Jul 25 18:29:45 2013 +0530
> ----------------------------------------------------------------------
>  .../java/org/apache/mina/coap/codec/CoapDecoder.java    | 12 ------------
>  .../org/apache/mina/coap/resource/CoapResponse.java     |  6 +++---
>  2 files changed, 3 insertions(+), 15 deletions(-)
> ----------------------------------------------------------------------
> http://git-wip-us.apache.org/repos/asf/mina/blob/52009f32/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> ----------------------------------------------------------------------
> diff --git a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> index 603f311..616f683 100644
> --- a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> +++ b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> @@ -78,10 +78,6 @@ public class CoapDecoder implements StatelessProtocolDecoder<ByteBuffer, CoapMes
>          // LOG.debug("id : {}", id);
>          input.get(token);
>  
> -        // if (LOG.isDebugEnabled()) {
> -        // LOG.debug("token : {}", ByteBufferDumper.toHex(ByteBuffer.wrap(token)));
> -        // }
> -
>          // decode options
>          int optionCode = 0;
>          byte[] payload = EMPTY_PAYLOAD;
> @@ -94,9 +90,6 @@ public class CoapDecoder implements StatelessProtocolDecoder<ByteBuffer, CoapMes
>                  // LOG.debug("start of payload");
>                  payload = new byte[input.remaining()];
>                  input.get(payload);
> -                // if (LOG.isDebugEnabled()) {
> -                // LOG.debug("payload : {}", ByteBufferDumper.dump(ByteBuffer.wrap(payload)));
> -                // }
>                  break;
>              } else {
>                  int optionDeltaQuartet = (next >> 4) & 0xF;
> @@ -122,7 +115,6 @@ public class CoapDecoder implements StatelessProtocolDecoder<ByteBuffer, CoapMes
>                  input.get(optionValue);
>  
>                  options.add(new CoapOption(optType, optionValue));
> -                ;
>              }
>          }
>  
> @@ -144,10 +136,6 @@ public class CoapDecoder implements StatelessProtocolDecoder<ByteBuffer, CoapMes
>          if (value < 13) {
>              return value;
>          } else if (value == 13) {
> -            // if (LOG.isDebugEnabled()) {
> -            // int val = input.get(input.position()) & 0xFF;
> -            // LOG.debug("byte : {}", val);
> -            // }
>              return (input.get() & 0xFF) + 13;
>          } else if (value == 14) {
>              return (input.getShort() & 0xFFFF) + 269;
> http://git-wip-us.apache.org/repos/asf/mina/blob/52009f32/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> ----------------------------------------------------------------------
> diff --git a/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java b/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> index b9bb658..9ebeb79 100644
> --- a/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> +++ b/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> @@ -31,10 +31,10 @@ import org.apache.mina.coap.CoapOption;
>   */
>  public class CoapResponse {
>  
> -    public int code;
> -    public byte[] content;
> +    private int code;
> +    private byte[] content;
>  
> -    public CoapOption[] options;
> +    private CoapOption[] options;
>  
>      /**
>       * Create the CoAP response for a resource request.

Re: git commit: fixed sonar violations

Posted by Ashish <pa...@gmail.com>.
Ok, got it.

The following are commented and might be useful while debugging decoding

LOG.debug("version : {}", version);
LOG.debug("type : {}", type);
LOG.debug("code : {}", code);
LOG.debug("id : {}", id);


If you feel they are not needed, shall remove them.


On Thu, Jul 25, 2013 at 8:22 PM, Julien Vermillard <jv...@gmail.com>wrote:

> hmm it's some decoder debug statement commented during performance testing.
>
> I think we can remove them since the code is working and I don't think
> we need to enable them again.
>
> --
> Julien Vermillard :::: http://people.apache.org/~jvermillard/
>
>
> On Thu, Jul 25, 2013 at 4:41 PM, Ashish <pa...@gmail.com> wrote:
> > Thanks Jeff ! There are more commented line.
> > Need to touch-base with Julien to check if some of them need to be
> enabled
> > for debugging.
> > Some of them can be worthy debug statements.
> >
> >
> > On Thu, Jul 25, 2013 at 8:07 PM, Jeff MAURY <je...@gmail.com> wrote:
> >
> >> There is still one line of commented code in CoapDecoder
> >>
> >>
> >> Jeff
> >> —
> >> Sent from Mailbox for iPhone
> >>
> >> On Thu, Jul 25, 2013 at 3:00 PM, null <ap...@apache.org> wrote:
> >>
> >> > Updated Branches:
> >> >   refs/heads/trunk 51dd5213d -> 52009f32f
> >> > fixed sonar violations
> >> > Project: http://git-wip-us.apache.org/repos/asf/mina/repo
> >> > Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/52009f32
> >> > Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/52009f32
> >> > Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/52009f32
> >> > Branch: refs/heads/trunk
> >> > Commit: 52009f32fb0329129d12f3812b4ee886c8a9fbac
> >> > Parents: 51dd521
> >> > Author: paliwalashish <pa...@gmail.com>
> >> > Authored: Thu Jul 25 18:29:45 2013 +0530
> >> > Committer: paliwalashish <pa...@gmail.com>
> >> > Committed: Thu Jul 25 18:29:45 2013 +0530
> >> > ----------------------------------------------------------------------
> >> >  .../java/org/apache/mina/coap/codec/CoapDecoder.java    | 12
> >> ------------
> >> >  .../org/apache/mina/coap/resource/CoapResponse.java     |  6 +++---
> >> >  2 files changed, 3 insertions(+), 15 deletions(-)
> >> > ----------------------------------------------------------------------
> >> >
> >>
> http://git-wip-us.apache.org/repos/asf/mina/blob/52009f32/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> >> > ----------------------------------------------------------------------
> >> > diff --git
> >> a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> >> b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> >> > index 603f311..616f683 100644
> >> > --- a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> >> > +++ b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> >> > @@ -78,10 +78,6 @@ public class CoapDecoder implements
> >> StatelessProtocolDecoder<ByteBuffer, CoapMes
> >> >          // LOG.debug("id : {}", id);
> >> >          input.get(token);
> >> >
> >> > -        // if (LOG.isDebugEnabled()) {
> >> > -        // LOG.debug("token : {}",
> >> ByteBufferDumper.toHex(ByteBuffer.wrap(token)));
> >> > -        // }
> >> > -
> >> >          // decode options
> >> >          int optionCode = 0;
> >> >          byte[] payload = EMPTY_PAYLOAD;
> >> > @@ -94,9 +90,6 @@ public class CoapDecoder implements
> >> StatelessProtocolDecoder<ByteBuffer, CoapMes
> >> >                  // LOG.debug("start of payload");
> >> >                  payload = new byte[input.remaining()];
> >> >                  input.get(payload);
> >> > -                // if (LOG.isDebugEnabled()) {
> >> > -                // LOG.debug("payload : {}",
> >> ByteBufferDumper.dump(ByteBuffer.wrap(payload)));
> >> > -                // }
> >> >                  break;
> >> >              } else {
> >> >                  int optionDeltaQuartet = (next >> 4) & 0xF;
> >> > @@ -122,7 +115,6 @@ public class CoapDecoder implements
> >> StatelessProtocolDecoder<ByteBuffer, CoapMes
> >> >                  input.get(optionValue);
> >> >
> >> >                  options.add(new CoapOption(optType, optionValue));
> >> > -                ;
> >> >              }
> >> >          }
> >> >
> >> > @@ -144,10 +136,6 @@ public class CoapDecoder implements
> >> StatelessProtocolDecoder<ByteBuffer, CoapMes
> >> >          if (value < 13) {
> >> >              return value;
> >> >          } else if (value == 13) {
> >> > -            // if (LOG.isDebugEnabled()) {
> >> > -            // int val = input.get(input.position()) & 0xFF;
> >> > -            // LOG.debug("byte : {}", val);
> >> > -            // }
> >> >              return (input.get() & 0xFF) + 13;
> >> >          } else if (value == 14) {
> >> >              return (input.getShort() & 0xFFFF) + 269;
> >> >
> >>
> http://git-wip-us.apache.org/repos/asf/mina/blob/52009f32/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> >> > ----------------------------------------------------------------------
> >> > diff --git
> >> a/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> >> b/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> >> > index b9bb658..9ebeb79 100644
> >> > ---
> a/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> >> > +++
> b/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> >> > @@ -31,10 +31,10 @@ import org.apache.mina.coap.CoapOption;
> >> >   */
> >> >  public class CoapResponse {
> >> >
> >> > -    public int code;
> >> > -    public byte[] content;
> >> > +    private int code;
> >> > +    private byte[] content;
> >> >
> >> > -    public CoapOption[] options;
> >> > +    private CoapOption[] options;
> >> >
> >> >      /**
> >> >       * Create the CoAP response for a resource request.
> >>
> >
> >
> >
> > --
> > thanks
> > ashish
> >
> > Blog: http://www.ashishpaliwal.com/blog
> > My Photo Galleries: http://www.pbase.com/ashishpaliwal
>



-- 
thanks
ashish

Blog: http://www.ashishpaliwal.com/blog
My Photo Galleries: http://www.pbase.com/ashishpaliwal

Re: git commit: fixed sonar violations

Posted by Julien Vermillard <jv...@gmail.com>.
hmm it's some decoder debug statement commented during performance testing.

I think we can remove them since the code is working and I don't think
we need to enable them again.

--
Julien Vermillard :::: http://people.apache.org/~jvermillard/


On Thu, Jul 25, 2013 at 4:41 PM, Ashish <pa...@gmail.com> wrote:
> Thanks Jeff ! There are more commented line.
> Need to touch-base with Julien to check if some of them need to be enabled
> for debugging.
> Some of them can be worthy debug statements.
>
>
> On Thu, Jul 25, 2013 at 8:07 PM, Jeff MAURY <je...@gmail.com> wrote:
>
>> There is still one line of commented code in CoapDecoder
>>
>>
>> Jeff
>> —
>> Sent from Mailbox for iPhone
>>
>> On Thu, Jul 25, 2013 at 3:00 PM, null <ap...@apache.org> wrote:
>>
>> > Updated Branches:
>> >   refs/heads/trunk 51dd5213d -> 52009f32f
>> > fixed sonar violations
>> > Project: http://git-wip-us.apache.org/repos/asf/mina/repo
>> > Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/52009f32
>> > Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/52009f32
>> > Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/52009f32
>> > Branch: refs/heads/trunk
>> > Commit: 52009f32fb0329129d12f3812b4ee886c8a9fbac
>> > Parents: 51dd521
>> > Author: paliwalashish <pa...@gmail.com>
>> > Authored: Thu Jul 25 18:29:45 2013 +0530
>> > Committer: paliwalashish <pa...@gmail.com>
>> > Committed: Thu Jul 25 18:29:45 2013 +0530
>> > ----------------------------------------------------------------------
>> >  .../java/org/apache/mina/coap/codec/CoapDecoder.java    | 12
>> ------------
>> >  .../org/apache/mina/coap/resource/CoapResponse.java     |  6 +++---
>> >  2 files changed, 3 insertions(+), 15 deletions(-)
>> > ----------------------------------------------------------------------
>> >
>> http://git-wip-us.apache.org/repos/asf/mina/blob/52009f32/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
>> > ----------------------------------------------------------------------
>> > diff --git
>> a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
>> b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
>> > index 603f311..616f683 100644
>> > --- a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
>> > +++ b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
>> > @@ -78,10 +78,6 @@ public class CoapDecoder implements
>> StatelessProtocolDecoder<ByteBuffer, CoapMes
>> >          // LOG.debug("id : {}", id);
>> >          input.get(token);
>> >
>> > -        // if (LOG.isDebugEnabled()) {
>> > -        // LOG.debug("token : {}",
>> ByteBufferDumper.toHex(ByteBuffer.wrap(token)));
>> > -        // }
>> > -
>> >          // decode options
>> >          int optionCode = 0;
>> >          byte[] payload = EMPTY_PAYLOAD;
>> > @@ -94,9 +90,6 @@ public class CoapDecoder implements
>> StatelessProtocolDecoder<ByteBuffer, CoapMes
>> >                  // LOG.debug("start of payload");
>> >                  payload = new byte[input.remaining()];
>> >                  input.get(payload);
>> > -                // if (LOG.isDebugEnabled()) {
>> > -                // LOG.debug("payload : {}",
>> ByteBufferDumper.dump(ByteBuffer.wrap(payload)));
>> > -                // }
>> >                  break;
>> >              } else {
>> >                  int optionDeltaQuartet = (next >> 4) & 0xF;
>> > @@ -122,7 +115,6 @@ public class CoapDecoder implements
>> StatelessProtocolDecoder<ByteBuffer, CoapMes
>> >                  input.get(optionValue);
>> >
>> >                  options.add(new CoapOption(optType, optionValue));
>> > -                ;
>> >              }
>> >          }
>> >
>> > @@ -144,10 +136,6 @@ public class CoapDecoder implements
>> StatelessProtocolDecoder<ByteBuffer, CoapMes
>> >          if (value < 13) {
>> >              return value;
>> >          } else if (value == 13) {
>> > -            // if (LOG.isDebugEnabled()) {
>> > -            // int val = input.get(input.position()) & 0xFF;
>> > -            // LOG.debug("byte : {}", val);
>> > -            // }
>> >              return (input.get() & 0xFF) + 13;
>> >          } else if (value == 14) {
>> >              return (input.getShort() & 0xFFFF) + 269;
>> >
>> http://git-wip-us.apache.org/repos/asf/mina/blob/52009f32/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
>> > ----------------------------------------------------------------------
>> > diff --git
>> a/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
>> b/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
>> > index b9bb658..9ebeb79 100644
>> > --- a/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
>> > +++ b/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
>> > @@ -31,10 +31,10 @@ import org.apache.mina.coap.CoapOption;
>> >   */
>> >  public class CoapResponse {
>> >
>> > -    public int code;
>> > -    public byte[] content;
>> > +    private int code;
>> > +    private byte[] content;
>> >
>> > -    public CoapOption[] options;
>> > +    private CoapOption[] options;
>> >
>> >      /**
>> >       * Create the CoAP response for a resource request.
>>
>
>
>
> --
> thanks
> ashish
>
> Blog: http://www.ashishpaliwal.com/blog
> My Photo Galleries: http://www.pbase.com/ashishpaliwal

Re: git commit: fixed sonar violations

Posted by Ashish <pa...@gmail.com>.
Thanks Jeff ! There are more commented line.
Need to touch-base with Julien to check if some of them need to be enabled
for debugging.
Some of them can be worthy debug statements.


On Thu, Jul 25, 2013 at 8:07 PM, Jeff MAURY <je...@gmail.com> wrote:

> There is still one line of commented code in CoapDecoder
>
>
> Jeff
> —
> Sent from Mailbox for iPhone
>
> On Thu, Jul 25, 2013 at 3:00 PM, null <ap...@apache.org> wrote:
>
> > Updated Branches:
> >   refs/heads/trunk 51dd5213d -> 52009f32f
> > fixed sonar violations
> > Project: http://git-wip-us.apache.org/repos/asf/mina/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/52009f32
> > Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/52009f32
> > Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/52009f32
> > Branch: refs/heads/trunk
> > Commit: 52009f32fb0329129d12f3812b4ee886c8a9fbac
> > Parents: 51dd521
> > Author: paliwalashish <pa...@gmail.com>
> > Authored: Thu Jul 25 18:29:45 2013 +0530
> > Committer: paliwalashish <pa...@gmail.com>
> > Committed: Thu Jul 25 18:29:45 2013 +0530
> > ----------------------------------------------------------------------
> >  .../java/org/apache/mina/coap/codec/CoapDecoder.java    | 12
> ------------
> >  .../org/apache/mina/coap/resource/CoapResponse.java     |  6 +++---
> >  2 files changed, 3 insertions(+), 15 deletions(-)
> > ----------------------------------------------------------------------
> >
> http://git-wip-us.apache.org/repos/asf/mina/blob/52009f32/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> > ----------------------------------------------------------------------
> > diff --git
> a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> > index 603f311..616f683 100644
> > --- a/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> > +++ b/coap/src/main/java/org/apache/mina/coap/codec/CoapDecoder.java
> > @@ -78,10 +78,6 @@ public class CoapDecoder implements
> StatelessProtocolDecoder<ByteBuffer, CoapMes
> >          // LOG.debug("id : {}", id);
> >          input.get(token);
> >
> > -        // if (LOG.isDebugEnabled()) {
> > -        // LOG.debug("token : {}",
> ByteBufferDumper.toHex(ByteBuffer.wrap(token)));
> > -        // }
> > -
> >          // decode options
> >          int optionCode = 0;
> >          byte[] payload = EMPTY_PAYLOAD;
> > @@ -94,9 +90,6 @@ public class CoapDecoder implements
> StatelessProtocolDecoder<ByteBuffer, CoapMes
> >                  // LOG.debug("start of payload");
> >                  payload = new byte[input.remaining()];
> >                  input.get(payload);
> > -                // if (LOG.isDebugEnabled()) {
> > -                // LOG.debug("payload : {}",
> ByteBufferDumper.dump(ByteBuffer.wrap(payload)));
> > -                // }
> >                  break;
> >              } else {
> >                  int optionDeltaQuartet = (next >> 4) & 0xF;
> > @@ -122,7 +115,6 @@ public class CoapDecoder implements
> StatelessProtocolDecoder<ByteBuffer, CoapMes
> >                  input.get(optionValue);
> >
> >                  options.add(new CoapOption(optType, optionValue));
> > -                ;
> >              }
> >          }
> >
> > @@ -144,10 +136,6 @@ public class CoapDecoder implements
> StatelessProtocolDecoder<ByteBuffer, CoapMes
> >          if (value < 13) {
> >              return value;
> >          } else if (value == 13) {
> > -            // if (LOG.isDebugEnabled()) {
> > -            // int val = input.get(input.position()) & 0xFF;
> > -            // LOG.debug("byte : {}", val);
> > -            // }
> >              return (input.get() & 0xFF) + 13;
> >          } else if (value == 14) {
> >              return (input.getShort() & 0xFFFF) + 269;
> >
> http://git-wip-us.apache.org/repos/asf/mina/blob/52009f32/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> > ----------------------------------------------------------------------
> > diff --git
> a/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> b/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> > index b9bb658..9ebeb79 100644
> > --- a/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> > +++ b/coap/src/main/java/org/apache/mina/coap/resource/CoapResponse.java
> > @@ -31,10 +31,10 @@ import org.apache.mina.coap.CoapOption;
> >   */
> >  public class CoapResponse {
> >
> > -    public int code;
> > -    public byte[] content;
> > +    private int code;
> > +    private byte[] content;
> >
> > -    public CoapOption[] options;
> > +    private CoapOption[] options;
> >
> >      /**
> >       * Create the CoAP response for a resource request.
>



-- 
thanks
ashish

Blog: http://www.ashishpaliwal.com/blog
My Photo Galleries: http://www.pbase.com/ashishpaliwal