odnoklassniki/one-nio

BigDecimal with new Java does not work any more

MacX19 opened this issue · 4 comments

Deserialization BigDecimal with Java 1.8.0_351 does not work any more:

java.io.IOException: readObject() is not fully supported. See implementation notes.
	at one.nio.serial.gen.NullObjectInputStream.unsupported(NullObjectInputStream.java:170)
	at one.nio.serial.gen.NullObjectInputStream.readFields(NullObjectInputStream.java:50)
	at java.math.BigDecimal.readObject(BigDecimal.java:3798)
	at sun.reflect.Delegate14_BigDecimal.read(Unknown Source)
	at one.nio.serial.GeneratedSerializer.read(GeneratedSerializer.java:127)
	at one.nio.serial.DeserializeStream.readObject(DeserializeStream.java:75)
...

Could you please provide a minimal testcase to reproduce?

MacX19 commented

Could you please provide a minimal testcase to reproduce?

Java 1.8.0_351
one-nio 1.6.0

    byte[] res;
    try (PersistStream stream = new PersistStream()) {
      BigDecimal bigDecimal = new BigDecimal("12.34");
      stream.writeObject(bigDecimal);
      res = stream.toByteArray();
    }
    try (DeserializeStream des = new DeserializeStream(res)) {
      System.out.println(des.readObject());
    }
Exception in thread "main" java.io.IOException: readObject() is not fully supported. See implementation notes.
	at one.nio.serial.gen.NullObjectInputStream.unsupported(NullObjectInputStream.java:170)
	at one.nio.serial.gen.NullObjectInputStream.readFields(NullObjectInputStream.java:50)
	at java.math.BigDecimal.readObject(BigDecimal.java:3798)
	at sun.reflect.Delegate0_BigDecimal.read(Unknown Source)
	at one.nio.serial.GeneratedSerializer.read(GeneratedSerializer.java:127)
	at one.nio.serial.DeserializeStream.readObject(DeserializeStream.java:75)
...

@MacX19 , thank you for the report and the example.
We have tried to fix it in 1.6.1 release.
Could you please check if the issue is still actual or fixed?

MacX19 commented

Looks like it's working properly now