Comments (1)
After adding unit tests, I have a better idea of the underlying issues.
With the new tests guiding me in reading the code, I think I know understand the problem and how to fix it.
- Custom Java serialization provides three options, which class coders may mix and match: (a) a call to defaultWriteObject / defaultReadObject replicates the default behavior of serializing all serial, non-transient fields, (b) the use of the persistentSerialFields field allows specification of which of the fields (including non-existent ones) are serialized, and ( c) the code may also call the read/write methods directly on the object streams,
- The Java-to-IDL spec considers that last option to be “optional” data, and the first two “default” data.
- If the class is serialized using serial format 1, it behaves roughly as does native serialization; that is, the code may serialize and deserialize fields in any order it likes.
- If the class is serialized using serial format 2, as it seems to be in many cases, the “optional” data is written into an extra object in the stream, whose type is a modification of the original class. I’m not sure what happens if any “optional” data is written before the “standard” data.
- If the class invokes one of the methods to send “default” data, it also sets a bit in the encoding, indicating that this has happened, so the receiver can anticipate the presence of that default data. That seems kind of backwards, as it is the optional data that we really want to know about.
- To try to sort all of this out, the input stream maintains a state machine which makes a number of assumptions, most importantly that if the sender indicates that it is sending default data, the receiver will call the corresponding method. That is not actually true in our Date case, since the JDL11 implementation calls both, and the JDK8 implementation calls neither.
- There are actually a few other issues with the state machine, which assumes that a call to writeObject will always be matched by a call to readObject.
So the solution is going to be to replace the state machine in InputStreamHook with one that depends on the contents of the encoding and the steps taken to read it, rather than the steps used to write it.
from orb.
Related Issues (20)
- Conflicting license information in NOTICE.md file HOT 3
- ArrayIndexOutOfBoundsException thrown from org.glassfish.rmic.tools.java.ClassPath HOT 2
- Work with ASM8.0 AsmClassFactory.getLatestVersion() return an deprecated value ASM9_EXPERIMENTAL
- idlj generates read/write union helper methods that throw wrong exception in some cases HOT 1
- (Automatic-)Module Name support
- unable to set encoding for idlj generated files
- Deadlock during ORB shutdown HOT 4
- Maven dependencies not able to download in Eclipse HOT 1
- 4.2.4 version doesn't work with Java 17 HOT 2
- Concurent ByteBuffer access issues in java 11 HOT 1
- De/serialization of ConcurrentHashMap fails HOT 1
- Bot's email used to create commits in release jobs is not in sync with Eclipse infra data HOT 1
- `putFields` field gets overwritten for every field HOT 1
- Usage of traceMethodCalls - deprecated since Java 9, removed in 13
- Utility.loadStub() returns null in OSGi environment HOT 1
- dynamic port range doesn't support
- Consume library via Maven / Maven Tycho build HOT 2
- Potential deserialization error for mismatched classes
- Incorporate COS Naming donation
- GlassFish needs a 5.0.0 milestone release
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orb.