LegacyDocument content is null

I’ve got an admittedly pretty hacky solution:

``package com.cvent.couch.transcode;

import com.couchbase.client.java.transcoder.LegacyTranscoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.UnsupportedEncodingException;

/**

  • Created by unhuman on 3/31/16.
    */
    public class TolerantLegacyTranscoder extends LegacyTranscoder {

    private static final Logger LOG = LoggerFactory.getLogger(TolerantLegacyTranscoder.class);

    @Override
    protected Object deserialize(byte[] in) {
    Object result = super.deserialize(in);
    if ((result == null) && (in != null)) {
    try {
    result = new String(in, “UTF-8”);
    } catch (UnsupportedEncodingException uee) {
    LOG.error(“This should never occur”, uee);
    }
    }
    return result;
    }
    }``

Then, I open the bucket like so:
// We override the LegacyDocument processing with our more tolerant implementation List<Transcoder<? extends Document, ?>> transcoderOverrides = new ArrayList<>(); transcoderOverrides.add(new TolerantLegacyTranscoder()); Bucket bucket = cluster.openBucket(bucket, password, transcoderOverrides);

Thanks for Open Source!