Author: remy.maucherat(a)jboss.com
Date: 2009-11-25 11:30:20 -0500 (Wed, 25 Nov 2009)
New Revision: 1295
Modified:
trunk/java/org/apache/catalina/connector/InputBuffer.java
trunk/java/org/apache/catalina/connector/Request.java
Log:
- Access available without side effects for the read loop error checking.
Modified: trunk/java/org/apache/catalina/connector/InputBuffer.java
===================================================================
--- trunk/java/org/apache/catalina/connector/InputBuffer.java 2009-11-25 16:25:28 UTC (rev
1294)
+++ trunk/java/org/apache/catalina/connector/InputBuffer.java 2009-11-25 16:30:20 UTC (rev
1295)
@@ -305,6 +305,20 @@
}
+ public int getAvailable() {
+ if (eof || closed) {
+ return -1;
+ }
+ int available = 0;
+ if (state != CHAR_STATE) {
+ available = bb.getLength();
+ } else {
+ available = cb.getLength();
+ }
+ return available;
+ }
+
+
// ------------------------------------------------- Bytes Handling Methods
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2009-11-25 16:25:28 UTC (rev
1294)
+++ trunk/java/org/apache/catalina/connector/Request.java 2009-11-25 16:30:20 UTC (rev
1295)
@@ -2430,10 +2430,10 @@
/**
- * Return true if bytes are available.
+ * Return true if bytes or chars are available.
*/
public boolean ready() {
- return (inputBuffer.available() > 0);
+ return (inputBuffer.getAvailable() > 0);
}
Show replies by date