Author: markt Date: Wed Aug 28 10:51:20 2013 New Revision: 1518155 URL: http://svn.apache.org/r1518155 Log: Simplify nested if statements
Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java?rev=1518155&r1=1518154&r2=1518155&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java Wed Aug 28 10:51:20 2013 @@ -598,29 +598,26 @@ public class InternalAprInputBuffer exte bbuf.limit(nRead); bbuf.get(buf, pos, nRead); lastValid = pos + nRead; - } else { - if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) { - if (block) { - throw new SocketTimeoutException( - sm.getString("iib.readtimeout")); - } else { - // Attempting to read from the socket when the poller - // has not signalled that there is data to read appears - // to behave like a blocking read with a short timeout - // on OSX rather than like a non-blocking read. If no - // data is read, treat the resulting timeout like a - // non-blocking read that returned no data. - return false; - } - } else if (nRead == 0) { - // APR_STATUS_IS_EOF, since native 1.1.22 - return false; + } else if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) { + if (block) { + throw new SocketTimeoutException( + sm.getString("iib.readtimeout")); } else { - throw new IOException(sm.getString("iib.failedread.apr", - Integer.valueOf(-nRead))); + // Attempting to read from the socket when the poller + // has not signalled that there is data to read appears + // to behave like a blocking read with a short timeout + // on OSX rather than like a non-blocking read. If no + // data is read, treat the resulting timeout like a + // non-blocking read that returned no data. + return false; } + } else if (nRead == 0) { + // APR_STATUS_IS_EOF, since native 1.1.22 + return false; + } else { + throw new IOException(sm.getString("iib.failedread.apr", + Integer.valueOf(-nRead))); } - } return (nRead > 0); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org