3 Replies Latest reply on Mar 13, 2008 3:53 AM by Ron Sigal

    Bug in CompressingUnMarshaller

    Alex Newbie

      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!!!