You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by sebb AT ASF <se...@apache.org> on 2009/07/22 12:54:04 UTC
Re: svn commit: r796661 - in /httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io:
AbstractMessageParser.java ChunkedInputStream.java
In:
AbstractMessageParser.parse()
Findbugs points out that the field "this.state" is overwritten by the
fall-through.
It looks like the state can never be left set to HEADERS, and the
switch statement could be eliminated entirely.
On 22/07/2009, sebb@apache.org <se...@apache.org> wrote:
> Author: sebb
> Date: Wed Jul 22 10:40:27 2009
> New Revision: 796661
>
> URL: http://svn.apache.org/viewvc?rev=796661&view=rev
> Log:
> Annotate switch fall-through to stop Eclipse complaining
>
> Modified:
> httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
> httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
>
> Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
> URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java?rev=796661&r1=796660&r2=796661&view=diff
> ==============================================================================
> --- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java (original)
> +++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java Wed Jul 22 10:40:27 2009
> @@ -254,6 +254,7 @@
> throw new ProtocolException(px.getMessage(), px);
> }
> this.state = HEADERS;
> + //$FALL-THROUGH$
> case HEADERS:
> Header[] headers = AbstractMessageParser.parseHeaders(
> this.sessionBuffer,
>
> Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
> URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java?rev=796661&r1=796660&r2=796661&view=diff
> ==============================================================================
> --- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java (original)
> +++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java Wed Jul 22 10:40:27 2009
> @@ -230,6 +230,7 @@
> "Unexpected content at the end of chunk");
> }
> state = CHUNK_LEN;
> + //$FALL-THROUGH$
> case CHUNK_LEN:
> this.buffer.clear();
> i = this.in.readLine(this.buffer);
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: svn commit: r796661
Posted by sebb <se...@gmail.com>.
On 22/07/2009, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Wed, Jul 22, 2009 at 11:54:04AM +0100, sebb AT ASF wrote:
> > In:
> >
> > AbstractMessageParser.parse()
> >
> > Findbugs points out that the field "this.state" is overwritten by the
> > fall-through.
> >
> > It looks like the state can never be left set to HEADERS, and the
> > switch statement could be eliminated entirely.
> >
>
> Sebastian
>
> It is all kosher. This is needed in case the method is terminated as a result
> of SocketTimeoutException. For details see HTTPCORE-191
OK, I see - the case HEADERS might not complete normally, in which
case the state needs to remain as HEADERS.
> Cheers
>
> Oleg
>
> https://issues.apache.org/jira/browse/HTTPCORE-191
>
>
>
> > On 22/07/2009, sebb@apache.org <se...@apache.org> wrote:
> > > Author: sebb
> > > Date: Wed Jul 22 10:40:27 2009
> > > New Revision: 796661
> > >
> > > URL: http://svn.apache.org/viewvc?rev=796661&view=rev
> > > Log:
> > > Annotate switch fall-through to stop Eclipse complaining
> > >
> > > Modified:
> > > httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
> > > httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
> > >
> > > Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
> > > URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java?rev=796661&r1=796660&r2=796661&view=diff
> > > ==============================================================================
> > > --- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java (original)
> > > +++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java Wed Jul 22 10:40:27 2009
> > > @@ -254,6 +254,7 @@
> > > throw new ProtocolException(px.getMessage(), px);
> > > }
> > > this.state = HEADERS;
> > > + //$FALL-THROUGH$
> > > case HEADERS:
> > > Header[] headers = AbstractMessageParser.parseHeaders(
> > > this.sessionBuffer,
> > >
> > > Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
> > > URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java?rev=796661&r1=796660&r2=796661&view=diff
> > > ==============================================================================
> > > --- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java (original)
> > > +++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java Wed Jul 22 10:40:27 2009
> > > @@ -230,6 +230,7 @@
> > > "Unexpected content at the end of chunk");
> > > }
> > > state = CHUNK_LEN;
> > > + //$FALL-THROUGH$
> > > case CHUNK_LEN:
> > > this.buffer.clear();
> > > i = this.in.readLine(this.buffer);
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: svn commit: r796661
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, Jul 22, 2009 at 11:54:04AM +0100, sebb AT ASF wrote:
> In:
>
> AbstractMessageParser.parse()
>
> Findbugs points out that the field "this.state" is overwritten by the
> fall-through.
>
> It looks like the state can never be left set to HEADERS, and the
> switch statement could be eliminated entirely.
>
Sebastian
It is all kosher. This is needed in case the method is terminated as a result
of SocketTimeoutException. For details see HTTPCORE-191
Cheers
Oleg
https://issues.apache.org/jira/browse/HTTPCORE-191
> On 22/07/2009, sebb@apache.org <se...@apache.org> wrote:
> > Author: sebb
> > Date: Wed Jul 22 10:40:27 2009
> > New Revision: 796661
> >
> > URL: http://svn.apache.org/viewvc?rev=796661&view=rev
> > Log:
> > Annotate switch fall-through to stop Eclipse complaining
> >
> > Modified:
> > httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
> > httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
> >
> > Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
> > URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java?rev=796661&r1=796660&r2=796661&view=diff
> > ==============================================================================
> > --- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java (original)
> > +++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java Wed Jul 22 10:40:27 2009
> > @@ -254,6 +254,7 @@
> > throw new ProtocolException(px.getMessage(), px);
> > }
> > this.state = HEADERS;
> > + //$FALL-THROUGH$
> > case HEADERS:
> > Header[] headers = AbstractMessageParser.parseHeaders(
> > this.sessionBuffer,
> >
> > Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
> > URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java?rev=796661&r1=796660&r2=796661&view=diff
> > ==============================================================================
> > --- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java (original)
> > +++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java Wed Jul 22 10:40:27 2009
> > @@ -230,6 +230,7 @@
> > "Unexpected content at the end of chunk");
> > }
> > state = CHUNK_LEN;
> > + //$FALL-THROUGH$
> > case CHUNK_LEN:
> > this.buffer.clear();
> > i = this.in.readLine(this.buffer);
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org