You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Mike Dusseault <mi...@home.com> on 1999/10/08 16:50:51 UTC

mod_jserv/5133: After a getInputStream, InputStream.available() always returns a 0

>Number:         5133
>Category:       mod_jserv
>Synopsis:       After a getInputStream, InputStream.available() always returns a 0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jserv
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Tue Oct 12 20:10:03 PDT 1999
>Last-Modified:
>Originator:     mike@home.com
>Organization:
apache
>Release:        Apache 1.3.9 + JServ 1.0 (though 1.1b1 has bug - I looked)
>Environment:
Linux + jdk1.1.7b (not that it matters, I located and fixed the bug... See later)
>Description:
After getting the InputStream, any call to available always returns a 0.
>How-To-Repeat:
Well, call available() on the InputStream (i.e. JServInputStream) and
you'll always always get a 0.
>Fix:
The default implementation of InputStream.available() merely returns a 0
at all times.  Someone just forgot to override the method.  Just add the
following to the JServInputStream inner class in JServConnection:

public int available()
{
  return((int)available);
}

Voila, and our servlet now runs properly.  Note that I had to cast to int
since that's what the InputStream method returns.  So you might as well
make that available variable an int rather than a long in this case.
Up to you guys.

Don't ya just love open source?  How long would it have taken me to
find this if I didn't have the source?  Yikes...  Once a programmer
goes open source, it's hard to go back.  The advantages are just too
huge.  CLosed source APIs are a stupid idea.

Keep up the good work folks!  Everybody appreciates it.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]