Hello,
I have a problem deploying my application to Oracle OAS10g (10.1.3.4.0).
I use IT MILL Toolkit version 5.3.1, when i try to access the application i get this exception:
09/04/14 11:18:04 java.lang.IndexOutOfBoundsException: The supplied offset + length did not fit into the supplied byte[] (offset
+ length = 0 + 65536 = 65536 vs byte[].length = 5)
09/04/14 11:18:04 at com.evermind.server.http.EvermindServletInputStream.read(EvermindServletInputStream.java:106)
09/04/14 11:18:04 at com.itmill.toolkit.terminal.gwt.server.CommunicationManager.handleVariables(CommunicationManager.java:629
)
09/04/14 11:18:04 at com.itmill.toolkit.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:281
)
09/04/14 11:18:04 at com.itmill.toolkit.terminal.gwt.server.ApplicationServlet.service(ApplicationServlet.java:445)
09/04/14 11:18:04 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
09/04/14 11:18:04 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
09/04/14 11:18:04 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
09/04/14 11:18:04 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
09/04/14 11:18:04 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
09/04/14 11:18:04 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
09/04/14 11:18:04 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
09/04/14 11:18:04 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
09/04/14 11:18:04 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303
)
09/04/14 11:18:04 at java.lang.Thread.run(Thread.java:595)
Seems to me that Oracle 10g reports the content length to be 5 (correct for the init request) but then provides an input stream which returns more than 5 bytes. Other servers return an input stream from which only 5 bytes can be read. Oracle bug?
What I meant with the weird part is that according to InputStream documentation for read-function says that:
And the InputStream.read(b,off,len) is invoked like this:
612 byte[] buffer = new byte[request.getContentLength()]
;
613 ServletInputStream inputStream = request.getInputStream();
614 int totalBytesRead = 0;
615 int bytesRead;
616 while ((bytesRead = inputStream.read(buffer, totalBytesRead,
617 MAX_BUFFER_SIZE)) != -1) {
618 totalBytesRead += bytesRead;
619 }
Doesn’t this say that if MAX_BUFFER_SIZE is greater than request.getContentLength(), the off+len is also always greater than buffer.length? This should not work at all… or what am I missing here?
I added a fix for this issue which should be more compatible with the specs. I guess the reason it works in other servlet containers is that the specs are not interpreted that strictly i.e. no exception is only thrown if off+len > b.length() AND off+bytes available to read > b.length() .