java.lang.IndexOutOfBoundsException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • The ResourceServlet uses the "in.available()" syntax which seems to fail when running IBM WebSphere 6's JRE. This happens both with compressed (gzipped) content or not. By replacing the code with a more traditionnal approach (using in.read() like "FileCopyUtils" does), it works fine ! My proposition of fix is: ----------------------------------- replace in 'doGet' method: while (in.available() > 0) { int len = in.read(buffer); out.write(buffer, 0, len); } ----------------------------------- by: int bytesRead = -1; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } By the way, the exception is: [10/20/08 13:49:59:905 CEST] 0000002a SystemOut O 20/10/2008 13:49:59,905 DEBUG [WebContainer : 0] com.fortis.rsa.spring.webflow.js.ResourceServlet - Enabling GZIP compression for the current response. [10/20/08 13:49:59:905 CEST] 0000002a SystemErr R java.lang.IndexOutOfBoundsException at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:128) at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:93) at com.fortis.rsa.spring.webflow.js.ResourceServlet$GZIPResponseStream.write(ResourceServlet.java:352) at com.fortis.rsa.spring.webflow.js.ResourceServlet.doGet(ResourceServlet.java:127) at javax.servlet.http.HttpServlet.service(HttpServlet.java:751) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3174) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:253) at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:229) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1970) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:114)
    via by Stephane Broussin,
  • The ResourceServlet uses the "in.available()" syntax which seems to fail when running IBM WebSphere 6's JRE. This happens both with compressed (gzipped) content or not. By replacing the code with a more traditionnal approach (using in.read() like "FileCopyUtils" does), it works fine ! My proposition of fix is: ----------------------------------- replace in 'doGet' method: while (in.available() > 0) { int len = in.read(buffer); out.write(buffer, 0, len); } ----------------------------------- by: int bytesRead = -1; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } By the way, the exception is: [10/20/08 13:49:59:905 CEST] 0000002a SystemOut O 20/10/2008 13:49:59,905 DEBUG [WebContainer : 0] com.fortis.rsa.spring.webflow.js.ResourceServlet - Enabling GZIP compression for the current response. [10/20/08 13:49:59:905 CEST] 0000002a SystemErr R java.lang.IndexOutOfBoundsException at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:128) at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:93) at com.fortis.rsa.spring.webflow.js.ResourceServlet$GZIPResponseStream.write(ResourceServlet.java:352) at com.fortis.rsa.spring.webflow.js.ResourceServlet.doGet(ResourceServlet.java:127) at javax.servlet.http.HttpServlet.service(HttpServlet.java:751) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3174) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:253) at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:229) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1970) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:114)
    via by Stephane Broussin,
  • Issues/Weekly 12w21b – Minecraft Wiki
    via by Unknown author,
    • java.lang.IndexOutOfBoundsException at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:128) at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:93) at com.fortis.rsa.spring.webflow.js.ResourceServlet$GZIPResponseStream.write(ResourceServlet.java:352) at com.fortis.rsa.spring.webflow.js.ResourceServlet.doGet(ResourceServlet.java:127) at javax.servlet.http.HttpServlet.service(HttpServlet.java:751) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3174) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:253) at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:229) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1970) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:114)
    No Bugmate found.