@Override
  public void toData(DataOutput out,
      SerializationContext context) throws IOException {
    out.writeBoolean(hasKeys);
    if (objectTypeArray != null) {
      int numObjects = objects.size();
      out.writeInt(numObjects);
      for (int index = 0; index < numObjects; ++index) {
        Object value = objects.get(index);
        byte objectType = objectTypeArray[index];
        if (hasKeys) {
          context.getSerializer().writeObject(keys.get(index), out);
        }
        out.writeBoolean(objectType == EXCEPTION);
        if (objectType == OBJECT && value instanceof byte[]) {
          out.write((byte[]) value);
        } else if (objectType == EXCEPTION) {
          // write exception as byte array so native clients can skip it
          DataSerializer.writeByteArray(CacheServerHelper.serialize(value), out);
          // write the exception string for native clients
          DataSerializer.writeString(value.toString(), out);
        } else {
          context.getSerializer().writeObject(value, out);
        }
      }
    } else {
      out.writeInt(0);
    }
  }
unprotected access to the objects collection, which may be null
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ObjectPartList.java