Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-262

Transcoder error not reported correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 1.1.3
    • Core
    • Security Level: Public
    • None

    Description

      When a custom transcoder has an error, certain CAS operations fail with an error about the operation being cancelled, which is misleading and doesn't point to the transcoder as a problem.

      Logs:
      Mar 7, 2013 10:20:37 AM net.spy.memcached.protocol.TCPMemcachedNodeImpl setupResend
      WARNING: Discarding partially completed op: Cmd: 0 Opaque: 120 Key: *****
      Mar 7, 2013 10:20:40 AM net.spy.memcached.auth.AuthThread$1 receivedStatus
      INFO: Authenticated to 127.0.0.1/127.0.0.1:11210

      The error occurs on the get on the future. It is in fact a marshalling error in the transcoder but that never gets reported.

      Code:
      OperationFuture<CASValue<documentType>> future = this.client.asyncGets(key, transcoder);
      return future.get(5, TimeUnit.SECONDS);

      Transcoder (incorrect):

      @Component
      public class TranscoderImpl<T> implements Transcoder<T> {

      @Autowired
      @Qualifier("JSON")
      Marshaller marshaler;

      @Autowired
      @Qualifier("JSON")
      Unmarshaller unmarshaler;

      @Override
      public boolean asyncDecode(CachedData arg0)

      { // TODO Auto-generated method stub return false; }

      @Override
      public T decode(CachedData arg0) {
      // TODO Auto-generated method stub
      StreamSource str = new StreamSource(new java.io.ByteArrayInputStream(arg0.getData()));

      Object obj;
      try

      { obj = unmarshaler.unmarshal(str); }

      catch (Exception e)

      { // TODO Auto-generated catch block throw new RuntimeException(e); }

      return (T)obj;
      }

      @Override
      public CachedData encode(T arg0) {
      // TODO Auto-generated method stub
      ByteArrayOutputStream sink = new ByteArrayOutputStream();

      try { marshaler.marshal(arg0, new StreamResult(sink)); } catch (Exception e) { // TODO Auto-generated catch block throw new RuntimeException(e); }

      return new CachedData(0, sink.toByteArray(), getMaxSize());
      }

      @Override
      public int getMaxSize()

      { // TODO Auto-generated method stub return CachedData.MAX_SIZE; }

      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            daschl Michael Nitschinger
            perry Perry Krug
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty