Problem deploying to OAS10g

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) 

Can anybody help with this issue?

Thank you in advance.

Hmm… this is interesting.

This seems to be valid exception based in
InputStream
documentation:

The
code of CommunicationManager
indicates that this situation will arise if the content length is less than MAX_BUFFER_SIZE.

(The line numbers differ so much that I’m not sure about the versions here…)

But shouldn’t this be the case in most situations? Why are other server implementations working?

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?

I created a ticket for this at http://dev.itmill.com/ticket/2847

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() .

Great! I assumed that this was the case. The EvermindServletInputStream is just a little different from other ServletInputStream implementations.

Fulvio, please try http://www.itmill.com/download/itmill-toolkit/development/nightly/5.4/itmill-toolkit-5.4.nightly-20090417-c7455.jar and see if it works better for you.

Yes, that works fine for me!!!

Thank you so much!!