tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: svn commit: r1478941 - in /tomcat/trunk/java/org/apache/coyote/http11: InternalNioInputBuffer.java LocalStrings.properties
Date Fri, 03 May 2013 20:01:38 GMT
On 03/05/2013 20:30, markt@apache.org wrote:
> Author: markt
> Date: Fri May  3 19:30:01 2013
> New Revision: 1478941
> 
> URL: http://svn.apache.org/r1478941
> Log:
> Another small TODO.
> 
> Modified:
>     tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
>     tomcat/trunk/java/org/apache/coyote/http11/LocalStrings.properties
> 
> Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java?rev=1478941&r1=1478940&r2=1478941&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java (original)
> +++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Fri May  3
19:30:01 2013
> @@ -172,13 +172,14 @@ public class InternalNioInputBuffer exte
>          }
>          try {
>              available = nbRead();
> -        }catch (IOException x) {
> -            //TODO SERVLET 3.1 -
> -            //we should not swallow this exception
> -
> +        }catch (IOException ioe) {
>              if (log.isDebugEnabled()) {
> -                log.debug("Unable to issue non blocking read.", x);
> +                log.debug(sm.getString("iib.available.readFail"), ioe);
>              }
> +            // Not ideal. This will indicate that data is available which should
> +            // trigger a read which in turn will trigger another IOException and
> +            // that one can be thrown.
> +            available = 1;

I'm not a huge fan of this solution but I think it is the least worst
option.

The other options I considered:
1. Replacing int available() with boolean hasData() throughout. The
value of available() is only ever tested for == 0 or > 0 but this was
quite a big change for not much benefit.

2. Throwing a RuntimeException - Not really viable as the user isn't
expecting it.

3. Refactor the API to pass the IOException back to the caller - no
point as the method does not declare a throws clause

Better ideas welcome.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message