package me.prettyprint.cassandra.serializers;

import java.nio.ByteBuffer;

import me.prettyprint.cassandra.serializers.AbstractSerializer;
import me.prettyprint.cassandra.serializers.LongSerializer;

/**
 * Uses LongSerializer via translating Doubles to and from raw long bytes form.
 * 
 * @author Yuri Finkelstein 
 */
public class DoubleSerializer extends AbstractSerializer<Double> {

  private static final DoubleSerializer instance = new DoubleSerializer();

  public static DoubleSerializer get() {
    return instance;
  }
  
  @Override
  public ByteBuffer toByteBuffer(Double obj) {
    return LongSerializer.get().toByteBuffer(Double.doubleToRawLongBits(obj));
  }

  @Override
  public Double fromByteBuffer(ByteBuffer bytes) {
    return Double.longBitsToDouble (LongSerializer.get().fromByteBuffer(bytes));
  }

}


@@ -583,24 +583,72 @@
 uble obj) %7B%0A
+    if (obj == null) %7B%0A      return null;%0A    %7D%0A
     return L
@@ -790,40 +790,17 @@
     
-return Double.longBitsToDouble (
+Long l = 
 Long
@@ -837,16 +837,74 @@
 r(bytes)
+;%0A    return l == null ? null : Double.longBitsToDouble (l
 );%0A  %7D%0A%0A

Add null guards to DoubleSerializer