-
Notifications
You must be signed in to change notification settings - Fork 403
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Search before asking
- I had searched in the issues and found no similar issues.
Version
0.5.0-SNAPSHOT, 0.4.1
Component(s)
Java
Minimal reproduce step
import org.apache.fury.Fury;
import org.apache.fury.config.Language;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Arrays;
public class Reproducer {
public static void main(String[] args) {
Fury fury = Fury.builder()
.withLanguage(Language.JAVA)
.requireClassRegistration(false)
.withMetaContextShare(false)
.build();
byte[] data = fury.serializeJavaObject(new TestRecord("Some string", 123));
try {
TestRecord result = fury.deserializeJavaObject(Arrays.copyOf(data, data.length), TestRecord.class);
System.out.println("Byte array result: " + result);
} catch (Exception e) {
System.out.println("Byte array result: " + e.getClass().getSimpleName());
e.printStackTrace();
}
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(Arrays.copyOf(data, data.length));
try {
TestRecord result = fury.deserializeJavaObject(byteArrayInputStream, TestRecord.class);
System.out.println("ByteArrayInputStream result: " + result);
} catch (Exception e) {
System.out.println("ByteArrayInputStream result: " + e.getClass().getSimpleName());
e.printStackTrace();
}
// hack: Fury have an optimisation for ByteArrayInputStream, which we want to avoid
InputStream inputStream = new BufferedInputStream(new ByteArrayInputStream(Arrays.copyOf(data, data.length)));
try {
TestRecord result = fury.deserializeJavaObject(inputStream, TestRecord.class);
System.out.println("InputStream result: " + result);
} catch (Exception e) {
System.out.println("InputStream result: " + e.getClass().getSimpleName());
e.printStackTrace();
}
}
public static class TestRecord {
public final String a;
public final int b;
public TestRecord(String a, int b) {
this.a = a;
this.b = b;
}
@Override
public String toString() {
return "TestRecord{" +
"a='" + a + '\'' +
", b=" + b +
'}';
}
}
}What did you expect to see?
No exception to be throwed, the data should be deserialized correctly.
What did you see instead?
java.lang.UnsupportedOperationException: Unsupported coder 111 when deserializing with ByteArrayInputStream and java.lang.IllegalArgumentException when deserializing with any other InputStream.
Anything Else?
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working