You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "X-czh (via GitHub)" <gi...@apache.org> on 2025/02/17 02:37:54 UTC

[I] Wrong deserialization result when deserializing a POJO type containing double fields using `FuryInputStream` with the initial buffer size < the serialized buffer size of a single record [fury]

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: commits-unsubscribe@fury.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [I] Wrong deserialization result when deserializing a POJO type containing double fields using `FuryInputStream` with the initial buffer size < the serialized buffer size of a single record [fury]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang closed issue #2060: Wrong deserialization result when deserializing a POJO type containing double fields using `FuryInputStream` with the initial buffer size < the serialized buffer size of a single record
URL: https://github.com/apache/fury/issues/2060


-- 
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: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [I] Wrong deserialization result when deserializing a POJO type containing double fields using `FuryInputStream` with the initial buffer size < the serialized buffer size of a single record [fury]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #2060:
URL: https://github.com/apache/fury/issues/2060#issuecomment-2663448434

   Hi @X-czh , thanks for reporting this issue, I fixed it in #2064, please try it out


-- 
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: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org


Re: [I] Wrong deserialization result when deserializing a POJO type containing double fields using `FuryInputStream` with the initial buffer size < the serialized buffer size of a single record [fury]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang closed issue #2060: Wrong deserialization result when deserializing a POJO type containing double fields using `FuryInputStream` with the initial buffer size < the serialized buffer size of a single record
URL: https://github.com/apache/fury/issues/2060


-- 
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: commits-unsubscribe@fury.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org