julianhowarth commented on issue #2275:
URL: https://github.com/apache/fory/issues/2275#issuecomment-3196447957

   thanks @chaokunyang , I can now debug through. It's the section after the 
one you suggested that is problematic (note that the ids are different to the 
initially posted class as I've simplified the test slightly):
   ```
         if ((memoryBuffer1.readByte() != ((byte)-3))) {
             Object object2 = classResolver.readClassInfo(memoryBuffer1, 
contentIdClassInfo).getSerializer().read(memoryBuffer1);
             Platform.putObject(video1, 16L, 
((com.endeavorstreaming.vesper.content_engine.common.domain.content.ContentId)object2));
         } else {
             Platform.putObject(video1, 16L, null);
         }
   ```
   Tracing the call down, I see the following:
   - `readClassInfo` calls down to `readClassInfoWithMetaShare(buffer, 
fory.getSerializationContext().getMetaContext())` (as `metaContextShareEnabled` 
is `true)
   - which calls down to `readClassInfoWithMetaShare`
   - in `readClassInfoWithMetaShare` we do `int header = 
buffer.readVarUint32Small14()` and `header` is set to `0`
   - and then 
   ```
       if ((header & 0b1) == 0) {
         return getOrUpdateClassInfo((short) id);
       }
   ```
   is called and that method is what results in the NPE.
   
   `contentId` itself is a trivial class, though generated by the 
[Immutables](https://immutables.github.io/) lib (as are many of the classes 
involved here):
   ```
   public final class ContentId
       implements 
com.endeavorstreaming.vesper.content_engine.common.domain.content._ContentId {
     private final String value;
     private final int hashCode;
   ...
   }
   ```
   However, what may be of interest is that it does have a `readResolve` which 
is generated by Immutables.
   ```
     private Object readResolve() throws ObjectStreamException {
       return new ContentId(this, this.value);
     }
   ```
   


-- 
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