Re: ArrayIndexOutOfBoundsException while reading
Ingo Brunberg wrote: To work around a bug in the Java VM in this manner seems a bad idea to me. When making applications that work on more than one platform and more than one JDK, working around specific implementation bugs is a very common problem. I just remeber the drag and drop and threading nightmares in Swing under Windows and Mac OS X under 1.3 and 1.4 from some other project... So objections from my side. Also I think it is good design making distinct parts of an application (i.e. libraries) catch all unchecked exceptions and handle them in a generic way (e.g. rethrow them as a general checked exception) to protect other parts of the application. This improves isolation of individual components. Odi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ArrayIndexOutOfBoundsException while reading
I agree that working around JVM bugs is annoying, but in most cases there's really not much else you can do. However, it's not acceptable to allow a runtime exception to kill code that should otherwise work. The bug so far has only been reported with Windows (but that could be because there's just a lot more windows users). On 1.3.X versions of Java, the bug stems from the socketRead method. On 1.4.X versions, it stems from socketRead0. If HttpClient is hesitant to add the workaround code, it's no big deal -- we already are using a modified version, so I can just insert an AIOOBExceptionStreamHandler of sorts around the existing streams. It might be useful to have this in HttpClient, though, as it could bite some other heavy-duty users. Thanks, Sam On Thursday, January 8, 2004, at 01:10 PM, Ingo Brunberg wrote: To work around a bug in the Java VM in this manner seems a bad idea to me. As I have never seen this myself, I guess only Windows platforms are affected? What are the Sun engineers saying? Regards, Ingo Hi all, Under some exceptional circumstances, reading from a SocketInputStream can cause an ArrayIndexOutOfBoundsException. We have seen this occur in many other places (non HttpClient related), and since including HttpClient a few bugs have been reported with it as well. The exact cause is unknown and not easily reproduced, and the exception actually occurs in native code (java.net.SocketInputStream.socketRead0). I suggest adding a wrapper input stream around the underlying inputstream that extends all read-style calls, catches ArrayIndexOutOfBoundsException and rethrows it as an IOException. An example bug report demonstrating this bug can be at: http://bugs.limewire.com/bugs/searching.jsp?l=80&c=46&m=-1_-1&os=- 1&offset=15 . (Note that we're currently redoing the internals of the bug server, so if that link doesn't work, you can reach the bug reports yourself by going to http://bugs.limewire.com/bugs/search.jsp , choosing or typing "java.lang.ArrayIndexOutOfBoundsException" as the exception to search for, and choosing or typing "org.apache.commons.httpclient.HttpParser" as the class that the error occurs in.) Thanks, Sam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ArrayIndexOutOfBoundsException while reading
To work around a bug in the Java VM in this manner seems a bad idea to me. As I have never seen this myself, I guess only Windows platforms are affected? What are the Sun engineers saying? Regards, Ingo > Hi all, > > Under some exceptional circumstances, reading from a SocketInputStream > can cause an ArrayIndexOutOfBoundsException. We have seen this occur > in many other places (non HttpClient related), and since including > HttpClient a few bugs have been reported with it as well. The exact > cause is unknown and not easily reproduced, and the exception actually > occurs in native code (java.net.SocketInputStream.socketRead0). I > suggest adding a wrapper input stream around the underlying inputstream > that extends all read-style calls, catches > ArrayIndexOutOfBoundsException and rethrows it as an IOException. > > An example bug report demonstrating this bug can be at: > http://bugs.limewire.com/bugs/searching.jsp?l=80&c=46&m=-1_-1&os=- > 1&offset=15 . (Note that we're currently redoing the internals of the > bug server, so if that link doesn't work, you can reach the bug reports > yourself by going to http://bugs.limewire.com/bugs/search.jsp , > choosing or typing "java.lang.ArrayIndexOutOfBoundsException" as the > exception to search for, and choosing or typing > "org.apache.commons.httpclient.HttpParser" as the class that the error > occurs in.) > > Thanks, > Sam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]