[jboss-user] [Remoting] - Bug in CompressingUnMarshaller

dreyk do-not-reply at jboss.com
Mon Dec 24 05:14:33 EST 2007


You can find in documentation reference on using CompressingUnMarshaller for reduce trafic. For this aim you can define you UnMarshaller by this way CompressingUnMarshaller(new HTTPUnMarshaller()). But it's does't work, see you read method for CompressingUnMarshaller

  | public Object read(InputStream inputStream, Map metadata) throws IOException, ClassNotFoundException
  |    {
  |       GZIPInputStream gzis = new GZIPInputStream(inputStream);
  |       ObjectInputStream ois = SerializationStreamFactory.getManagerInstance(getSerializationType()).createRegularInput(gzis);
  | 
  |       if(wrappedUnMarshaller != null)
  |       {
  |     	  //if(wrappedUnMarshaller instanceof HTTPUnMarshaller){
  |     		//  
  |     	  //}
  |           return wrappedUnMarshaller.read(ois, metadata);
  |       }
  |       else
  |       {
  |          return super.read(ois, metadata);
  |       }
  |    }
wrappedUnMarshaller.read(ois, metadata) will generate error for HTTPUnMarshaller wrapped class, because in following code

  |  while(amtRead > 0)
  |       {
  |          byteOutputStream.write(byteBuffer, pointer, amtRead);
  |          if(amtRead < bufferSize & byteOutputStream.size() >= contentLength)
  |          {
  |             //done reading, so process
  |             break;
  |          }
  |          amtRead = inputStream.read(byteBuffer);
  |       }
  | 
you don't read all content actualy, beacause contentLength equals comressed lenght of content while you read uncomressed stream!!! You must first set in  metadata uncomressed length of the content!!!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115336#4115336

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115336



More information about the jboss-user mailing list