1 Reply Latest reply on Aug 10, 2009 4:43 AM by erahamim

    IllegalArgumentException on  jbosss 5.1.0 while reading http

    erahamim Newbie

      Hi,
      I'm trying to migrate from jboss 4.2.3 to jboss 5.1.0 (JDK 6.0).
      My application reads xml over http requests from several clients.

      When I'm sending xml requests from IE 8, I'm sometime getting IllegalArgumentException from tomcat. Same request may sometime works fine and sometime get the exception.

      Here is a sample of my code that read the request. Same code work fine on jboss 4.0.5 and 4.2.3.

      
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
      {
       BufferedReader reader = request.getReader();
       String line;
       while ((line = reader.readLine()) != null){
       result.append(line);
       }
      }
      

      Here is the exception stack trace:
      
      java.lang.IllegalArgumentException
      at java.nio.Buffer.position(Buffer.java:218)
      at org.apache.tomcat.util.buf.B2CConverter.convert(B2CConverter.java:84)
      at org.apache.catalina.connector.InputBuffer.realReadChars(InputBuffer.java:403)
      at org.apache.tomcat.util.buf.CharChunk.substract(CharChunk.java:416)
      at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:432)
      at org.apache.catalina.connector.CoyoteReader.read(CoyoteReader.java:105)
      at org.apache.catalina.connector.CoyoteReader.readLine(CoyoteReader.java:158)
      



      How can I avoid it?

      Thanks,
      Eyal


        • 1. Re: IllegalArgumentException on  jbosss 5.1.0 while reading
          erahamim Newbie

          Using fiddler I was able to see that it has something to do with the user-agent header sent by IE8 and IE7:
          User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; GTB6; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)

          When I remove the user-agent from the header the request works fine.