Crash with attachment after upgrading from CBL 1.4 to 2.6

I signed in as another user who has the same “_attachments/attachment” problem. There was no issue. No crash. Picture shows up fine.

The document is

{
  "channels": "03HA...,
  "email": "<email>,
  "id": "03HA...",
  "name": "user name",
  "password": "f53d...",
  "type": "userProfile"
}

---

{
  "meta": {
    "id": "03HA...::userProfile",
    "rev": "37014-15c8e001d09500000000000000000000",
    "expiration": 0,
    "flags": 0,
    "type": "json"
  },
  "xattrs": {
    "_sync": {
      "rev": "6-254c9b770d09c779ee53c15c63c80e9a",
      "sequence": 138564133,
      "recent_sequences": [
        85101511,
        85108109,
        88438161,
        102656915,
        124732450,
        138564133
      ],
      "history": {
        "revs": [
          "3-6b028d28f2ebbd5c351fb566d93afc31",
          "6-254c9b770d09c779ee53c15c63c80e9a",
          "5-915af92377826fa7f684a4055f9ea23b",
          "4-3cf17ff6cc9a061ed9c18a748ace1c16",
          "2-20483f20d17c7f28c164ec9a5ce3bd34",
          "1-bf55d270cdcba8f1b204aef3db621887"
        ],
        "parents": [
          4,
          2,
          3,
          0,
          5,
          -1
        ],
        "channels": [
          [
            "03HA..."
          ],
          [
            "03HA..."
          ],
          [
            "03HA..."
          ],
          [
            "03HA..."
          ],
          [
            "03HA..."
          ],
          [
            "03HA..."
          ]
        ]
      },
      "channels": {
        "03HA...": null
      },
      "cas": "0x000095d001e0c815",
      "value_crc32c": "0x672cee70",
      "attachments": {
        "03HA...::large": {
          "content_type": "image/jpeg",
          "digest": "sha1-Xbw8vpz1Fjjm2ALaR7tq6+ecvzo=",
          "length": 40160,
          "revpos": 3,
          "stub": true
        },
        "03HA...::small": {
          "content_type": "image/jpeg",
          "digest": "sha1-SefQD0ClrGBhCjlLwF5vE5bgU3Y=",
          "length": 20037,
          "revpos": 3,
          "stub": true
        }
      },
      "time_saved": "2019-09-29T11:52:48.537052979+02:00"
    }
  }
}

Since the attachments changed between CBL 1 and 2 I retrieve them in two ways:

    public List<Pair<String, Blob>> getAttachments(Document doc) {
        List<Pair<String, Blob>> blobPairs = new ArrayList<>();
        Dictionary attachments = doc.getDictionary("_attachments");
        if (attachments != null)
            for (String s : attachments.getKeys()) {
                blobPairs.add(new Pair<>(s, attachments.getBlob(s)));
            }
        return blobPairs;
    }

    public List<Pair<String, Blob>> getBlobs(Document doc) {
        List<Pair<String, Blob>> blobPairs = new ArrayList<>();
        for (String key : doc.getKeys()) {
            Blob blob = doc.getBlob(key);
            if (blob != null) {
                blobPairs.add(new Pair<>(key, blob));
            }
        }
        return blobPairs;
    }

Getting the attachments with getAttachments(doc) prints this:
[Pair{03HA...::large Blob[image/jpeg; 39 KB]}, Pair{03HA...::small Blob[image/jpeg; 20 KB]}]

I don’t know why Dictionary attachments = doc.getDictionary("_attachments"); works although it’s only attachments without the underscore in the meta data.

As far as I know there was no automatic upgrade from attachments to blobs in any document when upgrading to CBL 2. That’s why I use those two methods. Also I must believe that I don’t retrieve any attachment/blob when parsing a document to a class via Jackson. It’s odd that this exception showed up at all pointing to the invalid path/missing file.