X-czh opened a new issue, #2060:
URL: https://github.com/apache/fury/issues/2060

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fury/issues) 
and found no similar issues.
   
   
   ### Version
   
   When deserializing a POJO type containing double fields using 
`FuryInputStream` with the initial buffer size < the serialized buffer size of 
a single record, the deserialized value is wrong. Increasing the initial buffer 
size resolves the issue.
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   
   - POJO class to serialize
   ```java
   public class SimpleType {
   
        // Changing this to an int value won't produce wrong result
        public double dVal;
   
        public SimpleType() {
                dVal = 0.5;
        }
   }
   ```
   
   - Test: 
   ```java
   Fury fury = Fury.builder()
                .withLanguage(Language.JAVA)
                .build();
   fury.register(SimpleType.class);
   
   SimpleType v = new SimpleType();
   // Size: 12
   System.out.println(fury.serialize(v).length);
   ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
   fury.serialize(outputStream, v);
   
   InputStream inputStream = new 
ByteArrayInputStream(outputStream.toByteArray());
   // <11: wrong result
   // >= 12: correct result
   FuryInputStream input = new FuryInputStream(inputStream, 11);
   SimpleType vout = (SimpleType) fury.deserialize(input);
   
   // java.lang.AssertionError: 
   // Expected :0.5
   // Actual   :1.8227805048890994E-304
   Assert.assertEquals(v.dVal, vout.dVal, 0.001);
   ```
   
   ### What did you expect to see?
   
   The deserialized value = 0.5.
   
   ### What did you see instead?
   
   The deserialized value = 1.8227805048890994E-304.
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to