question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NPE in ORecordSerializerBinaryV0

See original GitHub issue

There is the following code in ORecordSerializerBinaryV0

  private int writeEmbeddedMap(BytesContainer bytes, Map<Object, Object> map) {
    final int[] pos = new int[map.size()];
    int i = 0;
    Entry<Object, Object> values[] = new Entry[map.size()];
    final int fullPos = OVarIntSerializer.write(bytes, map.size());
    for (Entry<Object, Object> entry : map.entrySet()) {
      // TODO:check skip of complex types
      // FIXME: changed to support only string key on map
      OType type = OType.STRING;
      writeOType(bytes, bytes.alloc(1), type);
      writeString(bytes, entry.getKey().toString());
      pos[i] = bytes.alloc(OIntegerSerializer.INT_SIZE + 1);
      values[i] = entry;
      i++;
    }

The problem is that some Maps can contains nulls as keys. So there will be NPE here: entry.getKey().toString().

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
PhantomYdncommented, Mar 31, 2016

Yea - you can define as you wish: but during deserialization, I guess it should be transformed back to null. Right? If it’s not possible: I think that OrientDB should transform null into “” (empty string) key.

0reactions
tglmancommented, Dec 27, 2016

hi @PhantomYdn,

double checking the fix i did the exception go up in any case of set of a null value on a tracked map, this for me is more than enough.

Closing

Read more comments on GitHub >

github_iconTop Results From Across the Web

NPE while retrieving field from document · Issue #3795 ... - GitHub
Randomly ODB throws NPE while retrieving field from document. ... ORecordSerializerBinaryV0.deserialize(ORecordSerializerBinaryV0.java:175)
Read more >
Syncleus/Ferma - Gitter
@freemo Looks like a bug in orientdb to me. The code just wants to access the label (type) of the vertex but an...
Read more >
orientdb - Multithreaded deletion and re-insertion fails with Orient ...
It looks like a record is misread and leads to a NullPointerException during a DELETE VERTEX ... stringFromBytes(ORecordSerializerBinaryV0.java:992) at ...
Read more >
OrientDB - [orientdb] remove a bad record?
I'm getting an error when retrieving a record. When I try to delete the vertex, I get the same - null pointer exception....
Read more >
Adventures with Nexus in Kubernetes: database corruption ...
java.lang.NullPointerException at com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinaryV0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found